예제 #1
0
 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();
     }
 }
예제 #2
0
 public void AddListener(IInvulnerable _iInvulnerable)
 {
     if (_iInvulnerable != null)
     {
         iInvulnerableInterfaces.Add(_iInvulnerable);
     }
 }
예제 #3
0
 private void TryDoFreeze(IDamageable <float> healthManager, IFreezeable ifreeze, IInvulnerable iInvulnerable)
 {
     if (!iInvulnerable.InvFreeze)
     {
         healthManager.AddDamage(damage); ifreeze.FreezeMe();
     }
     else
     {
         rejected = true;
     }
 }
예제 #4
0
파일: Bomb.cs 프로젝트: SeanCasm/MetroidDX
 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);
         }
     }
 }
예제 #5
0
 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();
         }
     }
 }
예제 #6
0
 public void Setup(IInvulnerable inv)
 {
     invulnerable = inv;
 }