Inheritance: MonoBehaviour
Ejemplo n.º 1
0
 void Start()
 {
     if (instance == null)
     {
         instance = this;
     }
 }
Ejemplo n.º 2
0
 private void Awake()
 {
     if (Instance == null)
     {
         Instance = this;
     }
     else
     {
         Destroy(gameObject);
     }
 }
Ejemplo n.º 3
0
 void RefreshBindings()
 {
     coinCount    = GameObject.FindGameObjectWithTag("CoinDisplay").GetComponent <CoinCount>();
     hearts       = GameObject.FindGameObjectWithTag("HeartDisplay").GetComponent <HeartsGUI>();
     rb           = GetComponent <Rigidbody2D>();
     oldYPos      = transform.position.y;
     musicManager = GameObject.FindGameObjectWithTag("MusicManager");
     mixer        = musicManager.GetComponent <MusicMixer>();
     if (isLocalPlayer)
     {
         Camera.main.GetComponent <CameraAI> ().SetTarget(gameObject);
         GameObject.Find("UserInput").GetComponent <UserInput> ().SetPlayer(gameObject);
     }
 }
Ejemplo n.º 4
0
    void OnTriggerEnter(Collider col)
    {
        if (col.gameObject.tag == "Coin")
        {
            CoinCount.Increment();
            SCORE.Increment();
            Destroy(col.gameObject);
        }

        if (col.gameObject.tag == "GOAL")
        {
            Debug.Log("CLEARED");
            Destroy(col.gameObject);
        }
    }
Ejemplo n.º 5
0
 // Use this for initialization
 void Start()
 {
     count = GameObject.FindGameObjectWithTag("cointextuionplayer").GetComponent <CoinCount>();
     cd    = GameObject.FindGameObjectWithTag("Cha1").GetComponent <CharacterData>();
     bl    = GameObject.Find("backlight").GetComponent <BackLight>();
 }