예제 #1
0
    private void PutDownBlock(global::Event e)
    {
        Debug.Assert(e.GetType() == typeof(InputEvent), "Non-InputEvent in PutDownBlock");

        InputEvent inputEvent = e as InputEvent;

        if (inputEvent.selected.tag == BOARD_TAG)
        {
            SpaceBehavior space = inputEvent.selected.GetComponent <SpaceBehavior>();

            //if the space isn't blockable for any reason, stop
            if (!CheckBlockable(space.GridLocation))
            {
                return;
            }


            //the space is blockable; put down the rockfall and provide appropriate feedback
            space.Block = true;
            Services.Tasks.AddTask(new BlockSpaceFeedbackTask(space.GridLocation.x, space.GridLocation.z, BLOCK_MARKER_OBJ));


            //tell the Ranger where the rockfall is
            if (ranger.GetCurrentTrapTrack() == RangerBehavior.TrapTrack.Rockfall)
            {
                ranger.RockfallLoc = new TwoDLoc(space.GridLocation.x, space.GridLocation.z);
            }


            Services.Board.HighlightAllAroundSpace(ranger.ReportGridLoc().x, ranger.ReportGridLoc().z, BoardBehavior.OnOrOff.Off, true);

            SetStatus(TaskStatus.Success);
        }
    }
예제 #2
0
    private void PutDownBlock(Event e)
    {
        Debug.Assert(e.GetType() == typeof(InputEvent), "Non-InputEvent in PutDownBlock");

        //don't put down a block while the player is trying to hide the character sheet
        if (Services.UI.GetCharSheetStatus() == CharacterSheetBehavior.SheetStatus.Displayed)
        {
            return;
        }

        InputEvent inputEvent = e as InputEvent;

        if (inputEvent.selected.tag == BOARD_TAG)
        {
            SpaceBehavior space = inputEvent.selected.GetComponent <SpaceBehavior>();


            //is this a block that can destroy an attacker?
            bool destroyingBlock = false;

            //try to put down the block
            if (CheckBlockable(space.GridLocation.x, space.GridLocation.z, destroyingBlock))
            {
                space.Block = true;
                Services.Tasks.AddTask(new BlockSpaceFeedbackTask(space.GridLocation.x, space.GridLocation.z, BLOCK_MARKER_OBJ));
                Services.UI.OpponentStatement(BLOCKED_MSG);

                if (ranger.GetCurrentTrapTrack() == RangerBehavior.TrapTrack.Rockfall)
                {
                    ranger.RockfallLoc = new TwoDLoc(space.GridLocation.x, space.GridLocation.z);
                }

                Services.Events.Unregister <InputEvent>(PutDownBlock);
                Services.Board.HighlightAllAroundSpace(rangerX, rangerZ, BoardBehavior.OnOrOff.Off, true);
                SetStatus(TaskStatus.Success);
            }
        }
    }