Commit aeefeaba authored by Unknown's avatar Unknown

Scale Fix

parent 83998179
...@@ -55,7 +55,6 @@ public class MovingPlattform : MonoBehaviour { ...@@ -55,7 +55,6 @@ public class MovingPlattform : MonoBehaviour {
} }
private void MoveForward () { private void MoveForward () {
Debug.Log(gameObject.name + " form: " + isAt + " to " + (isAt+1) + " isFacing: " + isFacingForward);
if ((isAt + 1) < m_Points.Count) { if ((isAt + 1) < m_Points.Count) {
//normale vor und zurück bewegung //normale vor und zurück bewegung
StartCoroutine (Move (origin + m_Points[isAt], origin + m_Points[isAt + 1])); StartCoroutine (Move (origin + m_Points[isAt], origin + m_Points[isAt + 1]));
......
...@@ -172,32 +172,36 @@ public class PlayerAnimation : MonoBehaviour ...@@ -172,32 +172,36 @@ public class PlayerAnimation : MonoBehaviour
transform.localScale = s; transform.localScale = s;
} }
private IEnumerator ScaleUp(int from, int to) private IEnumerator ScaleUp(float from, float to)
{ {
/*m_isAnimating = true; m_isAnimating = true;
Vector3 s = transform.localScale; float newSize = m_SizePerCharge * Mathf.Abs((to - from));
float step = 1 / m_Time; transform.localScale += new Vector3(newSize * Mathf.Sign(transform.localScale.x), newSize, newSize);
float timer = 0.0f; yield return null;
float x = 0f; m_isAnimating = false;
float diff = to - from; }
while (timer <= m_Time)
{
x = m_SizePerCharge * Mathf.Abs(diff);
transform.localScale = Vector3.Lerp(s, s + new Vector3(x * Mathf.Sign(transform.localScale.x), x, x),
m_AirScale.Evaluate(timer / m_Time));
timer += Time.deltaTime;
yield return null;
}
transform.localScale = s + new Vector3(x * Mathf.Sign(transform.localScale.x), x, x); private IEnumerator ScaleDown(float from, float to)
m_isAnimating = false;*/ {
m_isAnimating = true;
float newSize = m_SizePerCharge * Mathf.Abs((to - from));
transform.localScale -= new Vector3(newSize * Mathf.Sign(transform.localScale.x), newSize, newSize);
yield return null;
m_isAnimating = false;
}
/*private IEnumerator ScaleUp(float from, float to)
{
m_isAnimating = true; m_isAnimating = true;
float step = 1 / m_Time; float step = 1 / m_Time;
float timer = 0.0f; float timer = 0.0f;
Vector3 scale = transform.localScale;
while (timer <= m_Time) while (timer <= m_Time)
{ {
float newSize = m_SizePerCharge * Mathf.Abs((to - from)); float newSize = m_SizePerCharge * Mathf.Abs((to - from));
scale.x *= Mathf.Sign(transform.localScale.x);
transform.localScale = Vector3.Lerp(transform.localScale, transform.localScale + new Vector3(newSize * Mathf.Sign(transform.localScale.x), newSize, newSize), transform.localScale = Vector3.Lerp(transform.localScale, transform.localScale + new Vector3(newSize * Mathf.Sign(transform.localScale.x), newSize, newSize),
m_AirScale.Evaluate(timer / m_Time)); m_AirScale.Evaluate(timer / m_Time));
timer += Time.deltaTime; timer += Time.deltaTime;
...@@ -205,42 +209,20 @@ public class PlayerAnimation : MonoBehaviour ...@@ -205,42 +209,20 @@ public class PlayerAnimation : MonoBehaviour
} }
m_isAnimating = false; m_isAnimating = false;
} }*/
private IEnumerator ScaleDown(int from, int to)
{
/*m_isAnimating = true;
Vector3 s = transform.localScale;
float step = 1 / m_Time;
float timer = 0.0f;
float x = 0;
float diff = to - from;
while (timer <= m_Time)
{
x = m_SizePerCharge * Mathf.Abs(diff);
transform.localScale = Vector3.Lerp(s, s - new Vector3(x * Mathf.Sign(transform.localScale.x), x, x),
m_AirScale.Evaluate(timer / m_Time));
timer += Time.deltaTime;
yield return null;
}
if (r_State.GetCharges() > 0)
{
transform.localScale = s - new Vector3(x * Mathf.Sign(transform.localScale.x), x, x);
}
else
{
ScaleReset();
}
m_isAnimating = false;*/ /*private IEnumerator ScaleDown(float from, float to)
{
m_isAnimating = true; m_isAnimating = true;
float step = 1 / m_Time; float step = 1 / m_Time;
float timer = 0.0f; float timer = 0.0f;
Vector3 scale = transform.localScale;
while (timer <= m_Time) while (timer <= m_Time)
{ {
float newSize = m_SizePerCharge * Mathf.Abs((to - from)); float newSize = m_SizePerCharge * Mathf.Abs((to - from));
scale.x *= Math.Sign(transform.localScale.x);
transform.localScale = Vector3.Lerp(transform.localScale, transform.localScale - new Vector3(newSize * Mathf.Sign(transform.localScale.x), newSize, newSize), transform.localScale = Vector3.Lerp(transform.localScale, transform.localScale - new Vector3(newSize * Mathf.Sign(transform.localScale.x), newSize, newSize),
m_AirScale.Evaluate(timer / m_Time)); m_AirScale.Evaluate(timer / m_Time));
timer += Time.deltaTime; timer += Time.deltaTime;
...@@ -249,8 +231,8 @@ public class PlayerAnimation : MonoBehaviour ...@@ -249,8 +231,8 @@ public class PlayerAnimation : MonoBehaviour
if (r_State.GetCharges() > 0) if (r_State.GetCharges() > 0)
{ {
float newSize = m_SizePerCharge * Mathf.Abs((to - from)); //float newSize = m_SizePerCharge * Mathf.Abs((to - from));
transform.localScale = transform.localScale - new Vector3(newSize * Mathf.Sign(transform.localScale.x), newSize, newSize); //transform.localScale = transform.localScale - new Vector3(newSize * Mathf.Sign(transform.localScale.x), newSize, newSize);
} }
else else
{ {
...@@ -258,7 +240,7 @@ public class PlayerAnimation : MonoBehaviour ...@@ -258,7 +240,7 @@ public class PlayerAnimation : MonoBehaviour
} }
m_isAnimating = false; m_isAnimating = false;
} }*/
private IEnumerator RotatingElements() private IEnumerator RotatingElements()
{ {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment