Exemplo n.º 1
0
 public FleeState(AntsGame game, Ant agent)
     : base(game, agent)
 {
 }
Exemplo n.º 2
0
Arquivo: Ant.cs Projeto: 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;
        }
Exemplo n.º 3
0
 public FollowState(AntsGame game, Ant agent, Ant target)
     : base(game, agent)
 {
     this.target = target;
 }
Exemplo n.º 4
0
 public AttackState(AntsGame game, Ant agent)
     : base(game, agent)
 {
 }
Exemplo n.º 5
0
 public State(AntsGame game, Ant agent)
 {
     Agent = agent;
     Game = game;
 }