Ejemplo n.º 1
0
        //On top of tile, envision a box with height verticalReach
        //Damage whoever is within that box
        public static void DamageAbove(DamageTypes damageTypes, int baseDamage, GameTile tile, float verticalReach, IsImmune immunityCheck)
        {
            Vector3 tileHalfExtents = tile.transform.localScale / 2;

            Vector3 center      = tile.transform.position + new Vector3(0, tileHalfExtents.y + verticalReach / 2, 0);
            Vector3 halfExtents = tileHalfExtents;

            halfExtents.y = verticalReach / 2;
            DamageBox(damageTypes, baseDamage, center, halfExtents, immunityCheck);
        }
Ejemplo n.º 2
0
 //Damage whoever is touching tile (includes the sides of tile)
 public static void DamageTouching(DamageTypes damageTypes, int baseDamage, GameTile tile, IsImmune immunityCheck)
 {
     DamageBox(damageTypes, baseDamage, tile.transform.position, tile.transform.localScale / 2, immunityCheck);
 }
Ejemplo n.º 3
0
 public static void DamageTargets(ICollection <Collider> targets, DamageTypes damageTypes, int baseDamage, IsImmune immunityCheck)
 {
     foreach (Collider hit in targets)
     {
         IDamageable target = hit.transform.gameObject.GetComponent <IDamageable>();
         if (target != null && !immunityCheck(target))
         {
             target.DamageHp(damageTypes, baseDamage);
         }
     }
 }
Ejemplo n.º 4
0
 //Damage within a box
 private static void DamageBox(DamageTypes damageTypes, int baseDamage, Vector3 center, Vector3 halfExtents, IsImmune immunityCheck)
 {
     Collider[] hits = Physics.OverlapBox(center, halfExtents + skinWidth);
     DamageTargets(hits, damageTypes, baseDamage, immunityCheck);
 }
Ejemplo n.º 5
0
 public static void DamageTargets(ICollection <IDamageable> targets, DamageTypes damageTypes, int baseDamage, IsImmune immunityCheck)
 {
     foreach (IDamageable target in targets)
     {
         if (target != null && !immunityCheck(target))
         {
             target.DamageHp(damageTypes, baseDamage);
         }
     }
 }