예제 #1
0
        public override void Process(PowerLevelChanged packet)
        {
            Optional <GameObject> opGameObject = GuidHelper.GetObjectFrom(packet.Guid);

            if (opGameObject.IsPresent())
            {
                GameObject gameObject = opGameObject.Get();

                if (packet.PowerType == PowerType.ENERGY_INTERFACE)
                {
                    EnergyInterface energyInterface = gameObject.GetComponent <EnergyInterface>();

                    if (energyInterface != null)
                    {
                        energyInterface.ModifyCharge(packet.Amount);
                    }
                    else
                    {
                        Console.WriteLine("Energy interface was not found on that game object!");
                    }
                }
                else
                {
                    Console.WriteLine("Unsupported packet power type: " + packet.PowerType);
                }
            }
            else
            {
                Console.WriteLine("Could not locate game object with guid: " + packet.Guid);
            }
        }
예제 #2
0
        public override void Process(PowerLevelChanged packet)
        {
            GameObject gameObject = GuidHelper.RequireObjectFrom(packet.Guid);

            if (packet.PowerType == PowerType.ENERGY_INTERFACE)
            {
                EnergyInterface energyInterface = gameObject.RequireComponent <EnergyInterface>();
                energyInterface.ModifyCharge(packet.Amount);
            }
            else
            {
                Log.Error("Unsupported packet power type: " + packet.PowerType);
            }
        }
        public static void Postfix(EnergyInterface __instance, float __result, ref float amount)
        {
            float num = -__instance.ModifyCharge(-Math.Abs(amount * HCPSettings.Instance.PrawnSeamothPowerDrainMultiplier));

            __result = num;
        }