Пример #1
0
    // Update is called once per frame
    void Update()
    {
        int index = -1;

        if (Input.GetButtonDown("White"))
        {
            index = 0;
        }
        else if (Input.GetButtonDown("Cyan"))
        {
            index = 1;
        }
        else if (Input.GetButtonDown("Magenta"))
        {
            index = 2;
        }
        else if (Input.GetButtonDown("Yellow"))
        {
            index = 3;
        }

        if (index > -1)
        {
            if (LayerMask.LayerToName(playable.layer) != "Clone")
            {
                bm.SetActiveBody(index);
            }
            else
            {
                bm.SwitchToIndex(index);
            }

            playable = GameObject.FindGameObjectWithTag("Player");
        }
    }
Пример #2
0
 public void RespawnPlayer(GameObject playerToRespawn)
 {
     bodyManager.SwitchToIndex(0);
     StartCoroutine("RespawnPlayerCo", playerToRespawn);
 }