new void OnTriggerEnter2D(Collider2D other) { if (other.CompareTag("Enemy")) { IDamageable <float> health = other.GetComponent <IDamageable <float> >(); IFreezeable ifreeze = other.GetComponent <IFreezeable>(); IInvulnerable iInvulnerable = other.GetComponent <IInvulnerable>(); if (ifreeze != null && health != null) { TryDoFreeze(health, ifreeze, iInvulnerable); if (!rejected) { Instantiate(impactPrefab, transform.position, Quaternion.identity, null); base.BackToGun(); } else { Reject(); } } } else if ((other.IsTouching(floorCol) && other.tag == "Suelo")) { FloorCollision(); } }
new private void OnTriggerEnter2D(Collider2D other) { if (other.CompareTag("Player")) { IFreezeable ifreezeable = other.GetComponentInParent <IFreezeable>(); ifreezeable.FreezeMe(); } }
public static void UnregisterProjectile(IFreezeable projectile) { if (_projectiles.Contains(projectile) == false) { return; } _projectiles.Remove(projectile); }
public static void RegisterProjectile(IFreezeable projectile) { if (_projectiles.Contains(projectile)) { return; } _projectiles.Add(projectile); }
private void TryDoFreeze(IDamageable <float> healthManager, IFreezeable ifreeze, IInvulnerable iInvulnerable) { if (!iInvulnerable.InvFreeze) { healthManager.AddDamage(damage); ifreeze.FreezeMe(); } else { rejected = true; } }