private void StopBidding() { EndBiddingRound(); MartBidControl.bidding = false; MartBidControl.timeRemaining = 10; // When selling, checks if bidding cow in players list if (GameController.Instance().cows.Contains(MartBidControl.biddingCow) && MartBidControl.startingPrice != MartBidControl.currentCowBid) { GPGController.CheckAchiev_2(); GameController.Instance().player.cash += MartBidControl.currentCowBid; GPGController.CheckAchiev_4(GameController.Instance().player.cash); GPGController.CheckAchiev_5(GameController.Instance().player.cash); GameController.Instance().cows.Remove(MartBidControl.biddingCow); } else { // Add to players cows list & Removing from cow generated list if (MartBidControl.playerBidLast) { GameController.Instance().player.cowsBought++; GPGController.CheckAchiev_1(); GameController.Instance().player.cash -= MartBidControl.currentCowBid; GameController.Instance().cows.Add(MartBidControl.biddingCow); GPGController.CheckAchiev_3(GameController.Instance().player.cowsBought); GPGController.CheckAchiev_6(GameController.Instance().cows.Count); MartBidControl.cowsInMart.Remove(MartBidControl.biddingCow); biddingResult = labelBidWon; bidResult = true; StartCoroutine(WaitForSec(3)); } else { // AI bidder won the bidding MartBidControl.cowsInMart.Remove(MartBidControl.biddingCow); biddingResult = labelBidLost; bidResult = true; StartCoroutine(WaitForSec(3)); } } if (MartBidControl.playerBidLast) { print(GameController.Instance().player.name + " has bought " + MartBidControl.biddingCow.name); } else { print(MartBidControl.lastBidder + " has bought " + MartBidControl.biddingCow.name); } GameController.Instance().martCowMenuUI = true; GameController.Instance().martCowBuyBidUI = false; GameController.Instance().martCowSellBidUI = false; GameController.Instance().cowSelected = false; joyStick.gameObject.SetActive(true); Destroy(MartBidControl.biddingCow.cowController.gameObject); MartBidControl.biddingCow = null; ClearStats(); cameraControl.FollowPlayer(); }
public void Save() { try { FileStream file; BinaryFormatter bf = new BinaryFormatter(); // Save player data file = File.Open(Application.persistentDataPath + "/player.dat", FileMode.OpenOrCreate); bf.Serialize(file, _instance.player); file.Close(); // Save cow data file = File.Open(Application.persistentDataPath + "/cows.dat", FileMode.OpenOrCreate); bf.Serialize(file, _instance.cows); file.Close(); // Submitting score to GPG service GPGController.PostScore(_instance.player.cash); Debug.Log("Saving!"); } catch (UnityException e) { Debug.Log("Saving Failed! - " + e); } }
private void CheckGCExists(string gcName) { // Checks if the game game controller exists if (GameObject.Find(gcName) == null) { GameObject cowGameObject = Instantiate(Resources.Load(gcName) as GameObject); cowGameObject.name = gcName; CallGPG(); } // Asking user to login into google play services GPGController.LoginIntoGPG(); }