Esempio n. 1
0
    void OnCollisionEnter(Collision collision)
    {
        if (gameObject.name == "Head" && origidbody.velocity.y > 0)
        {
            if (collision.gameObject.name == "Brick(Clone)")
            {
                Destroy(collision.gameObject);
                guiSc.addScore(100);
            }
            if (collision.gameObject.name == "Question(Clone)")
            {
                GameObject Question = collision.gameObject;
                guiSc.onAddCoin(Question);
            }

            //origidbody.velocity *= 0.0f;
            origidbody.velocity = new Vector3(0, -1, 0);
        }
        else if (gameObject.name == "Feet" /* || gameObject.name == "EthanRightFoot" || gameObject.name == "EthanLeftFoot"*/)
        {
            if (collision.gameObject.name == "Question(Clone)" || collision.gameObject.name == "Brick(Clone)" || collision.gameObject.name == "Rock(Clone)" || collision.gameObject.name == "Stone(Clone)")
            {
                amSc.airborne = false;
                amSc.jump     = false;
                Debug.Log("NotAirborne");
            }
            if (collision.gameObject.name == "GoalPole" && !gameOver)
            {
                gameOver = true;
                guiSc.setWin();
            }
        }
        Debug.Log(gameObject.name + " " + collision.gameObject.name);
    }