public ChargeGunDefinition()
        {
            /* Set path */
            common.prefabsPathController.SetPath("Prototype_ChargeGun.prefab", "ChargeGun.prefab");

            /* ---------------------------------------------------------------- */
            // Define : Item
            /* ---------------------------------------------------------------- */
            {
                var itemInfo = common.itemInfo;

                itemInfo.isItem   = true;
                itemInfo.itemName = "チャージガン";

                itemInfo.isMovableItem = true;

                itemInfo.isGrabbableItem = true;
            }

            /* ---------------------------------------------------------------- */
            // Define : Trigger
            /* ---------------------------------------------------------------- */
            {
                var triggerInfo = common.triggerInfo;

                /* OnCreateItemTrigger */

                /* OnGrabItemTrigger */
                triggerInfo.AddOnGrabItemTrigger(LPG.CreateSignal(TriggerTarget.Item, null, "OnGrab"));

                /* OnReleaseItemTrigger */
                triggerInfo.AddOnReleaseItemTrigger(LPG.CreateBool(TriggerTarget.Item, null, "using", false));

                /* UseItemTrigger */
                triggerInfo.AddUseItemTrigger_Down(LPG.CreateSignal(TriggerTarget.Item, null, "StartCharging"));
                triggerInfo.AddUseItemTrigger_Down(LPG.CreateBool(TriggerTarget.Item, null, "using", true));
                triggerInfo.AddUseItemTrigger_Down(LPG.CreateBool(TriggerTarget.Item, null, "fullyCharged", false));
                triggerInfo.AddUseItemTrigger_Down(LPG.CreateBool(TriggerTarget.Item, null, "charging", true));

                triggerInfo.AddUseItemTrigger_Up(LPG.CreateSignal(TriggerTarget.Item, null, "Shoot"));
                triggerInfo.AddUseItemTrigger_Up(LPG.CreateBool(TriggerTarget.Item, null, "using", false));
            }

            /* ---------------------------------------------------------------- */
            // Define : Logic
            /* ---------------------------------------------------------------- */
            var logicInfo = common.logicInfo;

            /* ItemLogic */
            {
                // StartCharging -> Item Timer -> CompleteChargingIfUsing
                /* On receive */
                var onReceive = LogicParamGenerator.CreateOnReceiveKey(GimmickTarget.Item, "CompleteChargingIfUsing");

                /* Logic */
                // if (using) { SendSignal(Item, "CompleteCharging") }
                // fullyCharged = using
                // charging = false
                var logic = LogicParamGenerator.CreateLogic(
                    LPW.SendSignalToSelf("using", "CompleteCharging"),
                    LPW.SetValueFromKey("fullyCharged", ParameterType.Bool, "using"),
                    LPW.SetValue("charging", new Base.ConstantValue(false)));

                /* LogicParam */
                logicInfo.AddItemLogicParam(new LogicParam(onReceive, logic));
            }

            /* ItemLogic */
            {
                /* On receive */
                var onReceive = LogicParamGenerator.CreateOnReceiveKey(GimmickTarget.Item, "Shoot");

                /* Logic */
                // if (fullyCharged) { SendSignal(Item, "ShootStrongBullet") }
                // if (!fullyCharged) { SendSignal(Item, "ShootWeakBullet") }
                var logic = LogicParamGenerator.CreateLogic(
                    LPW.SendSignalToSelf("fullyCharged", "ShootStrongBullet"),
                    LPW.SendSignalToSelf(Operator.Not, "fullyCharged", "ShootWeakBullet"));

                /* LogicParam */
                logicInfo.AddItemLogicParam(new LogicParam(onReceive, logic));
            }
        }
Beispiel #2
0
        public HandGunDefinition()
        {
            /* Set path */
            common.prefabsPathController.SetPath("Prototype_HandGun.prefab", "HandGun.prefab");

            /* ---------------------------------------------------------------- */
            // Define : Item
            /* ---------------------------------------------------------------- */
            {
                var itemInfo = common.itemInfo;

                itemInfo.isItem   = true;
                itemInfo.itemName = "ハンドガン";

                itemInfo.isMovableItem = true;

                itemInfo.isGrabbableItem = true;
            }

            /* ---------------------------------------------------------------- */
            // Define : Trigger
            /* ---------------------------------------------------------------- */
            {
                var triggerInfo = common.triggerInfo;

                /* OnCreateItemTrigger */
                triggerInfo.AddOnCreateItemTrigger(LPG.CreateInteger(TriggerTarget.Item, null, "bullets", 6));
                triggerInfo.AddOnCreateItemTrigger(LPG.CreateInteger(TriggerTarget.Item, null, "maxBullets", 6));

                /* OnGrabItemTrigger */
                triggerInfo.AddOnGrabItemTrigger(LPG.CreateBool(TriggerTarget.Item, null, "enableUI", true));
                triggerInfo.AddOnGrabItemTrigger(LPG.CreateSignal(TriggerTarget.Item, null, "Reloaded"));

                /* OnReleaseItemTrigger */
                triggerInfo.AddOnReleaseItemTrigger(LPG.CreateBool(TriggerTarget.Item, null, "enableUI", false));

                /* UseItemTrigger */
                triggerInfo.AddUseItemTrigger_Down(LPG.CreateSignal(TriggerTarget.Item, null, "ShootUnlessReloading"));
            }

            /* ---------------------------------------------------------------- */
            // Define : Logic
            /* ---------------------------------------------------------------- */
            var logicInfo = common.logicInfo;

            /* ItemLogic */
            {
                /* On receive */
                var onReceive = LogicParamGenerator.CreateOnReceiveKey(GimmickTarget.Item, "ShootUnlessReloading");

                /* Logic */
                // if (!reloading) { SendSignal(Item, "ShootOrReload") }
                var logic = LogicParamGenerator.CreateLogic(
                    LPW.SendSignalToSelf(Operator.Not, "reloading", "ShootOrReload"));

                /* LogicParam */
                logicInfo.AddItemLogicParam(new LogicParam(onReceive, logic));
            }

            {
                /* On receive */
                var onReceive = LogicParamGenerator.CreateOnReceiveKey(GimmickTarget.Item, "ShootOrReload");

                /* Logic */
                // if (bullets > 0) { SendSignal(Item, "Shoot") }
                // if (bullets <= 0) { SendSignal(Item, "Reload") }
                var logic = LogicParamGenerator.CreateLogic(
                    LPW.SendSignalToSelfByCompare("bullets", Operator.GreaterThan, new Base.ConstantValue(0), "Shoot"),
                    LPW.SendSignalToSelfByCompare("bullets", Operator.LessThanOrEqual, new Base.ConstantValue(0), "Reload"));

                /* LogicParam */
                logicInfo.AddItemLogicParam(new LogicParam(onReceive, logic));
            }

            {
                /* On receive */
                var onReceive = LogicParamGenerator.CreateOnReceiveKey(GimmickTarget.Item, "Shoot");

                /* Logic */
                // bullets = bullets - 1
                var logic = LogicParamGenerator.CreateLogic(
                    LPW.SetValueByCalculate("bullets", Operator.Subtract, new Base.ConstantValue(1)));

                /* LogicParam */
                logicInfo.AddItemLogicParam(new LogicParam(onReceive, logic));
            }

            {
                /* On receive */
                var onReceive = LogicParamGenerator.CreateOnReceiveKey(GimmickTarget.Item, "Reload");

                /* Logic */
                // reloading = true
                // enableUI = false
                var logic = LogicParamGenerator.CreateLogic(
                    LPW.SetValue("reloading", new Base.ConstantValue(true)),
                    LPW.SetValue("enableUI", new Base.ConstantValue(false)));

                /* LogicParam */
                logicInfo.AddItemLogicParam(new LogicParam(onReceive, logic));
            }

            {
                // Reload -> Item Timer -> Reloaded
                /* On receive */
                var onReceive = LogicParamGenerator.CreateOnReceiveKey(GimmickTarget.Item, "Reloaded");

                /* Logic */
                // bullets = maxBullets
                // reloading = false
                // enableUI = true
                var logic = LogicParamGenerator.CreateLogic(
                    LPW.SetValueFromKey("bullets", ParameterType.Integer, "maxBullets"),
                    LPW.SetValue("reloading", new Base.ConstantValue(false)),
                    LPW.SetValue("enableUI", new Base.ConstantValue(true)));

                /* LogicParam */
                logicInfo.AddItemLogicParam(new LogicParam(onReceive, logic));
            }
        }