void OnTriggerEnter2D(Collider2D other) { Tds_Tile vTile = other.GetComponent <Tds_Tile> (); if (vTile != null) { if (vTile.vTileType == Tds_Tile.cTileType.Destructible) { vTile.TileDie(); } if (vTile.vTileType == Tds_Tile.cTileType.Wall && vRebounce <= 0) { ProjDie(); } else if (vTile.vTileType == Tds_Tile.cTileType.Wall) { CalculateRebounce(other); } } else if (other.tag == "Character") { Tds_Character vChar = other.GetComponent <Tds_Character> (); //make sure the projectile is for the other faction and the target is alive. if (vChar.vFactionType != vProjFactionType && vChar.IsAlive) { vChar.ApplyDamage(vDmg); ProjDie(); } } }
IEnumerator OnTriggerEnter2D(Collider2D other) { Tds_Tile vTile = other.GetComponent <Tds_Tile>(); if (vTile != null || other.tag == "Ball") { if (vTile != null && vTile.vTileType == Tds_Tile.cTileType.Destructible) { vTile.TileDie(); } if (((vTile != null && vTile.vTileType == Tds_Tile.cTileType.Wall) || other.tag == "Ball") && vRebounce <= 0) { this.vCollider.isTrigger = false; yield return(new WaitForSeconds(0.02f)); ProjDie(); } else if ((vTile != null && vTile.vTileType == Tds_Tile.cTileType.Wall) || other.tag == "Ball") { this.vCollider.isTrigger = false; yield return(new WaitForSeconds(0.02f)); CalculateRebounce(other); } } else if (other.tag == "Character") { Tds_Character vChar = other.GetComponent <Tds_Character>(); //make sure the projectile is for the other faction and the target is alive. if (vChar.vFactionType != vProjFactionType && vChar.IsAlive) { vChar.ApplyDamage(vDmg); ProjDie(); } } }