示例#1
0
        private static void IntegrateOverpressure(ConduitFlow.GridNode sender, float standardMax, ConduitType conduitType, int cell)
        {
            Pressurized pressure    = GetPressurizedAt(cell, conduitType);
            float       receiverMax = Pressurized.IsDefault(pressure) ? standardMax : pressure.Info.Capacity;

            float senderMass = sender.contents.mass;

            if (senderMass >= receiverMax * 2f)
            {
                GameObject receiver = pressure != null ? pressure.gameObject : Grid.Objects[cell, layers[(int)conduitType]];
                BuildingHP.DamageSourceInfo damage = GetPressureDamage();
                queueDamages.Add(new QueueDamage(damage, receiver));
            }
        }
示例#2
0
        //Based on the passed variables, determine if overpressure damage should be dealt to the receiving conduit
        private static void IntegrateOverpressure(ConduitFlow.GridNode sender, float standardMax, ConduitType conduitType, int cell)
        {
            GameObject receiver;
            float      receiverMax = Integration.GetMaxCapacityWithObject(cell, conduitType, out receiver);
            float      senderMass  = sender.contents.mass;

            //33% chance to damage the receiver when sender has double its capacity if the receiver is not a bridge
            //if receiver is a bridge, 33% to damage the bridge if the sender's contents are above the bridge's capacity at all
            if (senderMass >= receiverMax * 2f && Random.Range(0f, 1f) < 0.33f)
            {
                //This damage CANNOT be dealt immediately, or it will cause the game to crash. This code execution occurs during an UpdateNetworkTask execution and does not seem to support executing Triggers
                //The damage will instead be queued and dealt during the next Game.Update (the next tick of the game)
                queueDamages.Add(new QueueDamage(receiver));
            }
        }