v7 slow talking :D

This commit is contained in:
2018-11-15 14:11:50 +01:00
parent 131529576c
commit bf92632485
6 changed files with 49 additions and 14 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
+5 -5
View File
@@ -48756,7 +48756,7 @@ MonoBehaviour:
m_PrefabParentObject: {fileID: 0} m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0} m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 311513960} m_GameObject: {fileID: 311513960}
m_Enabled: 0 m_Enabled: 1
m_EditorHideFlags: 0 m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 62866dc69f17c5f40a7ec527e34e82f1, type: 3} m_Script: {fileID: 11500000, guid: 62866dc69f17c5f40a7ec527e34e82f1, type: 3}
m_Name: m_Name:
@@ -48769,7 +48769,7 @@ MonoBehaviour:
- {fileID: 1772413224} - {fileID: 1772413224}
- {fileID: 210611261} - {fileID: 210611261}
st: 5 st: 5
speed2: 5 speed2: 30
rotation: 0 rotation: 0
walkspeed: 1.5 walkspeed: 1.5
--- !u!114 &311513964 --- !u!114 &311513964
@@ -48778,7 +48778,7 @@ MonoBehaviour:
m_PrefabParentObject: {fileID: 0} m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0} m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 311513960} m_GameObject: {fileID: 311513960}
m_Enabled: 1 m_Enabled: 0
m_EditorHideFlags: 0 m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 91e6f3895f276d94da1803128e6290e0, type: 3} m_Script: {fileID: 11500000, guid: 91e6f3895f276d94da1803128e6290e0, type: 3}
m_Name: m_Name:
@@ -48791,8 +48791,8 @@ MonoBehaviour:
- {fileID: 1772413224} - {fileID: 1772413224}
- {fileID: 210611261} - {fileID: 210611261}
st: 5 st: 5
speed2: 5 speed2: 20
rotation: 1 rotation: 5
--- !u!1 &311874317 --- !u!1 &311874317
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
+20 -2
View File
@@ -13,6 +13,7 @@ public class Walk : MonoBehaviour
for (int index = 0; index < legs.Count; ++index) for (int index = 0; index < legs.Count; ++index)
{ {
legsInitial.Add(legs[index].GetComponent<Leg>().point); legsInitial.Add(legs[index].GetComponent<Leg>().point);
step2.Add( new Vector3() );
} }
} }
@@ -61,6 +62,8 @@ public class Walk : MonoBehaviour
public float walkspeed = 1; public float walkspeed = 1;
private List<Vector3> step2 = new List<Vector3>();
// Update is called once per frame // Update is called once per frame
void FixedUpdate() void FixedUpdate()
{ {
@@ -85,17 +88,32 @@ public class Walk : MonoBehaviour
t2.x *= walkspeed; t2.x *= walkspeed;
// rotate x,y around rotation. // rotate x,y around rotation.
legs[index].GetComponent<Leg>().point += Quaternion.Euler(0, rotation, 0) * t2; step2[index] = (Quaternion.Euler(0, rotation, 0) * t2) / speed2;
} }
else else
{ {
legs[index].GetComponent<Leg>().point = legsInitial[index] + s[t].pos; Vector3 t2 = s[t].pos;
t2.x *= walkspeed;
// rotate x,y around rotation.
step2[index] = (Quaternion.Euler(0, rotation, 0) * t2) / speed2;
} }
} }
speed = speed2; speed = speed2;
} }
else else
{
speed--; speed--;
makestep();
}
}
void makestep()
{
for (int index = 0; index < legs.Count; ++index)
{
legs[index].GetComponent<Leg>().point += step2[index];
}
} }
} }
+24 -7
View File
@@ -13,6 +13,8 @@ public class Walk2 : MonoBehaviour
for (int index = 0; index < legs.Count; ++index) for (int index = 0; index < legs.Count; ++index)
{ {
legsInitial.Add(legs[index].GetComponent<Leg>().point); legsInitial.Add(legs[index].GetComponent<Leg>().point);
step2.Add(0);
step3.Add(0);
} }
} }
@@ -62,13 +64,15 @@ public class Walk2 : MonoBehaviour
int size = 8; int size = 8;
//public float walkspeed = 1; //public float walkspeed = 1;
private List<float> step2 = new List<float>();
private List<float> step3 = new List<float>();
// Update is called once per frame // Update is called once per frame
void FixedUpdate() void FixedUpdate()
{ {
if (speed <= 0) if (speed <= 0)
{ {
if (st >= size-1) if (st >= size - 1)
st = 0; st = 0;
else else
st++; st++;
@@ -83,21 +87,34 @@ public class Walk2 : MonoBehaviour
if (s[t].inAir == false) if (s[t].inAir == false)
{ {
Vector3 n = legs[index].GetComponent<Leg>().getWorldPos(); step2[index] = (rotation * s[t].rotation) / speed2;
n = Quaternion.Euler(0, rotation * s[t].rotation, 0) * n; step3[index] = s[t].height / speed2;
n.y += s[t].height;
// rotate x,y around rotation.
legs[index].GetComponent<Leg>().setWorldPos(n);
} }
else 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; speed = speed2;
} }
else else
{
speed--; 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);
}
} }
} }