Example #1
0
 public FleeState(AntsGame game, Ant agent)
     : base(game, agent)
 {
 }
Example #2
0
File: Ant.cs Project: tvdburgt/ants
        /// <summary>
        /// Attacks enemy ant by decreasing the target's health by the attacker's attack rate
        /// </summary>
        /// <param name="target"></param>
        /// <returns>true if target ant is killed, false otherwise</returns>
        public bool Attack(Ant target)
        {
            // Check if ant is already dead
            if (target.IsDead)
                return false;

            target.Health -= AttackRate;

            if (target.IsDead)
            {
                AttackRate++;
                Console.WriteLine("{0} killed {1} (new attack rate: {2})", this, target, AttackRate);
                return true;
            }

            return false;
        }
Example #3
0
 public FollowState(AntsGame game, Ant agent, Ant target)
     : base(game, agent)
 {
     this.target = target;
 }
Example #4
0
 public AttackState(AntsGame game, Ant agent)
     : base(game, agent)
 {
 }
Example #5
0
 public State(AntsGame game, Ant agent)
 {
     Agent = agent;
     Game = game;
 }