Esempio n. 1
0
    void OnControllerColliderHit(ControllerColliderHit hit)
    {
        if (hit.collider.tag == "coin")
        {
            hit.gameObject.SetActive(false);
            IngameUIChild.numberofCoins++;

            GameObject ScoreIndicator = Instantiate(ScorePrefab, hit.collider.transform.position, Quaternion.identity) as GameObject;
        }
        IngameUIChild.displyCount.text = IngameUIChild.numberofCoins.ToString();


        if (hit.collider.name.Contains("respawn"))
        {
            IngameUIChild.life--;
            if (IngameUIChild.life < 0)
            {
                IngameUIChild.OnGameOver();

                //gameObject.GetComponent<playerControl>().enabled=false;
            }
            else
            {
                //hit.gameObject.GetComponent<PlayerHurt>().Update();
                transform.position = hit.collider.transform.GetChild(0).transform.position;
            }
        }

        IngameUIChild.lifeText.text = IngameUIChild.life.ToString();


        if (hit.collider.name.Contains("final"))
        {
            hit.collider.name = "END";
            IngameUIChild.OnGameOver();

            //transform.position = hit.collider.transform.GetChild (0).transform.position;


            //gameObject.SendMessage("StopPlayerAnimation",SendMessageOptions.DontRequireReceiver);

            //IngameUIChild.OnLevelEnd();

            //if(displayAd != null)	displayAd(null,null);
        }
    }