public void OnSyncedTriggerEnter(TSCollision other) { int otherLayerMask = (int)Math.Pow(2, other.gameObject.layer); Debug.LogErrorFormat("houyiBullet====>Trigger Enter==>{0},{1},{2}", otherLayerMask, other.gameObject.name, LayerMask.GetMask("Role")); if (otherLayerMask == LayerMask.GetMask("Role")) { Actor mActor = other.gameObject.GetComponent <Actor>(); Debug.LogErrorFormat("houyiBullet====>TriggerEnter==>自己阵营:{0},对方阵营={1}", OwnerCamp, mActor.OwnerCamp); if (OwnerCamp != mActor.OwnerCamp) { mActor.mActorAttr.Hp -= 10; TrueSyncManager.SyncedDestroy(gameObject); } } else if (otherLayerMask == LayerMask.GetMask("Monsters")) { YeGuaiAI mYeGuaiAI = other.gameObject.GetComponent <YeGuaiAI>(); mYeGuaiAI.AddHp(-10, OwnerID); } else if (otherLayerMask == LayerMask.GetMask("GroundWall")) { TrueSyncManager.SyncedDestroy(gameObject); } }
public void OnSyncedTriggerStay(TSCollision other) { if (SelfTick % 10 != 0) { return; } int otherLayerMask = (int)Math.Pow(2, other.gameObject.layer); //Debug.LogErrorFormat("houyiDarkArea====>Trigger Stay==>{0},{1}", otherLayerMask, other.gameObject.name); if (otherLayerMask == LayerMask.GetMask("Role")) { Actor mActor = other.gameObject.GetComponent <Actor>(); //Debug.LogErrorFormat("houyiDarkArea====>TriggerEnter==>自己阵营:{0},对方阵营={1}", OwnerCamp, mActor.OwnerCamp); if (OwnerCamp != mActor.OwnerCamp) { mActor.mActorAttr.Hp -= 5; } } else if (otherLayerMask == LayerMask.GetMask("Monsters")) { YeGuaiAI mYeGuaiAI = other.gameObject.GetComponent <YeGuaiAI>(); mYeGuaiAI.AddHp(-5, OwnerID); } }