Esempio n. 1
0
 public override void Activate()
 {
     State = Statusgoal.active;
     SubGoals.Clear();
     SubGoals.Add(new PathFollowingGoal(smartEntity, Target));
     SubGoals.Add(new DrinkGoal(smartEntity, Target));
 }
Esempio n. 2
0
 private void CheckStraight()
 {
     if (Player.CanGoStraight(Destination))
     {
         SubGoals.Clear();
         var moveGoal = new MoveTo(Player, Destination);
         moveGoal.Achieved += MoveGoal_Achieved;
         this.AddSubGoal(moveGoal);
         Path.Clear();
         return;
     }
     for (var i = Path.Count - 1; i > 0; i--)
     {
         if (Player.CanGoStraight(Path[i].transform.position))
         {
             var subPath = new Waypoint[Path.Count - i];
             Path.CopyTo(i, subPath, 0, Path.Count - i);
             Path = new List <Waypoint>(subPath);
             this.SubGoals.Clear();
             var moveGoal = new MoveTo(Player, Path[0].transform.position);
             moveGoal.Achieved += MoveGoal_Achieved;
             this.AddSubGoal(moveGoal);
         }
     }
 }
Esempio n. 3
0
 public override void Activate()
 {
     //Target = new Target(new Vector2(Robot.MyWorld.Random.Next(20, 1260), Robot.MyWorld.Random.Next(20, 940)), Robot.MyWorld);
     State = Statusgoal.active;
     SubGoals.Clear();
     SubGoals.Add(new PathFollowingGoal(smartEntity, Target));
     SubGoals.Add(new EatGoal(smartEntity, Target));
 }
        public void RemoveAllSubgoals()
        {
            for (int i = 0; i < SubGoals.Count; i++)
            {
                if (SubGoals[i] != null)
                {
                    SubGoals[i].Terminate();
                }
            }

            SubGoals.Clear();
        }