v7 slow talking :D
This commit is contained in:
+24
-7
@@ -13,6 +13,8 @@ public class Walk2 : MonoBehaviour
|
||||
for (int index = 0; index < legs.Count; ++index)
|
||||
{
|
||||
legsInitial.Add(legs[index].GetComponent<Leg>().point);
|
||||
step2.Add(0);
|
||||
step3.Add(0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,13 +64,15 @@ public class Walk2 : MonoBehaviour
|
||||
int size = 8;
|
||||
|
||||
//public float walkspeed = 1;
|
||||
private List<float> step2 = new List<float>();
|
||||
private List<float> step3 = new List<float>();
|
||||
|
||||
// Update is called once per frame
|
||||
void FixedUpdate()
|
||||
{
|
||||
if (speed <= 0)
|
||||
{
|
||||
if (st >= size-1)
|
||||
if (st >= size - 1)
|
||||
st = 0;
|
||||
else
|
||||
st++;
|
||||
@@ -83,21 +87,34 @@ public class Walk2 : MonoBehaviour
|
||||
|
||||
if (s[t].inAir == false)
|
||||
{
|
||||
Vector3 n = legs[index].GetComponent<Leg>().getWorldPos();
|
||||
n = Quaternion.Euler(0, rotation * s[t].rotation, 0) * n;
|
||||
n.y += s[t].height;
|
||||
// rotate x,y around rotation.
|
||||
legs[index].GetComponent<Leg>().setWorldPos(n);
|
||||
step2[index] = (rotation * s[t].rotation) / speed2;
|
||||
step3[index] = s[t].height / speed2;
|
||||
}
|
||||
else
|
||||
{
|
||||
legs[index].GetComponent<Leg>().point = legsInitial[index] + new Vector3(0, s[t].height, 0);
|
||||
step2[index] = (rotation * s[t].rotation) / speed2;
|
||||
step3[index] = s[t].height / speed2;
|
||||
}
|
||||
}
|
||||
|
||||
speed = speed2;
|
||||
}
|
||||
else
|
||||
{
|
||||
speed--;
|
||||
makestep();
|
||||
}
|
||||
}
|
||||
|
||||
void makestep()
|
||||
{
|
||||
for (int index = 0; index < legs.Count; ++index)
|
||||
{
|
||||
Vector3 n = legs[index].GetComponent<Leg>().getWorldPos();
|
||||
n = Quaternion.Euler(0, step2[index], 0) * n;
|
||||
n.y += step3[index];
|
||||
// rotate x,y around rotation.
|
||||
legs[index].GetComponent<Leg>().setWorldPos(n);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user