Пример #1
0
        public EnemySquadron(List<Collidable> collidableListRef, CollidableType type, float boundingRadius, BasicModel enemyModel, List<Enemy> enemyList, List<EnemyFrigate> enemyFrigateList, WeaponSystem2D enemyWeaponSystem, Vector3 basePosition, int defaultLife, int amtShips, int shipsArsenal)
        {
            CollidableReference = collidableListRef;
            EnemyList = enemyList;
            _basePosition = basePosition;
            _enemyModel = enemyModel;
            _enemyWeaponSystem = enemyWeaponSystem;

            _type = type;
            _boundingRadius = boundingRadius;

            _randomVar = new Random();

            _enemyTemplate = new Enemy(EnemyList[0].CollidableType, EnemyList[0].BoundingSphereRadius, EnemyList[0].ShipPosition, EnemyList[0].ShipRotation, EnemyList[0].MinShipSpeed,
                EnemyList[0].MaxShipSpeed, EnemyList[0].TurningSpeed, EnemyList[0].DistanceThresholdFriend, EnemyList[0].DistanceThresholdEnemy, EnemyList[0].Life);

            _defaultLife = defaultLife;

            _amountShips = amtShips;

            ShipsArsenal = shipsArsenal;

            EnemyList.AddRange(enemyFrigateList);

            CollidableReference.AddRange(EnemyList);
        }
Пример #2
0
        public void GenerateEnemyAtBase()
        {
            Enemy enemy1 = new Enemy(_enemyTemplate.CollidableType, _enemyTemplate.BoundingSphereRadius, _enemyTemplate.ShipPosition, _enemyTemplate.ShipRotation, _enemyTemplate.MinShipSpeed,
                _enemyTemplate.MaxShipSpeed, _enemyTemplate.TurningSpeed, _enemyTemplate.DistanceThresholdFriend, _enemyTemplate.DistanceThresholdEnemy, _enemyTemplate.Life);
            enemy1.Life = _defaultLife;
            enemy1.ShipPosition = new Vector3(_basePosition.X + _randomVar.Next(300), _basePosition.Y + _randomVar.Next(300), _basePosition.Z + _randomVar.Next(300));

            //If the enemy is destroyed by a player, it is added to the ShipsDestroyedPlayer variable.

            enemy1.DestroyedByPlayer += (object sender, EventArgs args) =>
                {
                    ShipsDestroyedPlayer++;
                };

            CollidableReference.Add(enemy1);
            EnemyList.Add(enemy1);
        }