public MainViewModel() { data = new DataAccess.Data(); game = new Game(data, new List<string> { "Jessica", "Jack", "John", "Jane" }, Difficulty.Introductory); notifier = new Notifier(); actionCardManager = game.ActionCardManager; actionManager = game.ActionManager; drawManager = game.DrawManager; infectionManager = game.InfectionManager; currentPlayer = new ObjectContext<Player>(); currentPlayer.Context = game.CurrentPlayer; selectedPlayer = new ObjectContext<Player>(); messageContext = new ObjectContext<StringBuilder>(); messageContext.Context = new StringBuilder(); BoardViewModel = new BoardViewModel(game, currentPlayer, selectedPlayer, notifier); MessageViewModel = new MessageViewModel(messageContext, game.NodeCounters); foreach (Player player in game.Players) { player.Hand.DiscardManager.Block += DiscardManagerBlock; player.Hand.DiscardManager.Release += DiscardManagerRelease; } drawManager.EpidemicDrawn += EpidemicDrawn; game.GameOver += Game_GameOver; game.GameWon += Game_GameWon; }
public static ActionCardManager getInstance() { if (instance == null) { instance = GameObject.Find("MainCamera/MainView/UpperRightAnchor/ActionCardManager").GetComponent<ActionCardManager>(); } return instance; }
public AirliftViewModel(IContext<BaseActionCard> selectedActionCardContext, ActionCardManager actionCardManager) { this.selectedActionCardContext = selectedActionCardContext; this.actionCardManager = actionCardManager; actionCard = selectedActionCardContext.Context as ActionCard<AirliftItem>; if (actionCard == null) this.selectedActionCardContext.Context = null; }
public GovernmentGrantViewModel(IContext<BaseActionCard>selectedActionCardContext, ActionCardManager actionCardManager) { this.selectedActionCardContext = selectedActionCardContext; this.actionCardManager = actionCardManager; actionCard = selectedActionCardContext.Context as ActionCard<GovernmentGrantItem>; if (actionCard == null) this.selectedActionCardContext.Context = null; }
public Game(IDataAccess dataAccess, IList<string> playerNames, Difficulty difficulty) { OutbreakCounter = new OutbreakCounter(); Diseases = dataAccess.GetDiseases(); Nodes = dataAccess.GetNodes(); Players = PlayerFactory.GetPlayers(playerNames); NodeCounters = GetNodeDiseaseCounter(Nodes, Diseases, OutbreakCounter); DiseaseCounters = GetDiseaseCounters(Diseases, NodeCounters, OutbreakCounter); SubscribeNodesToMovers(); SubscribeToPlayerCounters(); InfectionRateCounter = new InfectionRateCounter(); ResearchStationCounter = new ResearchStationCounter(); cityCards = GetCityCards(Nodes); infectionCards = GetInfectionCards(NodeCounters); infectionDeck = new InfectionDeck(infectionCards.ToList()); ActionCardManager = new ActionCardManager(Nodes, Players, ResearchStationCounter, infectionDeck); playerDeck = new PlayerDeck(new List<Card>(cityCards), new List<Card>() { ActionCardManager.GovernmentGrant, ActionCardManager.Airlift }); epidemicCards = GetEpidemicCards(InfectionRateCounter, infectionDeck); StartGame((int)difficulty); playerQueue = new PlayerQueue(Players.ToList()); Players = Players.OrderBy(i => i.TurnOrder); ActionManager = new ActionManager(); DrawManager = new DrawManager(playerDeck); DrawManager.DrawPhaseCompleted += DrawPhaseComplete; InfectionManager = new InfectionManager(InfectionRateCounter, infectionDeck); InfectionManager.InfectionPhaseCompleted += InfectionPhaseCompleted; //game over OutbreakCounter.GameOver += GameOverNotified; playerDeck.GameOver += GameOverNotified; foreach (DiseaseCounter dc in DiseaseCounters) { dc.GameOver += GameOverNotified; } //game won CureTracker = new CureTracker(Diseases); CureTracker.GameWon += GameWonNotified; NextPlayer(); }