Beispiel #1
0
        public Position Move(IMoveCommand moveCommand)
        {
            var position = _positions.Last().Move(moveCommand);

            _positions.Add(position);
            return(position);
        }
Beispiel #2
0
        override public void Select(Tile tile)
        {
            if (_playerPiece != null && _currentMoveComand != null)
            {
                var tiles = _currentMoveComand.Tiles(_board, _playerPiece);

                _board.UnHightlight(tiles);

                if (tiles.Contains(tile))
                {
                    _currentMoveComand.Execute(_board, _playerPiece, tile);

                    GameLoop.Instance.Board.Deck.Take((_currentMoveComand).GetCard());
                    _movesLeft--;
                }



                _currentMoveComand = null;

                _moveManager.ActivateFor(_playerPiece);


                if (_movesLeft == 0)
                {
                    StateMachine.MoveTo(GameStates.EnemyPhase1);
                }
            }
        }
Beispiel #3
0
        private void CombineMove(KimbokoCombine combien, MoveAbilityEventInfo movInfo)
        {
            IMoveCommand moveCommand = new IMoveCommand(movInfo, game);

            Invoker.AddNewCommand(moveCommand);
            Invoker.ExecuteCommands();

            Vector3 startPosition = movInfo.fromTile.GetRealWorldLocation();
            Vector3 endPosition   = movInfo.endPosition.GetRealWorldLocation();

            GameObject[] goToMove = new GameObject[combien.kimbokos.Count];

            for (int i = 0; i < goToMove.Length; i++)
            {
                goToMove[i] = combien.kimbokos[i].goAnimContainer.GetGameObject();
            }

            //Motion combineMoveMotion = moveManagerUI.CombineMoveMotion(startPosition, endPosition, goToMove);
            //InvokerMotion.AddNewMotion(combineMoveMotion);
            //InvokerMotion.StartExecution(game);

            Animotion combineMoveMotion = moveManagerUI.CombineMoveAnimotion(startPosition, endPosition, goToMove);

            InvokerAnimotion.AddNewMotion(combineMoveMotion);
            InvokerAnimotion.StartExecution(game);
        }
Beispiel #4
0
 /// <summary>Triggers a move command from a mouse move script.  X/Y should be +-1</summary>
 public void DoMoveCommand(int X, int Y)
 {
     if (m_CurrentMove == null)
     {
         m_CurrentMove = new CmdMouseMove();                 // will move mouse as default.  This shouldn't really happen, but safe to do as a fallback
     }
     m_CurrentMove.Move(X * MouseStep, Y * MouseStep);
 }
Beispiel #5
0
 public void move()
 {
     if (currentCommand != null)
     {
         currentCommand.move();
         commands[currentCommand.getPlayerId()] = currentCommand;
         currentCommand = null;
     }
 }
Beispiel #6
0
 public Position Move(IMoveCommand moveCommand)
 {
     return(moveCommand.Direction switch
     {
         Direction.North => MoveY(moveCommand.Steps),
         Direction.South => MoveY(moveCommand.Steps * -1),
         Direction.West => MoveX(moveCommand.Steps * -1),
         Direction.East => MoveX(moveCommand.Steps)
     });
Beispiel #7
0
 public MoveCommand(IMoveCommand command)
 {
     this.secondsDelay = command.getSecondsDelay();
     this.blockName    = command.getBlockName();
     this.action       = command.getAction();
     this.value        = command.getValue();
     this.processed    = false;
     this.haltError    = false;
 }
Beispiel #8
0
 /// <summary>Should be called on OK/Cancel commands.  Returns true if it is consumed by ending a previous move</summary>
 public bool DoOKCancel(bool ok)
 {
     if (m_CurrentMove != null && !(m_CurrentMove is CmdMouseMove))
     {
         m_CurrentMove.End(ok);
         m_CurrentMove = null;
         return(true);
     }
     return(false);
 }
Beispiel #9
0
        public void undo(string playerId)
        {
            IMoveCommand command = commands.ContainsKey(playerId) ? commands[playerId] : null;

            if (command != null)
            {
                command.undo();
                command.undo();
                commands.Remove(playerId);
            }
        }
Beispiel #10
0
        override public void Select(IMoveCommand <Piece> moveComand)
        {
            if (_currentMoveComand != null)
            {
                _board.UnHightlight(_currentMoveComand.Tiles(_board, _playerPiece));
            }

            _currentMoveComand = moveComand;

            if (_currentMoveComand != null)
            {
                _board.Highlight(_currentMoveComand.Tiles(_board, _playerPiece));
            }
        }
Beispiel #11
0
        private void NormalMove(MoveAbilityEventInfo movInfo)
        {
            IMoveCommand moveCommand = new IMoveCommand(movInfo, game);

            Invoker.AddNewCommand(moveCommand);
            Invoker.ExecuteCommands();

            Vector3 endPosition = movInfo.endPosition.GetRealWorldLocation();
            //Motion normalMoveMotion = moveManagerUI.MoveMotion(movInfo.moveOccupy.goAnimContainer.GetGameObject(), endPosition);
            //InvokerMotion.AddNewMotion(normalMoveMotion);
            //InvokerMotion.StartExecution(game);

            Animotion normalMoveMotion = moveManagerUI.MoveAnimotion(movInfo.moveOccupy.goAnimContainer.GetGameObject(), endPosition);

            InvokerAnimotion.AddNewMotion(normalMoveMotion);
            InvokerAnimotion.StartExecution(game);
        }
Beispiel #12
0
 virtual public void Select(IMoveCommand <Piece> moveComand)
 {
 }
Beispiel #13
0
 public void QueueMove(IMoveCommand command)
 {
     moveQueue.Enqueue(command);
 }
Beispiel #14
0
 public async Task MoveNow(IMoveCommand command)
 {
     await SendCommand(command.ToURCommand());
 }
Beispiel #15
0
 public void SetMouseMove(IMoveCommand move)
 {
     m_CurrentMove?.End(false);             // cancel the old one, if any
     m_CurrentMove = move;
 }
Beispiel #16
0
 public void Select(IMoveCommand <Piece> moveComand)
 {
     _stateMachine.CurrentSate.Select(moveComand);
 }
Beispiel #17
0
 public void setCommand(IMoveCommand command)
 {
     currentCommand = command;
 }
Beispiel #18
0
 public override void OnExit()
 {
     _moveManager.Deactivate();
     _currentMoveComand = null;
     _moveManager.MoveComandProviderChanged -= OnMoveComandManagerChanged;
 }