示例#1
0
        public static void Update()
        {
            InputManager pMan = InputManager.PrivGetInstance();

            Debug.Assert(pMan != null);

            // Pressed Space Bar : Shoot Missile
            bool isSpaceKeyPressedNow = Azul.Input.GetKeyState(Azul.AZUL_KEY.KEY_SPACE);
            bool isCKeyPressedNow     = Azul.Input.GetKeyState(Azul.AZUL_KEY.KEY_C);
            bool isSKeyPressedNow     = Azul.Input.GetKeyState(Azul.AZUL_KEY.KEY_S);

            if (isSpaceKeyPressedNow && pMan.isSpaceKeyPressedPrev == false)
            {
                pMan.pSubjectShootMissile.Notify();
            }

            if (Azul.Input.GetKeyState(Azul.AZUL_KEY.KEY_ARROW_LEFT))
            {
                pMan.pSubjectMoveLeft.Notify();
            }

            if (Azul.Input.GetKeyState(Azul.AZUL_KEY.KEY_ARROW_RIGHT))
            {
                pMan.pSubjectMoveRight.Notify();
            }

            if (isCKeyPressedNow && pMan.isCKeyPressedPrev == false)
            {
                pMan.pSubjectToggleCollisionBox.Notify();
            }

            if (isSKeyPressedNow && pMan.isSKeyPressedPrev == false)
            {
                pMan.pSubjectToggleShield.Notify();
            }

            if (Azul.Input.GetKeyState(Azul.AZUL_KEY.KEY_1) && GameScene.GetCurrentGameSceneState() == GameState.SceneName.Select)
            {
                GameScene.Set1PlayerMode();
                GameScene.Handle();
            }

            //if (Azul.Input.GetKeyState(Azul.AZUL_KEY.KEY_2) && GameScene.GetCurrentGameSceneState() == GameState.SceneName.Select)
            //{
            //    GameScene.Set2PlayerMode();
            //    GameScene.Handle();
            //}

            if (Azul.Input.GetKeyState(Azul.AZUL_KEY.KEY_R) && GameScene.GetCurrentGameSceneState() == GameState.SceneName.GameOver)
            {
                GameScene.Handle();
            }

            pMan.isSpaceKeyPressedPrev = isSpaceKeyPressedNow;
            pMan.isCKeyPressedPrev     = isCKeyPressedNow;
            pMan.isSKeyPressedPrev     = isSKeyPressedNow;
        }
示例#2
0
        public void RemoveComposite()
        {
            if (this.poHead != null && this.poLast != null)
            {
                return;
            }

            if (this is AlienColumn)
            {
                AlienManager.Add(this);
            }

            if (this is ShieldColumn)
            {
                ShieldNodeManager.Add(this);
            }

            Composite pParent = (Composite)this.pParent;

            if (this.pPrev == null && this.pNext == null)
            {
                pParent.poLast = null;
                pParent.poHead = null;
            }
            else if (this.pPrev == null)
            {
                pParent.poHead   = this.pNext;
                this.pNext.pPrev = null;
            }
            else if (this.pNext == null)
            {
                pParent.poLast   = this.pPrev;
                this.pPrev.pNext = null;
            }
            else
            {
                this.pPrev.pNext = this.pNext;
                this.pNext.pPrev = this.pPrev;
            }
            this.RemoveFromSpriteBatch();
            this.pPrev = null;
            this.pNext = null;
            this.Remove(this);

            if (pParent.poHead == null && pParent.poLast == null && pParent.pNext == null && pParent.pPrev == null)
            {
                pParent.Remove(this);
                if (pParent is AlienGroup)
                {
                    GameScene.Handle();
                }
                //AlienManager.PrintMe();
                //AlienManager.ResetAllAlienGrid();
                //pParent.RemoveFromSpriteBatch();
            }
        }