// Use this for initialization
 void Start()
 {
     anim = this.GetComponent<Animator> ();
     kid = this.transform.parent.GetComponent<CharController6> ();
 }
Exemple #2
0
    //    Vector3 DetermineKidForwardDirection() {
    //        Vector3 nextNodePos = kid.GetComponent<CharController6>().nextNode.position;
    //        nextNodePos = new Vector3(nextNodePos.x, 0f, nextNodePos.z);
    //        Vector3 currentNodePos = kid.GetComponent<CharController6>().currentNode.position;
    //        currentNodePos = new Vector3(currentNodePos.x, 0f, currentNodePos.z);
    //
    //        return Vector3.Normalize (nextNodePos - currentNodePos);
    //    }
    Vector3 DetermineKidForwardDirection(CharController6 kidTarget)
    {
        Vector3 nextNodePos = kidTarget.nextNode.position;
        nextNodePos = new Vector3(nextNodePos.x, 0f, nextNodePos.z);
        Vector3 currentNodePos = kidTarget.currentNode.position;
        currentNodePos = new Vector3(currentNodePos.x, 0f, currentNodePos.z);

        return Vector3.Normalize (nextNodePos - currentNodePos);
    }