|
|
@@ -13,6 +13,8 @@ public class SoulBoom : MonoBehaviour
|
|
|
public float destroyTime; //消失时间
|
|
|
public List<MoveCharacter> characters = new List<MoveCharacter>(); //被炸到的对象
|
|
|
|
|
|
+ public bool canHitTower; //也对塔造成伤害
|
|
|
+
|
|
|
private void Update()
|
|
|
{
|
|
|
time += Time.deltaTime;
|
|
|
@@ -64,21 +66,30 @@ public class SoulBoom : MonoBehaviour
|
|
|
private void OnTriggerEnter(Collider other)
|
|
|
{
|
|
|
BeHitTrigger beHitTrigger = other.GetComponent<BeHitTrigger>();
|
|
|
- if (beHitTrigger != null
|
|
|
- && (other.transform.parent.parent.parent.gameObject.layer == 6
|
|
|
- || other.transform.parent.parent.parent.gameObject.layer == 7))
|
|
|
+ if (beHitTrigger != null)
|
|
|
{
|
|
|
- MoveCharacter character = other.GetComponentInParent<MoveCharacter>();
|
|
|
- if (character.rb == null)
|
|
|
+ if(other.transform.parent.parent.parent.gameObject.layer == 6
|
|
|
+ || other.transform.parent.parent.parent.gameObject.layer == 7)
|
|
|
{
|
|
|
- character = character.transform.parent.GetComponent<MoveCharacter>();
|
|
|
+ MoveCharacter character = other.GetComponentInParent<MoveCharacter>();
|
|
|
+ if (character.rb == null)
|
|
|
+ {
|
|
|
+ character = character.transform.parent.GetComponent<MoveCharacter>();
|
|
|
|
|
|
+ }
|
|
|
+ if (!characters.Exists(t => t == character))
|
|
|
+ {
|
|
|
+ characters.Add(character);
|
|
|
+ }
|
|
|
}
|
|
|
- if (!characters.Exists(t => t == character))
|
|
|
+ Tower tower = other.GetComponentInParent<Tower>();
|
|
|
+ if (canHitTower && tower != null)
|
|
|
{
|
|
|
- characters.Add(character);
|
|
|
+ tower.BeHit(attackInfo.damage, attackInfo.force* Vector3.zero,attackInfo.changeHurt,attackInfo.repelValue);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
|
|
|
private void OnTriggerExit(Collider other)
|