Example #1
0
 void OnCollisionEnter(Collision other)
 {
     if (other.gameObject.tag == "sub")
     {
         Destroy(gameObject);
         damage.createDamage();
     }
 }
 private void OnCollisionEnter(Collision collision)
 {
     if (hitTimer <= 0)
     {
         ContactPoint point = collision.GetContact(0);
         subBody.AddExplosionForce(30, point.point, 100, 0, ForceMode.Impulse);
         damageScript.createDamage();
         hitTimer = 2f;
     }
 }
Example #3
0
    public void enableDamage()
    {
        while (true)
        {
            if (activeCount == 5)
            {
                reset.createDamage();
                break;
            }

            int enabledElement = Random.Range(0, 5);
            if (damages[enabledElement].activeSelf == true)
            {
                continue;
            }
            damages[enabledElement].SetActive(true);
            reset.damageCount();
            activeCount++;
            health.hp--;
            break;
        }
    }