Beispiel #1
0
    public void Execute()
    {
        Vector3 villagerPosition = owner.transform.position;

        villagerPosition.y = 0;

        if (owner.checkIfAtNode(villagerPosition))
        {
            if (owner.checkIfAtDestination(villagerPosition))
            {
                owner.stateMachine.ChangeState(new GatherStateFighter(owner));
            }
            else
            {
                owner.nodesOfMovement++;
                owner.FindNode();
                if (owner.nodesOfMovement > 3)
                {
                    owner.stateMachine.ChangeState(new SearchStateFighter(owner));
                }
            }
        }
        else
        {
            owner.moveToDestination();
        }
    }
 public void Execute()
 {
     owner.FindPath();
     owner.FindNode();
     if (owner.targetObject != null && owner.pathArray.Count > 0)
     {
         owner.stateMachine.ChangeState(new MoveStateFighter(owner));
     }
     else
     {
         owner.setTag("Fort");
         if (owner.targetObject != null)
         {
             //if still null just wait;
         }
     }
 }