public DartGameSetting() { PlayerOne = new PlayerGameSetting(); PlayerOne.IsFirstSelected = true; PlayerTwo = new PlayerGameSetting(); PlayerTwo.IsFirstSelected = false; }
public PlayerGameState(int id, bool turn, PlayerGameSetting playerGameSetting) { playerGameSetting.shuffleDeck(); this.Id = id; this.Turn = turn; this.HP = playerGameSetting.HP; this.Cost = playerGameSetting.Cost; this.NegativeDeck = new Queue <Card>(playerGameSetting.NegativeDeck); this.PositiveDeck = new Queue <Card>(playerGameSetting.PositiveDeck); this.NegativeHand = new List <Card>(); this.PositiveHand = new List <Card>(); this.Field = new List <ServerCharacter>(); this.BuffList = new List <Buff>(); this.fillHand(playerGameSetting); }
void Start() { itemDatabase = (ItemDataBaseList)Resources.Load("ItemDatabase"); debugingame = GameObject.Find("Debug_game").GetComponent <Text>(); txmoney = GameObject.Find("PlayerGui").transform.Find("Txmoney").gameObject; txcitycount = GameObject.Find("PlayerGui").transform.Find("Txmanount").gameObject; // CitySaveAsset save = (CitySaveAsset)Resources.Load("CitySaveAsset"); if (File.Exists(gamefile)) { // itemList = ReadFromXmlFile<List<ItemStore>>(gamefile); //itemList = ReadFromBinaryFile<List<ItemStore>>("game.save"); // loadGame(); } if (File.Exists(playerfile)) { // playerSetting = ReadFromXmlFile<PlayerGameSetting>(playerfile); playerSetting = ReadFromBinaryFile <PlayerGameSetting>(playerfile); PlayerMoney = playerSetting.money; Inventory invent = GameObject.Find("PlayerGui").transform.GetChild(1).GetComponent <Inventory>(); int i; for (i = 0; i < playerSetting.ItemsInInventory.Count; i++) { invent.addItemToInventory(playerSetting.ItemsInInventory[i].ItemID, playerSetting.ItemsInInventory[i].cout); } //GameObject.Find("PlayerGui").transform.GetChild(1).GetComponent<Inventory>().ItemsInInventory; } if (File.Exists(citysave)) { city = ReadFromBinaryFile <City>(citysave); loadGame(); } else { city = new City(); } //meshSurface.AddData(); // NavMeshSurface meshSurface = new NavMeshSurface(); //NavMeshData navdata = new NavMeshData(); // meshSurface.BuildNavMesh(); }
// Update is called once per frame void Update() { if (Cursor.visible == false) { Cursor.visible = true; } if (cityWorkers.Count > 0) { txcitycount.GetComponent <Text>().text = "Людей: " + cityWorkers.Count + "ч"; } txmoney.GetComponent <Text>().text = "Денег " + PlayerMoney + "р"; if (timeLeft >= 0) { timeLeft -= Time.deltaTime; if (timeLeft < 0) { if (debugingame != null) { debugingame.text = ""; } } } if (orenda >= 0) { orenda -= Time.deltaTime; if (orenda < 0) { //PlayerMoney += cityWorkers.Count; if (cityWorkers.Count > 0) { foreach (var home in city.HomeList) { PlayerMoney += home.itemList.Count / 100; } } if (cityWorkers.Count > 0) { foreach (var item in cityWorkers) { if (item.GetComponent <WorkerController>().isbusy) { PlayerMoney -= 3; if (PlayerMoney < 0) { item.GetComponent <WorkerController>().isbusy = false; item.GetComponent <WorkerController>().bankrot(); PlayerMoney = 0; } } } } orenda = 100.0f; playerSetting = new PlayerGameSetting(); playerSetting.money = PlayerMoney; List <Item> ItemsInInventory = GameObject.Find("PlayerGui").transform.GetChild(1).GetComponent <Inventory>().ItemsInInventory; int i = 0; for (i = 0; i < ItemsInInventory.Count; i++) { if (ItemsInInventory[i].itemValue > 0) { ItemStore itemStore = new ItemStore(); itemStore.ItemID = ItemsInInventory[i].itemID; itemStore.cout = ItemsInInventory[i].itemValue; playerSetting.ItemsInInventory.Add(itemStore); } } //Debug.Log("Count inventory "+ ItemsInInventory.Count); //playerSetting.ItemsInInventory=GameObject.Find("PlayerGui").transform.GetChild(1).GetComponent<Inventory>().ItemsInInventory; // WriteToXmlFile<PlayerGameSetting>(playerfile, playerSetting); WriteToBinaryFile <PlayerGameSetting>(playerfile, playerSetting, false); } } }
public KeyValuePair <List <int>, List <int> > fillHand(PlayerGameSetting playerGameSetting) { return(new KeyValuePair <List <int>, List <int> >( PlayerGameState.__fillHand(this.NegativeDeck, this.NegativeHand, playerGameSetting.MaxNegativeHand), PlayerGameState.__fillHand(this.PositiveDeck, this.PositiveHand, playerGameSetting.MaxPositiveHand))); }