Example #1
0
    private void OnCollisionEnter(Collision collision)
    {
        if (collision.gameObject.CompareTag("Ground"))
        {
            touchFloor();
        }
        else if (collision.gameObject.CompareTag("Sticky"))
        {
            touchFloor();
            transform.parent = collision.gameObject.transform;
        }
        else if (collision.gameObject.CompareTag("Checkpoint"))
        {
            touchFloor();

            //get platform pos
            playerSpawnPos = collision.gameObject.transform.position;
            //raise spawn pos
            playerSpawnPos = new Vector3(playerSpawnPos.x, playerSpawnPos.y + 2.0f, playerSpawnPos.z);
        }
        else if (collision.gameObject.CompareTag("Goal"))
        {
            //call to gamemanager to giv victor placement
            playerSpawnPos     = platformManagerScript.PedestalData();
            transform.position = playerSpawnPos;
            //face toward losers
            if (platformManagerScript.CheckWinners() < 4)
            {
                transform.Rotate(new Vector3(0, 180, 0));
            }
            //face toward victors
        }
    }