satisfaction
This commit is contained in:
@@ -8,21 +8,35 @@ public class NPCimproved : MonoBehaviour
|
||||
public GameObject npcPrefab;
|
||||
public AudioSource audio;
|
||||
private bool walking = true;
|
||||
Vector3 rotation;
|
||||
|
||||
private void Start() {
|
||||
rotation = transform.right;
|
||||
}
|
||||
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (walking)
|
||||
{
|
||||
//npcPrefab.transform.position += new Vector3(0,0,0.005f);
|
||||
npcPrefab.transform.position += transform.forward * Time.deltaTime;
|
||||
npcPrefab.transform.position = new Vector3(npcPrefab.transform.position.x, 0, npcPrefab.transform.position.z);
|
||||
}
|
||||
// if (walking)
|
||||
// {
|
||||
// npcPrefab.transform.position += new Vector3(0,0,0.005f);
|
||||
// npcPrefab.transform.position += transform.forward * Time.deltaTime;
|
||||
// npcPrefab.transform.position = new Vector3(npcPrefab.transform.position.x, 0, npcPrefab.transform.position.z);
|
||||
// }
|
||||
|
||||
//animator.SetBool("IsTurning", false);
|
||||
|
||||
}
|
||||
|
||||
private void FixedUpdate() {
|
||||
if (walking)
|
||||
{
|
||||
npcPrefab.transform.position += rotation * 0.07f;
|
||||
npcPrefab.transform.position = new Vector3(npcPrefab.transform.position.x, 0, npcPrefab.transform.position.z);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Disabels the animation controller, to simulate getting hit by car
|
||||
void OnCollisionEnter(Collision col) {
|
||||
@@ -37,7 +51,7 @@ public class NPCimproved : MonoBehaviour
|
||||
}
|
||||
if (col.gameObject.tag == "Wall")
|
||||
{
|
||||
|
||||
rotation = Quaternion.AngleAxis(120, Vector3.up) * rotation;
|
||||
npcPrefab.transform.eulerAngles += new Vector3(0,120,0);
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user