コード例 #1
0
        public InvItem getCurrentInvItem()
        {
            InvItem currentInvItem = invItems.Where(elem => elem.id == currentStateId).First();

            // if smokebomb is enabled then just return currentInvItem
            if (cachedIsSmokeBombEnabledOnThisLevel)
            {
                return(currentInvItem);
            }

            // if smokebomb is not enabled on this level then the default invitem is the inactive drill
            else
            {
                return(currentInvItem.id == InvItem.IDType.SmokeBombInactive ?
                       invItems.Where(elem => elem.id == InvItem.IDType.DrillInactive).First() :
                       currentInvItem);
            }
        }
コード例 #2
0
        public override void Execute()
        {
            // only do anything if the game is running
            if (gameModel.pauseStatus != PauseStatus.RUN)
            {
                return;
            }

            // cache the current inventory item
            InvItem currentInvItem = inventoryModel.getCurrentInvItem();

            // if the current invetory item is smoke bomb and the action is at the start phase then spawn one
            if (currentInvItem.id == InvItem.IDType.SmokeBombActive &&
                startOrStop &&
                smokeBombCircleModel.isTouchWithinEllipse(touchScreenPosition) &&
                TBUtil.IsTouchOnWater(touchScreenPosition) &&
                inventoryModel.smokeBombsLeft > 0)
            {
                smokeBombExplodeSignal.Dispatch(touchScreenPosition);
            }

            // embark or disembark submarine
            if (currentInvItem.id == InvItem.IDType.UBoat && startOrStop)
            {
                playerUBoatEmbarkSignal.Dispatch(!playerModel.isEmbarkedUBoat);
            }

            // mount bomb
            if (currentInvItem.id == InvItem.IDType.TimeBombActive)
            {
                timeBombMountingSignal.Dispatch(startOrStop);
            }

            // drill
            if (currentInvItem.id == InvItem.IDType.DrillActive)
            {
                drillingSignal.Dispatch(startOrStop);
            }
        }