Пример #1
0
 private void DefaultBurnUp(DestructionInfo info)
 {
     //just a guess - objects which can be picked up should have a smaller amount of ash
     EffectsFactory.Instance.Ash(registerTile.WorldPosition.To2Int(), isLarge);
     ChatRelay.Instance.AddToChatLogServer(ChatEvent.Local($"{name} burnt to ash.", gameObject.TileWorldPosition()));
     Logger.LogTraceFormat("{0} burning up, onfire is {1} (burningObject enabled {2})", Category.Health, name, this.onFire, burningObjectOverlayOverlay?.enabled);
     PoolManager.PoolNetworkDestroy(gameObject);
 }
Пример #2
0
 private void DefaultDestroy(DestructionInfo info)
 {
     if (info.DamageType == DamageType.Brute)
     {
         ChatRelay.Instance.AddToChatLogServer(ChatEvent.Local($"{name} was smashed to pieces.", gameObject.TileWorldPosition()));
         PoolManager.PoolNetworkDestroy(gameObject);
     }
     //TODO: Other damage types (acid)
     else
     {
         ChatRelay.Instance.AddToChatLogServer(ChatEvent.Local($"{name} was destroyed.", gameObject.TileWorldPosition()));
         PoolManager.PoolNetworkDestroy(gameObject);
     }
 }
Пример #3
0
        private void OnWillDestroyServer(DestructionInfo info)
        {
            var tileWorldPosition = gameObject.TileWorldPosition().To3Int();
            //release all of our gases at once when destroyed
            MetaDataLayer metaDataLayer  = MatrixManager.AtPoint(tileWorldPosition, true).MetaDataLayer;
            Vector3Int    position       = transform.localPosition.RoundToInt();
            MetaDataNode  node           = metaDataLayer.Get(position, false);
            var           shakeIntensity = (byte)Mathf.Lerp(byte.MinValue, byte.MaxValue / 2, GasMix.Pressure / MAX_EXPLOSION_EFFECT_PRESSURE);
            var           shakeDistance  = Mathf.Lerp(1, 64, GasMix.Pressure / MAX_EXPLOSION_EFFECT_PRESSURE);

            node.GasMix += GasMix;
            metaDataLayer.UpdateSystemsAt(position);
            ChatRelay.Instance.AddToChatLogServer(ChatEvent.Local($"{name} exploded!", gameObject.TileWorldPosition()));

            ItemFactory.SpawnMetal(2, tileWorldPosition.To2Int(), parent: transform.parent);

            ExplosionUtils.PlaySoundAndShake(tileWorldPosition, shakeIntensity, (int)shakeDistance);
        }