void OnTriggerEnter(Collider other) { // Mini怪物发射的 if (Owner == GameTag.Enemy) { return; } if (Owner == GameTag.Boss) { return; } // 武器打到道具 if (other.tag.Equals(GameTag.Props) && type != WeaponType.Stone) { PropBehaviour pb = other.transform.parent.GetComponent <PropBehaviour>(); if (pb == null) { pb = other.transform.parent.parent.GetComponent <PropBehaviour>(); } if ( //pb.Type == PropType.Bat || //pb.Type == PropType.FeiQi || pb.Type == PropType.Mine) { Trigger(); if (Owner == GameTag.Player) { pb.Trigger(true); } WeaponManager.Instance.AddDespawnWeapon(this); pb.PlayDestroyEffect(); PropsManager.Instance.AddDespawnNormal(pb); return; } } // 打到武器道具 if (other.tag.Equals(GameTag.Weapon)) { WeaponBehaviour wb = other.gameObject.GetComponent <WeaponBehaviour>(); if (wb.Assaultable) { Trigger(); WeaponManager.Instance.AddDespawnWeapon(this); WeaponManager.Instance.AddDespawnWeapon(wb); } } if (other.tag.Equals(GameTag.Bug)) { Trigger(); BugAttack ba = other.GetComponent <BugAttack>(); ba.OnHurt(damageValue); } }
void Start() { OrgLife = Life; PathTran.GetComponentsInChildren <BugPoint>(PatrolList); BugAttack = transform.Find("Root").GetComponent <BugAttack>(); pathinfo = PathManager.Instance.PathInfo1; EventDispatcher.AddEventListener(EventDefine.Event_PathInfo_Has_Init, OnPathInfo); Init(); }