void Start() { CardGameVariables oponent = GetOponent(CardGameInitializer.playerName); deck = new Deck(oponent.deckSkin ?? deckSkin); players = new PlayerLogic[] { //BuildPlayerLogic(playerHand, playerMoney, oponent, "SmartAI", defaultAIData), new HumanPlayerLogic(0, playerHand, foldButton, guiTransform, bidPreview, multiplier, multiplierShow, multiplierImages, cardSelection, playerMoney), BuildPlayerLogic(oponentHand, oponentMoney, oponent, "SmartAI", defaultAIData), }; var story = StoryManager.GetSingleton().GetStory(); if (story != null) { players[0].AdjustMoney((int)(story.variablesState["player_money"] ?? 1000) - players[0].money); if (oponent.oponentMoneyStore != null) { players[1].AdjustMoney((int)story.variablesState[oponent.oponentMoneyStore] - players[1].money); } } foreach (PlayerLogic logic in players) { logic.hand.UseBack(oponent.deckSkin == null ? deckSkin.back : oponent.deckSkin.back); } StartHand(); }
public void EndGame() { CardGameVariables oponent = GetOponent(CardGameInitializer.playerName); var story = StoryManager.GetSingleton(); story.SetInt("player_money", players[0].money); story.SetInt(oponent.oponentMoneyStore, players[1].money); WorldInitializer.LoadWorld(CardGameInitializer.returnPoint ?? new MapPath("default", "default"), CardGameInitializer.returnKnot); }
PlayerLogic BuildPlayerLogic(PlayerHand hand, Text money, CardGameVariables variables, string savedName, TextAsset fallback) { switch (variables.aiType) { case CardAIType.NeverFold: default: shootout.AllTurnProbabilities turnProbs; if (loadedAI.ContainsKey(savedName)) { turnProbs = loadedAI[savedName]; } else { turnProbs = new shootout.AllTurnProbabilities(); loadedAI[savedName] = turnProbs; string filename = Path.Combine(Application.persistentDataPath, savedName + ".ai"); DebugLog("Loading AI from " + filename); if (File.Exists(filename)) { DebugLog("Loading from file"); using (BinaryReader reader = new BinaryReader(File.Open(filename, FileMode.Open))) { turnProbs.Read(reader); } } else { DebugLog("Loading for prefab"); using (BinaryReader reader = new BinaryReader(new MemoryStream(fallback.bytes))) { turnProbs.Read(reader); } } } DebugLog("Loaded"); return(new CalculatedAI(1, hand, money, shootout.CardGameAI.TurnProbability(turnProbs))); } }