- Home /
help me add animation and delay to my waypoint script plizz
i have this script and its c# which i dont understand at all, i just want to add animation to it and between each waypoint a delay or w8 for like 2 seconds play an idle animation then move on to the next waypoint.
using UnityEngine; using System.Collections;
public class AutoAI : MonoBehaviour { public float speed = 20; public float rotatespeed = 10; public float dis = 1; public float LeftRight = 2; public float infront = 1; private int direction = 1;
// Use this for initialization void Start () {
}
// Update is called once per frame void Update () { if(!Physics.Raycast(transform.position, transform.forward, infront)){ transform.Translate(Vector3.forward speed Time.smoothDeltaTime); } else{ if(!Physics.Raycast(transform.position, -transform.right, LeftRight)){ direction = 1; } else if(!Physics.Raycast(transform.position, transform.right, LeftRight)){ direction = -1; } transform.Rotate(Vector3.up, 60 rotatespeed Time.smoothDeltaTime * direction); } }
}