Пример #1
0
        public GoToSafeHouse(MovingEntity owner)
        {
            Owner = owner;
            SubGoals = new Stack<Goal>();
            pathFinding = new PathFinding(Owner);
            flee = new Flee(Owner);

            AddSubgoal(pathFinding);
        }
Пример #2
0
        private void DrawGdbText(Goal currentGoal, double x, double y, SpriteBatch spriteBatch)
        {
            spriteBatch.DrawString(Font, currentGoal.ToString(), new Vector2((float)x, (float)y),
                                       new Color(0, 0, 0), 0f, Vector2.Zero, .7f, SpriteEffects.None, 0f);

            if (currentGoal.GetType().BaseType == typeof(CompositeGoal))
            {
                for (int i = 0; i < ((CompositeGoal) currentGoal).SubGoals.Count; i ++)
                {
                    Goal nextGoal = ((CompositeGoal) currentGoal).SubGoals.ElementAt(i);
                    DrawGdbText(nextGoal, x + 15, y + ((i + 1) * 15), spriteBatch);
                }
            }
        }
Пример #3
0
 public void AddSubgoal(Goal _goal)
 {
     RemoveAllSubgoals();
     SubGoals.Push(_goal);
 }