public override void OnDie() { //Debug.Log("enemy " + GetHashCode() + " destroyed"); DestroySelf?.Invoke(); GameManager.instanse.EnemyKilled?.Invoke(this); RemoveSelfFromTile(); returnToPool(); }
//播放特效 private void PlaySirenEffect(GameObject gameObj, Transform parentTrans) { gameObj.transform.localScale = parentTrans.lossyScale; GameObject newObj = (GameObject)Instantiate(gameObj, parentTrans.transform.position, gameObj.transform.rotation); DestroySelf ds = newObj.AddComponent <DestroySelf>(); ds.Time = 5f; m_LegacyEffectList.Add(newObj); }
public static void DarkChainDestroy(Item chain, RagdollPart ragdollPart, RagdollHandle ragdollHandle, Telekinesis telekinesis, bool neck) { telekinesis.TryRelease(); DestroySelf.Destroy(chain.gameObject); if (ragdollPart.ragdoll.parts.Count > 0) { foreach (RagdollPart part in ragdollPart.ragdoll.parts) { part.rb.isKinematic = false; } } if (ragdollHandle.ragdollPart.ragdoll.parts.Count > 0) { foreach (RagdollPart part in ragdollHandle.ragdollPart.ragdoll.parts) { part.rb.isKinematic = false; } } ragdollPart.ragdoll.SetState(BS.Ragdoll.State.Fallen); if (ragdollPart.ragdoll.creature.health.currentHealth <= 0) { ragdollPart.ragdoll.SetState(BS.Ragdoll.State.Dead); } if (ragdollHandle.name == "NPC(neck)(chained)") { ragdollHandle.name = "NPC(neck)"; } else if (ragdollHandle.name == "NPC(chained)") { ragdollHandle.name = "NPC"; } else { Debug.Log("The ragdollHandle was neither the neck nor a default part"); } //ragdollPart.ragdoll.RefreshFall(); ragdollPart.ragdoll.allowStandUp = true; ragdollHandle.tag = "Untagged"; }
public Dictionary <int, DestroySelf> getExplosions(int x, int y) { Dictionary <int, DestroySelf> dict = new Dictionary <int, DestroySelf>(); foreach (KeyValuePair <ulong, DestroySelf> entry in explosions) { DestroySelf explosion = entry.Value; Vector2 pos = explosion.GetGridPosition(); if ((int)pos.x == x && (int)pos.y == y) { if (!dict.ContainsKey(explosion.bombermanOwnerNumber)) { dict.Add(explosion.bombermanOwnerNumber, explosion); } } } return(dict); }
public static void DarkChainDestroy(Item chain, RagdollPart ragdollPart, RagdollHandle ragdollHandle, bool neck) { DestroySelf.Destroy(chain.gameObject); if (ragdollPart.ragdoll.parts.Count > 0) { foreach (RagdollPart part in ragdollPart.ragdoll.parts) { part.rb.isKinematic = false; } } if (ragdollHandle.ragdollPart.ragdoll.parts.Count > 0) { foreach (RagdollPart part in ragdollHandle.ragdollPart.ragdoll.parts) { part.rb.isKinematic = false; } } if (ragdollHandle.name == "NPC(neck)(chained)") { ragdollHandle.name = "NPC(neck)"; } else if (ragdollHandle.name == "NPC(chained)") { ragdollHandle.name = "NPC"; } else { Debug.Log("The ragdollHandle was neither the neck nor a default part"); } //ragdollPart.ragdoll.RefreshFall(); ragdollPart.ragdoll.allowStandUp = true; ragdollHandle.tag = "Untagged"; }
public void addExplosion(DestroySelf explosion) { explosion.id = explosionCount; explosions.Add(explosionCount, explosion); explosionCount++; }
public static void DestroyAfterTime(GameObject obj, float time) { DestroySelf ins = obj.AddComponent <DestroySelf>(); ins.DestroyTime = time; }
public override void CleanUp() { DestroySelf?.Invoke(); }
private static void optimized_Destory(GameObject go, float time) { DestroySelf des = go.AddComponent <DestroySelf>(); des.delay = time; }
public void ResetAll() { reseting = true; if (darkChains.Count > 0) { foreach (Item chain in darkChains) { if (chain != null) { chain.GetComponent <ItemDarkChain>().isEnding = true; if (chain.GetComponent <ItemDarkChain>().myRagdollPart != null) { chain.GetComponent <ItemDarkChain>().myRagdollPart.rb.isKinematic = false; } } } } if (chainedParts.Count > 0) { foreach (RagdollHandle ragdollHandle in chainedParts) { if (ragdollHandle != null) { if (ragdollHandle.ragdollPart != null) { if (ragdollHandle.ragdollPart.ragdoll != null) { if (ragdollHandle.ragdollPart.ragdoll.parts.Count > 0) { foreach (RagdollPart part in ragdollHandle.ragdollPart.ragdoll.parts) { part.rb.isKinematic = false; } ragdollHandle.ragdollPart.ragdoll.allowStandUp = true; ragdollHandle.ragdollPart.ragdoll.RefreshFall(); if (ragdollHandle.name == "NPC(neck)(chained)") { ragdollHandle.name = "NPC(neck)"; } else if (ragdollHandle.name == "NPC(chained)") { ragdollHandle.name = "NPC"; } else { Debug.Log("The ragdollHandle was neither the neck nor a default part"); } ragdollHandle.tag = "Untagged"; } } } } } chainedParts.Clear(); } if (darkChains.Count > 0) { foreach (Item chain in darkChains) { if (chain != null) { Player.local.handLeft.bodyHand.telekinesis.TryRelease(); Player.local.handRight.bodyHand.telekinesis.TryRelease(); chain.GetComponent <ItemDarkChain>().isEnding = true; DestroySelf.Destroy(chain.gameObject); } } darkChains.Clear(); } }