Ejemplo n.º 1
0
        public void WcfAddFighter(Fighter.TypeFighter typeFighter, Cell addedCell)
        {
            addedCell = SearchNeedCell(addedCell);
            CellViewModel cellVM = SearchCellVMtoCell(addedCell);

            if (Fighter.CanAddFighter(typeFighter, _fieldViewModel.Game.WhoTurn))
            {
                switch (typeFighter)
                {
                case Fighter.TypeFighter.WizardFighter:
                    cellVM.Cell.Fighter = new WizardFighter(_fieldViewModel.Field.Game.WhoTurn.Orientation, addedCell, typeFighter);
                    break;

                case Fighter.TypeFighter.ArcherFighter:
                    cellVM.Cell.Fighter = new ArcherFighter(_fieldViewModel.Field.Game.WhoTurn.Orientation, addedCell, typeFighter);
                    break;

                case Fighter.TypeFighter.BarbarianFighter:
                    cellVM.Cell.Fighter = new BarbarianFighter(_fieldViewModel.Field.Game.WhoTurn.Orientation, addedCell, typeFighter);
                    break;

                default:
                    break;
                }
                _fieldViewModel.BattleFieldViewModel.RefreshPanelEnergyAndWhoTurn();
                FieldViewModel.ClearAllCellsFromSelection();
                cellVM.Fighter = null; //refresh
            }
            else
            if (FieldViewModel.Game.WhoTurn._user.Equals(_fieldViewModel.BattleFieldViewModel.You))
            {
                new MsgBoxGame("Not enough energy").ShowDialog();
            }
        }
Ejemplo n.º 2
0
        public void MarkCellsForTurn(CellViewModel fromCell)
        {
            ClearAllCellsFromSelection();

            fromCell.IsSelected = true;
            if (fromCell.Fighter != null && fromCell.Fighter.IsCanGo)
            {
                MarkCells(TransportationCellInCellViewModel(fromCell.Fighter.GetPossibleTurns()), true);
            }
            else
            if (fromCell.Fighter != null && !fromCell.Fighter.IsCanGo)
            {
                MarkCells(TransportationCellInCellViewModel(fromCell.Fighter.GetPossibleTurns()), false);
            }
        }
Ejemplo n.º 3
0
        public void WcfMakeTurn(Cell fromCell, Cell toCell)
        {
            CellViewModel fromCellVM = SearchCellVMtoCell(fromCell);
            CellViewModel toCellVM   = SearchCellVMtoCell(toCell);

            FieldViewModel.Field.MakeTurn(fromCellVM._cell, toCellVM.Cell);
            toCellVM.RaisePropertyChanged("Fighter");
            fromCellVM.RaisePropertyChanged("Fighter");
            FieldViewModel.ClearAllCellsFromSelection();
            FieldViewModel.BattleFieldViewModel.RefreshPanelEnergyAndWhoTurn();
            if (IsEndGame())
            {
                FieldViewModel.Game.Winner = FieldViewModel.Game.WhoTurn._user;
                FieldViewModel.BattleFieldViewModel.Proxy.EndGame(FieldViewModel.Game);
            }
        }