Exemple #1
0
    void OnTriggerEnter2D(Collider2D Other)
    {
        if (Other.GetComponent <Rigidbody2D> () == null)
        {
            return;
        }

        switch (PickupType)
        {
        case "Coin":
            ScoreManager.AddPoints(ValueToAdd);
            break;

        case "Health":
            ScoreManager.AddHealth(ValueToAdd);
            break;

        case "Ammo":
            ScoreManager.AddAmmo(ValueToAdd);
            break;

        case "Life":
            ScoreManager.AddLives(ValueToAdd);
            break;
        }

        Destroy(gameObject);
    }
Exemple #2
0
 void OnTriggerEnter2D(Collider2D other)
 {
     if (other.name == "PC")
     {
         ScoreManager.AddHealth(-EnemyPower);
     }
 }
 public void OnTriggerEnter(Collider other)
 {
     if (other.gameObject.CompareTag("Player"))
     {
         ScoreManager.AddHealth(value);
         Destroy(gameObject);
     }
 }
 public void OnCollisionEnter(Collision collision)
 {
     if ((collision.gameObject.tag == "Player") && (hit == 0))
     {
         ScoreManager.AddHealth(value);
         hit = 1;
     }
 }