private static void DestroyResource(TMetadata metadata, TResource resource, DestroyReason reason) { if (resource != null) { resource.Dispose(); } }
/// <summary> /// Destroys the debris. If the cause of death is player attacking, /// then award them resources. /// </summary> /// <param name="reason">Reason for destroying.</param> public override void Destroy( DestroyReason reason = DestroyReason.Normal ) { switch (reason) { case DestroyReason.CombatEvent: // If the last entity has a resource component, // the resource value of this entity should be passed to // the attacker. if (Combat.DamageLog.Count > 0) { Entity attacker = Combat .DamageLog[Combat.DamageLog.Count - 1].Attacker; IComponent attackerResources = attacker.GetComponent( ComponentSystemId.ResourceSystem ); if (attackerResources != null) { ((ResourceComponent)attackerResources).Value += Resources.Value; } } break; } base.Destroy(); }
private void HandleGameObjectDestroy(GameObjectBehaviour sender, DestroyReason destroyReason) { if (Value is MonoBehaviour monoBehaviour && monoBehaviour.gameObject == sender.CachedGameObject) { Value = null; } }
public void DestroyAction(DestroyReason reason) { foreach (var a in destroyActions) { a(reason); } }
void DestroyAction(DestroyReason reason) { if (reason == DestroyReason.Damaged) { Detonate(); } }
private void DestroyTexture(CefBrowser browser, EX9.Texture texture, DestroyReason reason) { lock (FTextures) { FTextures.Remove(texture); texture.Dispose(); } }
private void DestroyTexture(CefBrowser browser, EX9.Texture texture, DestroyReason reason) { lock (FTextureResource) { var sysmemTexture = texture.Tag as EX9.Texture; sysmemTexture.Dispose(); texture.Dispose(); } }
private void HandleDestroyed(GameObjectBehaviour sender, DestroyReason reason) { if (reason != DestroyReason.ApplicationQuit) { return; } Invoke(new ApplicationQuitEvent()); #if UNITY_EDITOR OwningLocator?.Dispose(); #endif }
private void DestroyTexture(FrameInfo frameInfo, EX9.Texture texture, DestroyReason reason) { if (texture != null) { // Put the texture back in the pool FTexturePool.PutTexture(texture); if (reason == DestroyReason.DeviceLost) { // Release this device if it got lost FTexturePool.Release(texture.Device); } } }
public static void DestroyEntity(Entity e, DestroyReason reason) { if (currentInstance.debugVomit) { currentInstance.Log("Destroy entity " + e + "[" + currentInstance.reverseWorldEntities[e] + "] at " + e.position + ":" + e.rotation); } currentInstance.deferredActions.Add(() => { if (!currentInstance.reverseWorldEntities.ContainsKey(e)) { // It's possible for a thing to be destroyed twice in one tick. return; } e.DestroyAction(reason); int id = currentInstance.reverseWorldEntities[e]; if (currentInstance.debugVomit) { currentInstance.Log("{" + currentInstance.tickID + "} Destroy entity " + e + "[" + id + "] at " + e.position + ":" + e.rotation); } currentInstance.worldEntities.Remove(id); currentInstance.reverseWorldEntities.Remove(e); currentInstance.worldEntityCache.Remove(e); currentInstance.worldEntityCollisionCache.Remove(e); if (e.GetComponent <PooledObject>() != null) { ObjectPool.For(e.GetComponent <PooledObject>().prototype).Uninstantiate(e.gameObject); } else { GameObject.Destroy(e.gameObject); } currentInstance.nDestroyedThisTick += 1; }); }
public void BroadcastHealth(ushort ID, short health, DestroyReason reason) { S2C.SetStructureHealth pck = new S2C.SetStructureHealth(ID, health, reason); GetComponent<NetworkView>().RPC("RecvHealth", RPCMode.Others, pck.SerializeToBytes()); }
void DestroyAction(DestroyReason reason) { UIAction(clearQueue); }
/// <summary> /// Destroy this entity. /// </summary> /// <param name="reason">Optional, reason for destroying.</param> public virtual void Destroy( DestroyReason reason = DestroyReason.Normal ) { UnregisterComponents(); }
private void HandlePoolDestroyed(GameObjectBehaviour sender, DestroyReason reason) { RemovePool((GameObjectPool)sender, false); }