protected override void OnCollisionEnter2D(Collision2D collision) { IFreezable freezable = collision.gameObject.GetComponent <IFreezable>(); IDamageable damageable = collision.gameObject.GetComponent <IDamageable>(); if (freezable != null) { damageable.TakeDamage(player.bow.dmg); freezable.Freze(duration); } Destroy(gameObject); }
private void OnParticleCollision(GameObject other) { IFreezable fre = other.GetComponent <IFreezable>(); rand = Random.Range(1, 100); if (fre != null) { fre.SlownDown(5); if (rand == 50) { fre.Freze(3); } } }
protected override void OnCollisionEnter2D(Collision2D collision) { IFreezable freezable = collision.gameObject.GetComponent <IFreezable>(); IDamageable damageable = collision.gameObject.GetComponent <IDamageable>(); if (freezable != null) { damageable.TakeDamage(player.bow.dmg); int rand = Random.Range(1, 100); if (rand < slowChance) { freezable.SlownDown(slowDuration); } if (rand < frezeChance) { freezable.Freze(frezeDuration); } } Destroy(gameObject); }