Пример #1
0
    // Update is called once per frame

    void Update()
    {
        CheckPlayerInput();
        currentTile = PlayerInputScript.instance().GetCurrentTile();

        //If the player is allowed to build
        if (buildButtonA && currentTile != null)
        {
            //If build-button is pressed

            if (Shop.PurchaseMachine())
            {
                if (currentTile.transform.position.y > 6)
                {
                    buildingRotation.SetLookRotation(new Vector3(0f, 0f, 180f), Vector3.down);
                }
                else
                {
                    buildingRotation.SetLookRotation(new Vector3(0f, 0f, 0f), Vector3.up);
                }

                BuildOnTile(0);
            }
        }
        else if (buildButtonB && currentTile != null)
        {
            //If build-button is pressed

            if (Shop.PurchaseRedTurret())
            {
                if (currentTile.transform.position.y > 6)
                {
                    buildingRotation.SetLookRotation(new Vector3(0f, 0f, 180f), Vector3.down);
                }
                else
                {
                    buildingRotation.SetLookRotation(new Vector3(0f, 0f, 0f), Vector3.up);
                }

                BuildOnTile(1);
            }
        }
    }
Пример #2
0
 void Awake()
 {
     startColor = PlayerInputScript.instance().GetStartColor();
     LayoutBoard(usableBoardPiece, unusableBoardPiece);
 }
Пример #3
0
 void CheckPlayerInput()
 {
     buildButtonA = PlayerInputScript.instance().IsAPressed();
     buildButtonB = PlayerInputScript.instance().IsBPressed();
 }