Exemple #1
0
    void Start()
    {
        gameManager = GameObject.FindGameObjectWithTag("GameManager").GetComponent <BaseGM>();
        gameManager.players[playerId] = this;

        joinText      = GameObject.Find("JoinText" + playerId);
        inputText     = GameObject.Find("InputText" + playerId);
        laserRB       = pairedLaser.GetComponent <Rigidbody2D>();
        rewiredPlayer = ReInput.players.GetPlayer(playerId);

        inFlight    = false;
        sensitivity = 5;

        midPoint     = transform.Find("MidPoint").transform;
        cornerOrigin = new Vector2(midPoint.transform.position.x, midPoint.transform.position.y);
        Layer_Mask   = LayerMask.GetMask("Boundary");


        colorIdx = playerId;
        gameManager.UpdateColour(colorIdx, playerId);
        inputText.GetComponent <Text>().color = myColor;

        joinText.GetComponent <Text>().text = "";


        if (gameManager.gameMode == "FFA")
        {
            team = playerId + 1;
        }
        else
        {
            team = 0;
        }



        //Setup for rotation.
        if (maxAngleOffset < 0)
        {
            maxAngleOffset *= -1;
        }
        currentRotationSpeed = baseRotationSpeed;
        SetNewBaseAngle();
    }
Exemple #2
0
    //customization inputs
    void PregameInputs()
    {
        //*********************************HERE******************************


        if (rewiredPlayer.GetButtonDown("Back"))        //Player presses B.
        {
            if (playerReady)
            {
                playerReady = false;
                gameManager.readyPlayers--;
            }
            else
            {
                spawnPoint.GetComponent <SpawnListener>().taken = false;
                gameManager._colorlist[colorIdx].isAvailable    = true;
                joinText.GetComponent <Text>().text             = "Press 'A' to Join";
                gameManager.playerCount--;
                Destroy(this.gameObject);
            }
        }


        //*********************************HERE******************************

        if (rewiredPlayer.GetButtonDown("RButt"))       //Player presses RB.
        {
            colorIdx = gameManager.IncrementIndex(colorIdx);
            gameManager.UpdateColour(colorIdx, playerId);
        }

        if (rewiredPlayer.GetButtonDown("LButt"))       //Player presses LB.
        {
            colorIdx = gameManager.DecrementIndex(colorIdx);
            gameManager.UpdateColour(colorIdx, playerId);
        }

        if (rewiredPlayer.GetButtonDown("StartGame"))   //Player presses Start.
        {
            if (!playerReady)
            {
                playerReady = true;
                gameManager.readyPlayers++;
                joinText.GetComponent <Text>().text = "Ready";
            }
            else
            {
                playerReady = false;
                gameManager.readyPlayers--;
                joinText.GetComponent <Text>().text = " ";
            }
        }

        if (rewiredPlayer.GetButtonDown("IncreaseRotationSpeed"))      //Player presses UpD.
        {
            //Sensitivity is on a scale of 1-8. Corresponds to minRotSpeed of 2.0f, and maxRotSpeed of 10.0f.
            if (sensitivity >= 8)
            {
                inputText.GetComponent <Text>().text = "Sensitivity: MAX";
            }
            else
            {
                ChangeRotationSpeed(rotationSpeedIncrement);
                sensitivity++;
            }

            inputText.GetComponent <Text>().text = "Sensitivity: " + sensitivity;

            inputText.GetComponent <InputTextScript>().checkText();
        }

        if (rewiredPlayer.GetButtonDown("DecreaseRotationSpeed"))         //Player presses DownD.
        {
            if (sensitivity >= 1)
            {
                sensitivity--;
                ChangeRotationSpeed(-rotationSpeedIncrement);
            }
            else
            {
                inputText.GetComponent <Text>().text = "Sensitivity: MIN";
            }

            inputText.GetComponent <Text>().text = "Sensitivity: " + sensitivity;

            inputText.GetComponent <InputTextScript>().checkText();
        }
    }