Beispiel #1
0
        public AI(Game1 Game, Sprite spriteSheet, AlliedShip ship, AIBehaviour behaviour, string weapon, float avoidRadius, Rectangle formationArea)
        {
            this.Game          = Game;
            this.spriteSheet   = spriteSheet;
            this.ship          = ship;
            this.AvoidRadius   = avoidRadius;
            this.FormationArea = formationArea;

            switch (behaviour)
            {
            case AIBehaviour.Standard:
                this.behaviour = new StandardBehaviour(Game, this, ship);
                break;

            case AIBehaviour.Aggressive:
                throw new NotImplementedException("Not implemented!");

            case AIBehaviour.NoWeapon:
                this.behaviour = new NoWeaponBehaviour(Game, this, ship);
                break;

            default:
                break;
            }

            switch (weapon.ToLower())
            {
            case "basiclaser":
                shotRange   = 300;
                this.weapon = weapon;
                break;

            case "none":
            case "":
                shotRange   = 0;
                this.weapon = "none";
                break;

            default:
                shotRange   = 0;
                this.weapon = "none";
                break;
            }

            AvoidList        = new List <GameObjectVertical>();
            GarbageAvoidList = new List <GameObjectVertical>();
        }
Beispiel #2
0
 public StandardBehaviour(Game1 Game, AI AI, AlliedShip Ship) :
     base(Game, AI, Ship)
 {
 }
 private static void CollideEnemyAlly(EnemyShip enemy, AlliedShip ally)
 {
     enemy.InflictDamage(ally);
     ally.InflictDamage(enemy);
 }
 private static void CollideBulletAlly(EnemyBullet bullet, AlliedShip ally)
 {
     bullet.InflictDamage(ally);
     ally.InflictDamage(bullet);
 }
Beispiel #5
0
 public AggressiveBehaviour(Game1 Game, AI AI, AlliedShip Ship) :
     base(Game, AI, Ship)
 {
 }
 protected Behaviour(Game1 Game, AI ai, AlliedShip Ship)
 {
     this.Game = Game;
     this.ai   = ai;
     this.Ship = Ship;
 }
 public NoWeaponBehaviour(Game1 Game, AI AI, AlliedShip Ship) :
     base(Game, AI, Ship)
 {
 }