Exemple #1
0
 /// <summary>
 /// Execute.
 /// Executes the stored command.
 /// In this case it fires a laser.
 /// </summary>
 public override void Execute()
 {
     LaserCannon.Fire();
 }
Exemple #2
0
    private void Update()
    {
        if (drehtAn)
        {
            if (GameObject.FindWithTag("Laser") == null)
            {
                if (pSelectedPiece == null)
                {
                    return;
                }
                else
                {
                    if (pMoveMade)
                    {
                        if (Input.GetKeyDown(KeyCode.Space))
                        {
                            pSelectedPiece.Deselect();
                            pSelectedPiece = null;
                            pPieceRotated  = 0;
                            pCellMovedTo   = null;

                            pMoveMade = false;

                            pLaserCannon.Fire(pLaserCannon.GetFireDirection());
                            pGameManager.SwitchPlayerTurn();
                            return;
                        }
                        if (Input.GetKeyDown(KeyCode.Q) && pPieceRotated == -1)
                        {
                            bool rotated = pSelectedPiece.Rotate(1);
                            pPieceRotated = 0;
                            pMoveMade     = false;
                            return;
                        }
                        if (Input.GetKeyDown(KeyCode.E) && pPieceRotated == 1)
                        {
                            bool rotated = pSelectedPiece.Rotate(-1);
                            pPieceRotated = 0;
                            pMoveMade     = false;
                            return;
                        }
                    }
                    else
                    {
                        if (Input.GetKeyDown(KeyCode.Q))
                        {
                            bool rotated = pSelectedPiece.Rotate(1);
                            if (rotated)
                            {
                                pPieceRotated = 1;
                                pMoveMade     = true;
                                return;
                            }
                        }
                        if (Input.GetKeyDown(KeyCode.E))
                        {
                            bool rotated = pSelectedPiece.Rotate(-1);
                            if (rotated)
                            {
                                pPieceRotated = -1;
                                pMoveMade     = true;
                                return;
                            }
                        }
                        if (Input.GetKeyDown(KeyCode.Space))
                        {
                            pSelectedPiece.Deselect();
                            pSelectedPiece = null;
                            pPieceRotated  = 0;
                            pCellMovedTo   = null;

                            pMoveMade = false;
                            return;
                        }
                    }
                }
            }
        }
    }