コード例 #1
0
        public IP_BattleMapState Update(P_BattleMap battlemap, MyInput input)
        {
            switch (input)
            {
            case MyInput.Confirm:
            {
                if (IsMovementValid(battlemap, _ValidMoveIndex, _CursorIndex))
                {
                    battlemap.MoveActor(_Actor, _CursorIndex);
                    _Actor.TurnStatus = EntityCharacterTurnStatus.Moved;
                    if (_Actor.MyLocation.TileFeatureList.Count > 0)
                    {
                        if (_Actor.MyLocation.TileFeatureList[0].Name == "Objective")
                        {
                            this.Exit(battlemap);
                            return(new P_BMSMapEnd(battlemap));
                        }
                    }
                    if (battlemap.IsFactionTurnOver())
                    {
                        battlemap.SetFactionActorsToNotMyTurn();
                        battlemap.RotateFactionTurn();
                        battlemap.GiveFactionActorsATurn();
                        this.Exit(battlemap);
                        return(new P_BMSPlayerSelectingTile(battlemap));
                    }
                    this.Exit(battlemap);
                    return(new P_BMSPlayerSelectingTile(battlemap));
                }
                break;
            }

            case MyInput.DownLeft:
            case MyInput.DownRight:
            case MyInput.Left:
            case MyInput.Right:
            case MyInput.UpLeft:
            case MyInput.UpRight:
                P_BMS.MoveTileCursor(battlemap, P_BMS.InputToDirection(input), _Cursor, ref _CursorIndex);
                break;

            case MyInput.Deny:
                this.Exit(battlemap);
                return(new P_BMSPlayerSelectingTile(battlemap));
            }
            P_BMS.CursorOffScreen(battlemap, _Cursor);
            return(this);
        }
コード例 #2
0
        public IP_BattleMapState Update(P_BattleMap battlemap, MyInput input)
        {
            switch (input)
            {
            case MyInput.Confirm:
                Tile selectedtile = _Cursor.Owner as Tile;
                if (selectedtile == null)
                {
                    break;
                }
                if (selectedtile.EntityList.Count > 0)
                {
                    if (selectedtile.EntityList[0].GetType() == typeof(EntityActor))
                    {
                        EntityActor selectedactor = selectedtile.EntityList[0] as EntityActor;
                        if (selectedactor.TurnStatus == EntityCharacterTurnStatus.MyTurn)
                        {
                            this.Exit(battlemap);
                            return(new P_BMSChose_Movement(battlemap, selectedactor));
                        }
                    }
                }
                break;

            case MyInput.Escape:
                battlemap.GenerateNewMap();
                this.Exit(battlemap);
                return(this);

            case MyInput.DownLeft:
            case MyInput.DownRight:
            case MyInput.Left:
            case MyInput.Right:
            case MyInput.UpLeft:
            case MyInput.UpRight:
                P_BMS.MoveTileCursor(battlemap, P_BMS.InputToDirection(input), _Cursor, ref CursorIndex);
                break;

            default:
                break;
            }
            P_BMS.CursorOffScreen(battlemap, _Cursor);
            return(this);
        }