Exemplo n.º 1
0
    void OnTriggerEnter(Collider c)
    {
        if (c.tag.Equals("Player"))
        {
            PlayerStats        ps = c.GetComponent <PlayerStats> ();
            PlayerCollectables pc = c.GetComponent <PlayerCollectables> ();

            if (hasHealthItem)
            {
                ps.updateHealth(10);
            }

            if (hasMaxHealthItem)
            {
                ps.addToMaxHealth(5);
                ps.updateHealth(10);
            }

            if (hasGemItem)
            {
                pc.updateGems(5);
            }

            if (hasCoinItem)
            {
                pc.updateCoins(5);
            }

            gameObject.SetActive(false);
            Destroy(gameObject);
        }
    }
Exemplo n.º 2
0
 void Awake()
 {
     player             = GameObject.FindGameObjectWithTag("Player");
     playerAmmo         = player.GetComponent <PlayerAmmo> ();
     PlayerHealth       = player.GetComponent <PlayerHealth> ();
     playerCollectables = player.GetComponent <PlayerCollectables> ();
 }
Exemplo n.º 3
0
    // Use this for initialization
    void Awake()
    {
        if (instance == null)
        {
            instance  = this;
            switchNum = 6;
        }
        else if (instance != this)
        {
            Destroy(gameObject);
        }

        player             = GameObject.FindGameObjectWithTag("Player");
        playerCollectibles = player.GetComponent <PlayerCollectables> ();
    }
Exemplo n.º 4
0
 // Use this for initialization
 void Start()
 {
     startPosition   = door.transform.position;
     currentPosition = startPosition;
     collectables    = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerCollectables> ();
 }