Ejemplo n.º 1
0
    public void ApplyPlayerPosition(int playerID, int tier)
    {
        Debug.Log("Applying " + playerID + " To pos " + tier);
        GameObject            player         = FindObjectOfType <GameController>().MakePlayer(Vector3.up * 10, playerID);
        PlayerModelController playerAnimator = player.GetComponentInChildren <PlayerModelController>();

        player.GetComponentInChildren <PlayerMovement> ().SetRotationSpeed(0);         // disables input
        Vector3 campos = Camera.main.transform.position;

        player.transform.rotation.SetLookRotation(campos - player.transform.position);
        if (tier == 0)
        {
            // move the player
            player.transform.position = locationOne.transform.position;
            // apply the animation
            playerAnimator.First();
        }
        else if (tier == 1)
        {
            // move the player
            player.transform.position = locationTwo.transform.position;
            // apply the animation
            playerAnimator.Second();
        }
        else if (tier == 2)
        {
            // move the player
            player.transform.position = locationThree.transform.position;
            // destroy the chair and lance
            playerAnimator.Third();
        }

        Destroy(player.GetComponentInChildren <PlayerHitDetection> ().gameObject);         // destroy lance

        // Should destroy chair
        foreach (Transform child in player.transform.GetChild(0).transform)
        {
            if (child.tag == "Chair")
            {
                Destroy(child.gameObject);
            }
        }
    }