Exemple #1
0
        public bool Execute(Personage personage)
        {
            if (currentPath == null)
            {
                return(false);
            }
            if (currentNode == null)
            {
                if (!currentPath.NextNode(out currentNode))
                {
                    return(false);
                }
            }
            if (personage.Near(currentNode))
            {
                currentNode = null;
                return(true);
            }
            var tempVector = currentNode.Point - personage.GetGameObject().transform.position;

            tempVector.y = 0;
            if (tempVector != Vector3.zero)
            {
                personage.GetGameObject().transform.rotation = Quaternion.Slerp(personage.GetGameObject().transform.rotation, Quaternion.LookRotation(tempVector), Time.deltaTime * 10f);
            }
            //personage.MoveForward();
            personage.AnimationGroup.MoveForwardBack = 1f;
            return(true);
        }
Exemple #2
0
 public GroupOfAnimation(Personage personage)
 {
     animator = personage.GetGameObject().GetComponent <Animator>();
 }