Exemplo n.º 1
0
        public void Resurrect()
        {
            IsAlive = true;
            Level.Instance.SpawnedAliveDefenders.Add(this);
            Level.Instance.SpawnedDeadDefenders.Remove(this);

            SwitchAnimation(RunAni);
            State = eState.Running;
            HP.HealFull();
            SetLocationToNearRallyPoint();
        }
        protected void Dispose()
        {
            // Reset HP
            HP.HealFull();

            // Guns
            if (Guns.Count > 0 && Guns[0].GunType == eEnemyGunType.MG1)
            {
                Level.Instance.MGCnt--;
            }
            foreach (BaseGun gun in Guns)
            {
                gun.IsDisposed = true;
            }
            Guns.Clear();

            // Other
            InitialShootDelay = new SimpleTimer(Maths.RandomNr(0, 500));
            ReappearsOnTopCnt = 1;

            IsDisposed = true;
        }
        public void SetPlaneType(ePlaneType planeType, string shipName)
        {
            PlaneType = planeType;
            ShipName  = new StringBuilder(shipName);
            switch (planeType)
            {
            case ePlaneType.Normal:
                Animation = Common.str2Tex("Ships/player");
                Shadow    = Common.str2Tex("Shadows/player");
                CollisionRects.Add(new Rectangle2(Location, new Rectangle(23, 0, 11, 20)));
                CollisionRects.Add(new Rectangle2(Location, new Rectangle(8, 19, 41, 16)));
                CollisionRects.Add(new Rectangle2(Location, new Rectangle(0, 35, 57, 9)));
                Owner.Score += 500;
                break;

            case ePlaneType.Dmg:
                Animation = Common.str2Tex("Ships/playerDmg");
                Shadow    = Common.str2Tex("Shadows/playerDmg");
                CollisionRects.Add(new Rectangle2(Location, new Rectangle(5, 0, 47, 35)));
                CollisionRects.Add(new Rectangle2(Location, new Rectangle(0, 17, 57, 18)));
                CollisionRects.Add(new Rectangle2(Location, new Rectangle(14, 35, 30, 9)));

                Owner.DmgMod += 0.41f;
                MaxVelocity  -= 4f;
                Velocity     -= 0.7f;
                break;

            case ePlaneType.Speed:
                Animation = Common.str2Tex("Ships/playerVelocity");
                Shadow    = Common.str2Tex("Shadows/player");
                CollisionRects.Add(new Rectangle2(Location, new Rectangle(23, 0, 11, 20)));
                CollisionRects.Add(new Rectangle2(Location, new Rectangle(8, 19, 41, 16)));
                CollisionRects.Add(new Rectangle2(Location, new Rectangle(0, 35, 57, 9)));

                Owner.DmgMod -= 0.05f;
                MaxVelocity  += 3.0f;
                Velocity     += 2.0f;

                HP.CurrentHP = HP.MaxHP -= 50;

                MaxShield   += 15;
                Shield.MaxHP = MaxShield;
                Shield.HealFull();
                Owner.Score += 1500;
                break;

            case ePlaneType.Regen:
                Animation = Common.str2Tex("Ships/playerRegen");
                Shadow    = Common.str2Tex("Shadows/player");
                CollisionRects.Add(new Rectangle2(Location, new Rectangle(23, 0, 11, 20)));
                CollisionRects.Add(new Rectangle2(Location, new Rectangle(8, 19, 41, 16)));
                CollisionRects.Add(new Rectangle2(Location, new Rectangle(0, 35, 57, 9)));

                MaxShieldRegen += 0.4f;
                ShieldRegen    += 0.3f;
                MaxShield      += 15;
                Shield.MaxHP    = MaxShield;
                Shield.HealFull();
                HPRegen.MaxValue     += 0.4f;
                HPRegen.CurrentValue += 0.25f;
                break;

            case ePlaneType.Tough:
                Animation = Common.str2Tex("Ships/playerDmg");
                Shadow    = Common.str2Tex("Shadows/playerDmg");
                CollisionRects.Add(new Rectangle2(Location, new Rectangle(5, 0, 47, 35)));
                CollisionRects.Add(new Rectangle2(Location, new Rectangle(0, 17, 57, 18)));
                CollisionRects.Add(new Rectangle2(Location, new Rectangle(14, 35, 30, 9)));

                Owner.DmgMod -= 0.1f;
                HP.MaxHP      = 500;
                HP.HealFull();
                MaxShield    += 35;
                Shield.MaxHP += 10;
                Shield.HealFull();
                MaxVelocity          -= 3.5f;
                Velocity             -= 0.6f;
                HPRegen.MaxValue     += 0.15f;
                HPRegen.CurrentValue += 0.05f;
                GunLoseDamTakenLimit *= 3;
                break;

            default:
                throw new CaseStatementMissingException();
            }
        }