Пример #1
0
        public override void ShootMissile(CoreCannon pShip)
        {
            // Activate and position missile
            Missile pMissile = GameStateManager.GetGame().GetStateCoreCannonManager().ActivateMissile();

            pMissile.SetPos(pShip.GetX(), pShip.GetY() + 20);
            pMissile.SetActive(true);

            // Play shoot sound
            IrrKlang.ISound pSnd = SoundEngineManager.GetSoundEngine().Play2D("shoot.wav");

            // switch states
            this.Handle(pShip);
        }
Пример #2
0
        public override void Execute(float deltaTime)
        {
            spriteProxyRect      = this.pGameObject.GetSpriteProxy().GetSpriteScreenRect();
            spriteProxyHalfWidth = spriteProxyRect.width / 2.0f;

            this.currX = this.pGameObject.GetX();
            this.currY = this.pGameObject.GetY() + this.deltaY;

            // If past window top, reset
            if (this.currY > 896.0f)
            {
                // Set to Ship location + some Y
                CoreCannon ship = (CoreCannon)GameStateManager.GetGame().GetStateGameObjectManager().Find(GameObject.Name.CoreCannon);
                this.currX = ship.GetX();
                this.currY = ship.GetY() + 20.0f;
            }

            // Update X, Y in Sprite
            this.pGameObject.SetX(this.currX);
            this.pGameObject.SetY(this.currY);

            // Add itself back to timer
            TimerManager.Add(TimeEvent.Name.MissileMovement, this, deltaTime);
        }