Example #1
0
        public void Update(INonPlayableCreatureObject creature, Point position)
        {
            var endTurn = false;

            while (!endTurn)
            {
                var nextStrategy = GetNextStrategy(creature, position);
                if (nextStrategy != null)
                {
                    currentStrategy = nextStrategy;
                }

                endTurn = currentStrategy.Update(creature, position);
            }
        }
 public Creature(Color team, ICreatureStrategy newCombatStrategy, ICreatureStrategy newPathStrategy, Character character, GameMap gameMapRef)
 {
     ID                   = 0;
     Team                 = team;
     CombatStrategy       = newCombatStrategy;
     PathStrategy         = newPathStrategy;
     IsDead               = false;
     IsHumanPlayer        = false;
     GameMapRef           = gameMapRef;
     MoveTimer            = TimeSpan.Zero;
     CastTimer            = TimeSpan.FromSeconds(Mechanics.Roll(4, 30));
     playerInput          = Vector2.Zero;
     Character            = character;
     Position             = new Vector2(300, 300);
     Velocity             = Vector2.Zero;
     boundRect.Width      = Character.Sprite.Width / 3;
     boundRect.Height     = Character.Sprite.Height;
     IsFlying             = false;
     IsGrounded           = true;
     IsKnockedBack        = false;
     NeedsDispose         = false;
     ElevationDestination = Vector2.Zero;
 }
Example #3
0
 public ChangeStrategyRule(ICreatureStrategy source, ICreatureStrategy target, Func <INonPlayableCreatureObject, Point, bool> condition)
 {
     Source    = source;
     Target    = target;
     Condition = condition;
 }
Example #4
0
 public void AddTransferRule(ICreatureStrategy source, ICreatureStrategy target, Func <INonPlayableCreatureObject, Point, bool> condition)
 {
     rules.Add(new ChangeStrategyRule(source, target, condition));
 }
Example #5
0
 public void SetInitialStrategy(ICreatureStrategy strategy)
 {
     currentStrategy = strategy;
 }
 public SpeakingCreature(ICreatureStrategy strategy)
 {
     CurrentStrategy = strategy;
 }