// Start is called before the first frame update
    void Start()
    {
        //declare
        rb = GetComponent <Rigidbody>();
        playerSpecifics = GetComponent <PlayerSpecifics>();

        //Set cooldown speeds according to hero ID
        movementMultiplier = (movementMultiplier + playerSpecifics.agility) / 100;
        baseDashCoolDown   = baseDashCoolDown - (playerSpecifics.agility / 20);
        pushForce          = pushForce + (playerSpecifics.strength * 7);
        pushBackCooldown   = baseDashCoolDown - ((playerSpecifics.strength / 20 - playerSpecifics.agility / 15));

        //movement
        baseMovementMultiplier = movementMultiplier / 10;
        movementMultiplier     = baseMovementMultiplier;

        dashCooldown     = baseDashCoolDown;
        pushBackCooldown = basePushBackCooldown;

        PlayerSelection();
        playerID = playerSpecifics.localPlayerID;

        if (playerID == 1)
        {
            player1Object = this.gameObject;
        }

        if (playerID == 2)
        {
            player2Object = this.gameObject;
        }

        if (playerID == 3)
        {
            player3Object = this.gameObject;
        }

        if (playerID == 4)
        {
            player4Object = this.gameObject;
        }
    }
    // Start is called before the first frame update
    void Start()
    {
        if (players[0].activeInHierarchy != null)
        {
            playerVisualScript1    = players[0].GetComponent <PlayerSpecifics>();
            playerController1      = players[0].GetComponent <PlayerController>();
            playerNameText[0].text = playerVisualScript1.playerName;
            p1PushBackBase         = playerController1.basePushBackCooldown;
            p1TeleportBase         = playerController1.baseDashCoolDown;
        }

        if (players[1].activeInHierarchy != null)
        {
            playerVisualScript2    = players[1].GetComponent <PlayerSpecifics>();
            playerController2      = players[1].GetComponent <PlayerController>();
            playerNameText[1].text = playerVisualScript2.playerName;
            p2PushBackBase         = playerController2.basePushBackCooldown;
            p2TeleportBase         = playerController2.baseDashCoolDown;
        }

        if (players[2].activeInHierarchy != null)
        {
            playerVisualScript3    = players[2].GetComponent <PlayerSpecifics>();
            playerController3      = players[2].GetComponent <PlayerController>();
            playerNameText[2].text = playerVisualScript3.playerName;
            p3PushBackBase         = playerController3.basePushBackCooldown;
            p3TeleportBase         = playerController3.baseDashCoolDown;
        }

        if (players[3].activeInHierarchy != null)
        {
            playerVisualScript4    = players[3].GetComponent <PlayerSpecifics>();
            playerController4      = players[3].GetComponent <PlayerController>();
            playerNameText[3].text = playerVisualScript4.playerName;
            p4PushBackBase         = playerController4.basePushBackCooldown;
            p4TeleportBase         = playerController4.baseDashCoolDown;
        }
    }
Example #3
0
 public void GameOver()
 {
     playerSpecifics = GameObject.Find("Player").GetComponent <PlayerSpecifics>();
     playerString    = playerSpecifics.playerName;
     playerWin.text  = playerString + " is the winner!";
 }