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(); } }
public void AddListener(IInvulnerable _iInvulnerable) { if (_iInvulnerable != null) { iInvulnerableInterfaces.Add(_iInvulnerable); } }
private void TryDoFreeze(IDamageable <float> healthManager, IFreezeable ifreeze, IInvulnerable iInvulnerable) { if (!iInvulnerable.InvFreeze) { healthManager.AddDamage(damage); ifreeze.FreezeMe(); } else { rejected = true; } }
void OnTriggerStay2D(Collider2D col) { if (col.CompareTag("Enemy")) { IDamageable <float> health = col.GetComponent <IDamageable <float> >(); IInvulnerable iInvulnerable = col.GetComponent <IInvulnerable>(); if (health != null && iInvulnerable != null && beamType == WeaponType.SuperBomb) { TryDoDamage(damage, health, beamType, iInvulnerable); } } }
protected void OnTriggerEnter2D(Collider2D collision) { if (collision.CompareTag("Enemy") && collision.IsTouching(damageCol)) { health = collision.GetComponent <IDamageable <float> >(); iInvulnerable = collision.GetComponent <IInvulnerable>(); if (health == null && iInvulnerable != null) { Reject(); } if (health != null && iInvulnerable != null) { TryDoDamage(damage, health, beamType, iInvulnerable); Instantiate(impactPrefab, transform.position, Quaternion.identity, null); if (!rejected) { NoPlasmaOnTrigger?.Invoke(); } else { Reject(); } } } else if ((collision.IsTouching(floorCol) && collision.tag == "Suelo")) { FloorCollision(); } else if (collision.CompareTag("EnemyBeam")) { IDrop iDrop = collision.GetComponent <IDrop>(); if (iDrop != null) { FloorCollision(); } } }
public void Setup(IInvulnerable inv) { invulnerable = inv; }