예제 #1
0
 public static Item CreateRandomItem(int level, ItemType itemType)
 {
     if (itemType == ItemType.Cannon)
     {
         return(Cannon.CreateRandomCannon(level));
     }
     else if (itemType == ItemType.EMPGenerator)
     {
         return(EMPGenerator.CreateRandomEMPGenerator(level));
     }
     else if (itemType == ItemType.Engine)
     {
         return(Engine.CreateRandomEngine(level));
     }
     else if (itemType == ItemType.Flamethrower)
     {
         return(Flamethrower.CreateRandomFlamethrower(level));
     }
     else if (itemType == ItemType.Hangar)
     {
         return(Hangar.CreateRandomHangar(level));
     }
     else if (itemType == ItemType.Harpoon)
     {
         return(Harpoon.CreateRandomHarpoon(level));
     }
     else if (itemType == ItemType.Hull)
     {
         return(Hull.CreateRandomHull(level));
     }
     else if (itemType == ItemType.Laser)
     {
         return(Laser.CreateRandomLaser(level));
     }
     else if (itemType == ItemType.LifeSupport)
     {
         return(LifeSupport.CreateRandomLifeSupport(level));
     }
     else if (itemType == ItemType.MineLayer)
     {
         return(MineLayer.CreateRandomMineLayer(level));
     }
     else if (itemType == ItemType.Reactor)
     {
         return(Reactor.CreateRandomReactor(level));
     }
     else if (itemType == ItemType.RocketLauncher)
     {
         return(RocketLauncher.CreateRandomRocketLauncher(level));
     }
     else if (itemType == ItemType.ShieldGenerator)
     {
         return(ShieldGenerator.CreateRandomShieldGenerator(level));
     }
     else
     {
         return(null);
     }
 }
예제 #2
0
        public ItemsGenerator(IItemGeneratorConfiguration configuration, IImagesStorage imagesStorage, IAncientSpellsProvider spellsProvider)
        {
            var bonusesGenerator = new BonusesGenerator(configuration.BonusesConfiguration);

            weaponGenerators = new Dictionary <WeaponType, IWeaponGenerator>
            {
                {
                    WeaponType.Sword,
                    new WeaponGenerator("Sword",
                                        WorldImageNameSword,
                                        configuration.WeaponsConfiguration.SwordsConfiguration,
                                        configuration.WeaponsConfiguration,
                                        bonusesGenerator,
                                        imagesStorage)
                },
                {
                    WeaponType.Dagger,
                    new WeaponGenerator("Dagger",
                                        WorldImageNameDagger,
                                        configuration.WeaponsConfiguration.DaggersConfiguration,
                                        configuration.WeaponsConfiguration,
                                        bonusesGenerator,
                                        imagesStorage)
                },
                {
                    WeaponType.Mace,
                    new WeaponGenerator("Mace",
                                        WorldImageNameMace,
                                        configuration.WeaponsConfiguration.MacesConfiguration,
                                        configuration.WeaponsConfiguration,
                                        bonusesGenerator,
                                        imagesStorage)
                },
                {
                    WeaponType.Axe,
                    new WeaponGenerator("Axe",
                                        WorldImageNameAxe,
                                        configuration.WeaponsConfiguration.AxesConfiguration,
                                        configuration.WeaponsConfiguration,
                                        bonusesGenerator,
                                        imagesStorage)
                },
                {
                    WeaponType.Staff,
                    new WeaponGenerator("Staff",
                                        WorldImageNameStaff,
                                        configuration.WeaponsConfiguration.StaffsConfiguration,
                                        configuration.WeaponsConfiguration,
                                        bonusesGenerator,
                                        imagesStorage)
                }
            };
            armorGenerator         = new ArmorGenerator(configuration.ArmorConfiguration, bonusesGenerator, imagesStorage);
            shieldGenerator        = new ShieldGenerator(configuration.ShieldsConfiguration, bonusesGenerator, imagesStorage);
            spellBookGenerator     = new SpellBookGenerator(configuration.SpellBooksConfiguration, bonusesGenerator, imagesStorage);
            usableItemsGenerator   = new UsableItemsGenerator(imagesStorage, spellsProvider);
            resourceItemsGenerator = new ResourceItemsGenerator();
            foodItemsGenerator     = new FoodItemsGenerator(imagesStorage);
        }
 private void Start()
 {
     _shieldGenerator         = new ShieldGenerator(_healthBar, _shieldGeneratorData.MaxHealth);
     _shieldTurret.IReparable = _shieldGenerator;
     _shieldTurret.IDamageble = _shieldGenerator;
     _waitBarrierTimer        = new WaitForSeconds(_shieldGeneratorData.BarrierDuration);
     EnableChargingSprite(false);
 }
    public override void OnInspectorGUI()
    {
        DrawDefaultInspector();

        ShieldGenerator script = (ShieldGenerator)target;

        if (GUILayout.Button("Generate"))
        {
            script.Generate();
        }
    }
예제 #5
0
    protected override void Start()
    {
        base.Start();

        name = "Shield Generator";

        Instance = this;

        CurrentHealth = Health = 500;

        lightGo     = gameObject.FindChild("Point light");
        sphere      = gameObject.FindChild("shieldgenerator").FindChild("Sphere");
        fountain    = gameObject.FindChild("shieldgenerator").FindChild("Shield");
        shieldInAir = gameObject.FindChild("Shield");
    }
예제 #6
0
    public void Initialize
    (
        Liscense liscense,
        AIParameters aiParameters,
        Dictionary <FlotsamType, int> lootDrops,
        Hull hull,
        Engine engine,
        Reactor reactor,
        ShieldGenerator shieldGenerator,
        LifeSupport lifeSupport,
        Weapon[] weapons
    )
    {
        Hull            = hull;
        Engine          = engine;
        Reactor         = reactor;
        ShieldGenerator = shieldGenerator;
        LifeSupport     = lifeSupport;
        Weapons         = weapons;
        WeaponInputs    = new bool[Weapons.Length];

        base.Initialize
        (
            thrustForce: Engine.ThrustForceMultiplier * Mathf.PI * Mathf.Pow(Hull.Size, 2),
            turnForce: Engine.TurnForceMultiplier * Mathf.PI * Mathf.Pow(Hull.Size, 2),
            maximumSpeed: Engine.MaximumSpeed,
            mass: Hull.Mass
        );

        transform.localScale = new Vector2(Hull.Size, Hull.Size);
        Liscense             = liscense;
        SelectedWeapon       = 0;
        ShowFDN    = (Team != 0);
        Immunities = new List <AttackImmunityRecord>();
        Autopilot  = new FastAutopilot(this);
        AI         = AI.CreateAI(aiParameters, this, Autopilot, Liscense.Mother);
        LootDrops  = lootDrops;
        Credits    = 0f;
        Scrap      = Hull.HullSpace;
        Bullets    = 0;
        Rockets    = 0;
        Mines      = 0;
        Drones     = 0;
        Turrets    = 0;

        ModelSpecificInitialization();
    }
예제 #7
0
    public void Init(ShieldGenerator s)
    {
        source = s;
        foreach (Shield shield in shields)
        {
            shield.Init(this, 3);
        }
        centerShield.Init(this, 9999);
        duration += spawnDuration;
        Vector3 maxScale = transform.localScale;

        transform.localScale = Vector3.one * 0.001f;//unity doesn't like 0 here for some reason
        isAnimatingUp        = true;
        animateUp            = transform.DOScale(maxScale, spawnDuration);
        animateUp.OnComplete(() => { isAnimatingUp = false; });
        i.DOFillAmount(0, duration + spawnDuration);
        i.DOColor(Color.red, duration + spawnDuration);
    }
예제 #8
0
 private void Awake()
 {
     _shieldGenerator = GetComponentInParent <ShieldGenerator>();
 }
예제 #9
0
 /// <summary>
 /// Attaches this shield generator and its shield to this item.
 /// </summary>
 /// <param name="generator">The shield generator.</param>
 private void Attach(ShieldGenerator generator) {
     D.AssertNotNull(generator.Shield);
     var shield = generator.Shield;
     if (!Shields.Contains(shield)) {
         // only need to record and setup range monitors once. The same monitor can have more than 1 weapon
         Shields.Add(shield);
     }
 }
예제 #10
0
        private int totalShieldGeneratorsAlive(ShieldGenerator _shieldGenerator, int _totalShieldGen)
        {
            if (_shieldGenerator.Alive)
            {
                _totalShieldGen++;

                return _totalShieldGen;
            }
            else
                return _totalShieldGen;
        }
예제 #11
0
        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);

            _mouseBB = new Rectangle(ms.X, ms.Y, 1, 1);
            _gamefont = Content.Load<SpriteFont>(@"gamefont");

            _hq = Content.Load<Texture2D>(@"Textures\Sprites\hq");
            _hqBB = new Rectangle((GraphicsDevice.PresentationParameters.BackBufferWidth/2 - (_hq.Width/2)) , 350, (int)(_hq.Width / 2f), (int)(_hq.Height / 2f));

            _hqShields = Content.Load<Texture2D>(@"Textures\Sprites\hqShields");
            _hqShieldsBB = new Rectangle(_hqBB.X -20, _hqBB.Y, (int)(_hqShields.Width), (int)(_hqShields.Height));

            _shieldGen = Content.Load<Texture2D>(@"Textures\Sprites\shieldgen");

            _logo = Content.Load<Texture2D>(@"Textures\Sprites\aftermathLogo");
            _logoBB = new Rectangle(275, -10, (int)(_logo.Width / 2f), (int)(_logo.Height / 2f));

            _newGame = Content.Load<Texture2D>(@"Textures\Sprites\NewGame");
            _newGameBB = new Rectangle(300, 150, (int)(_newGame.Width / 3f), (int)(_newGame.Height / 3f));
            _highscore = Content.Load<Texture2D>(@"Textures\Sprites\HighScore");
            _highscoreBB = new Rectangle(300, 205, (int)(_highscore.Width / 3f), (int)(_highscore.Height / 3f));
            _exitGame = Content.Load<Texture2D>(@"Textures\Sprites\Exit");
            _exitGameBB = new Rectangle(300, 260, (int)(_exitGame.Width / 3f), (int)(_exitGame.Height / 3f));

            _upgrades = Content.Load<Texture2D>(@"Textures\Sprites\Upgrades");
            _upgradesBB = new Rectangle(300, 150, (int)(_upgrades.Width / 3f), (int)(_upgrades.Height / 3f));
            _nextWave = Content.Load<Texture2D>(@"Textures\Sprites\NextWave");
            _nextWaveBB = new Rectangle(600, 530, (int)(_nextWave.Width / 3f), (int)(_nextWave.Height / 3f));
            _generator = Content.Load<Texture2D>(@"Textures\Sprites\Generator");
            _generatorBB = new Rectangle(600, 240, (int)(_generator.Width / 3f), (int)(_generator.Height / 3f));
            _shields = Content.Load<Texture2D>(@"Textures\Sprites\Shields");
            _shieldsBB = new Rectangle(600, 150, (int)(_shields.Width / 3f), (int)(_shields.Height / 3f));
            _missile = Content.Load<Texture2D>(@"Textures\Sprites\Missiles");
            _missileBB = new Rectangle(600, 315, (int)(_missile.Width / 3f), (int)(_missile.Height / 3f));
            _bomb = Content.Load<Texture2D>(@"Textures\Sprites\Bomb");
            _bombBB = new Rectangle(600, 420, (int)(_bomb.Width / 3f), (int)(_bomb.Height / 3f));

            _begin = Content.Load<Texture2D>(@"Textures\Sprites\Begin");
            _beginBB = new Rectangle(300, 205, (int)(_beginBB.Width / 3f), (int)(_beginBB.Height / 3f));

            _resume = Content.Load<Texture2D>(@"Textures\Sprites\Resume");
            _resumeBB = new Rectangle(300, 205, (int)(_exitGame.Width / 3f), (int)(_exitGame.Height / 3f));

            _shieldGeneratorA = new ShieldGenerator(this, spriteBatch, graphics.GraphicsDevice.Viewport.TitleSafeArea, _shieldGen, new Vector2(_hqBB.X - 100, _hqBB.Y + 100));
            _shieldGeneratorB = new ShieldGenerator(this, spriteBatch, graphics.GraphicsDevice.Viewport.TitleSafeArea, _shieldGen, new Vector2(_hqBB.X - 200, _hqBB.Y + 100));
            _shieldGeneratorC = new ShieldGenerator(this, spriteBatch, graphics.GraphicsDevice.Viewport.TitleSafeArea, _shieldGen, new Vector2(_hqBB.X + (_hq.Width / 2) + 50, _hqBB.Y + 100));
            _shieldGeneratorD = new ShieldGenerator(this, spriteBatch, graphics.GraphicsDevice.Viewport.TitleSafeArea, _shieldGen, new Vector2(_hqBB.X + (_hq.Width / 2) + 150, _hqBB.Y + 100));
            _headquarters = new Hq(this, spriteBatch, graphics.GraphicsDevice.Viewport.TitleSafeArea, _hq, _hqBB);
            _headquartersShields = new HqShields(this, spriteBatch, graphics.GraphicsDevice.Viewport.TitleSafeArea, _hqShields, _hqShieldsBB);

            _drawLine = new DrawLine(this, Content, graphics);

            _gameState = new GameStateManager(this);
            _gameState.LoadContent();
        }
예제 #12
0
    protected override void Start()
    {
        base.Start();

        name = "Shield Generator";

        Instance = this;

        CurrentHealth = Health = 500;

        lightGo = gameObject.FindChild("Point light");
        sphere = gameObject.FindChild("shieldgenerator").FindChild("Sphere");
        fountain = gameObject.FindChild("shieldgenerator").FindChild("Shield");
        shieldInAir = gameObject.FindChild("Shield");
    }