Exemplo n.º 1
0
 private static void DestroyResource(TMetadata metadata, TResource resource, DestroyReason reason)
 {
     if (resource != null)
     {
         resource.Dispose();
     }
 }
Exemplo n.º 2
0
        /// <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();
        }
Exemplo n.º 3
0
 private void HandleGameObjectDestroy(GameObjectBehaviour sender, DestroyReason destroyReason)
 {
     if (Value is MonoBehaviour monoBehaviour && monoBehaviour.gameObject == sender.CachedGameObject)
     {
         Value = null;
     }
 }
Exemplo n.º 4
0
 public void DestroyAction(DestroyReason reason)
 {
     foreach (var a in destroyActions)
     {
         a(reason);
     }
 }
Exemplo n.º 5
0
 void DestroyAction(DestroyReason reason)
 {
     if (reason == DestroyReason.Damaged)
     {
         Detonate();
     }
 }
Exemplo n.º 6
0
 private void DestroyTexture(CefBrowser browser, EX9.Texture texture, DestroyReason reason)
 {
     lock (FTextures)
     {
         FTextures.Remove(texture);
         texture.Dispose();
     }
 }
Exemplo n.º 7
0
 private void DestroyTexture(CefBrowser browser, EX9.Texture texture, DestroyReason reason)
 {
     lock (FTextureResource)
     {
         var sysmemTexture = texture.Tag as EX9.Texture;
         sysmemTexture.Dispose();
         texture.Dispose();
     }
 }
Exemplo n.º 8
0
        private void HandleDestroyed(GameObjectBehaviour sender, DestroyReason reason)
        {
            if (reason != DestroyReason.ApplicationQuit)
            {
                return;
            }

            Invoke(new ApplicationQuitEvent());
#if UNITY_EDITOR
            OwningLocator?.Dispose();
#endif
        }
Exemplo n.º 9
0
 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);
         }
     }
 }
Exemplo n.º 10
0
    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;
        });
    }
Exemplo n.º 11
0
 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());
 }
Exemplo n.º 12
0
 void DestroyAction(DestroyReason reason) {
         UIAction(clearQueue);
 }
Exemplo n.º 13
0
 /// <summary>
 /// Destroy this entity.
 /// </summary>
 /// <param name="reason">Optional, reason for destroying.</param>
 public virtual void Destroy(
     DestroyReason reason = DestroyReason.Normal
     )
 {
     UnregisterComponents();
 }
Exemplo n.º 14
0
 private void HandlePoolDestroyed(GameObjectBehaviour sender, DestroyReason reason)
 {
     RemovePool((GameObjectPool)sender, false);
 }