public void WinGold() { int gold = (int)PhotonNetwork.LocalPlayer.CustomProperties["gold"]; Debug.Log("Old gold: " + gold); if (monsterType == "Gor") { gold += 2; } else if (monsterType == "Skral") { gold += 4; } else { gold += 6; } PhotonHashtable h = new PhotonHashtable(); h.Add("gold", gold); PhotonNetwork.LocalPlayer.SetCustomProperties(h); Debug.Log("New gold: " + gold); LoadGame loading = new LoadGame(); loading.LoadGameScene(); }
public void WinWillpower() { int wp = (int)PhotonNetwork.LocalPlayer.CustomProperties["wp"]; Debug.Log("Old WP: " + wp); if (monsterType == "Gor") { wp += 2; } else if (monsterType == "Skral") { wp += 4; } else { wp += 6; } PhotonHashtable h = new PhotonHashtable(); h.Add("wp", wp); PhotonNetwork.LocalPlayer.SetCustomProperties(h); Debug.Log("New WP: " + wp); LoadGame loading = new LoadGame(); loading.LoadGameScene(); }
void buyStore() { int i = (int)PhotonNetwork.CurrentRoom.CustomProperties["CurrentPlayerIndex"]; int gold = (int)PhotonNetwork.PlayerList[i].CustomProperties["gold"]; int wineSkinNum = getObjectInt(GameObject.Find("WineSkinNumber")); int ShieldNumber = getObjectInt(GameObject.Find("ShieldNumber")); int FalconNumber = getObjectInt(GameObject.Find("FalconNumber")); int BowNumber = getObjectInt(GameObject.Find("BowNumber")); int HelmNumber = getObjectInt(GameObject.Find("HelmNumber")); int TelescopeNumber = getObjectInt(GameObject.Find("TelescopeNumber")); int StrengthNumber = getObjectInt(GameObject.Find("StrengthNumber")); List <int> totalObj = new List <int> { wineSkinNum, ShieldNumber, FalconNumber, BowNumber, HelmNumber, TelescopeNumber, StrengthNumber }; int cost = 0; bool notEnough = false; foreach (var num in totalObj) { cost += num * 2; if (cost > gold) { notEnough = true; setActiveTrue(storePopup, 3); } } if (!notEnough) { int sp = (int)PhotonNetwork.PlayerList[i].CustomProperties["sp"]; int wineskin = (int)PhotonNetwork.PlayerList[i].CustomProperties["wineskin"]; int shield = (int)PhotonNetwork.PlayerList[i].CustomProperties["shield"]; int bow = (int)PhotonNetwork.PlayerList[i].CustomProperties["bow"]; int falcon = (int)PhotonNetwork.PlayerList[i].CustomProperties["falcon"]; int telescope = (int)PhotonNetwork.PlayerList[i].CustomProperties["telescope"]; int helm = (int)PhotonNetwork.PlayerList[i].CustomProperties["helm"]; int newGoldAmount = gold - cost; PhotonHashtable p = new PhotonHashtable(); p.Add("sp", sp + StrengthNumber); p.Add("gold", newGoldAmount); p.Add("wineskin", wineskin + wineSkinNum); p.Add("shield", shield + ShieldNumber); p.Add("falcon", bow + BowNumber); p.Add("bow", falcon + FalconNumber); p.Add("telescope", telescope + TelescopeNumber); p.Add("helm", helm + HelmNumber); PhotonNetwork.PlayerList[i].SetCustomProperties(p); LoadGame loading = new LoadGame(); loading.LoadGameScene(); } }
public IEnumerator FightSceneLoaded(string s) { yield return(new WaitUntil(() => SceneManager.GetActiveScene().name == "FightScene")); Debug.Log("In FightSceneLoaded!!!"); Sprite newSprite = Resources.Load <Sprite>(s + "Icon"); GameObject.Find("CurrentPlayerPic").GetComponent <SpriteRenderer>().sprite = newSprite; this.heroDice = GameObject.Find("HeroDice").GetComponent <Dice>(); this.monsterDice = GameObject.Find("MonsterDice").GetComponent <Dice>(); this.flipDiceButton = GameObject.Find("FlipDiceButton"); Debug.Log("fight scene loaded"); this.roundOverPanel = GameObject.Find("RoundOverPanel"); this.heroWinnerPanel = GameObject.Find("HeroWinnerPanel"); this.monsterWinnerPanel = GameObject.Find("MonsterWinnerPanel"); this.outOfHoursPanel = GameObject.Find("OutOfHoursPanel"); Button yes = GameObject.Find("PlayAnotherButton").GetComponent <Button>(); Button no = GameObject.Find("ExitFightButton").GetComponent <Button>(); Button ok1 = GameObject.Find("OKButton1").GetComponent <Button>(); Button ok2 = GameObject.Find("OKButton2").GetComponent <Button>(); //Button ok3 = GameObject.Find("OKButton3").GetComponent<Button>(); Button wpPrize = GameObject.Find("WpPrizeButton").GetComponent <Button>(); Button goldPrize = GameObject.Find("GoldPrizeButton").GetComponent <Button>(); LoadGame l = GameObject.Find("LoadGameFromFight").GetComponent <LoadGame>(); wpPrize.onClick.AddListener(() => WinWillpower()); goldPrize.onClick.AddListener(() => WinGold()); this.useShieldButton = GameObject.Find("UseShieldButton").GetComponent <Button>(); this.useShieldButton.onClick.AddListener(() => UseShield()); useHelmButton = GameObject.Find("UseHelmButton").GetComponent <Button>(); useHelmButton.onClick.AddListener(() => UseHelm()); this.useBrewButton = GameObject.Find("UseBrewButton").GetComponent <Button>(); this.useBrewButton.onClick.AddListener(() => UseBrew()); this.useRunestonesButton = GameObject.Find("UseRunestonesButton").GetComponent <Button>(); this.useRunestonesButton.onClick.AddListener(() => UseRunestones()); no.onClick.AddListener(() => GameObject.Find(s).GetComponent <Hero>().UpdateTimeTrack(this.hoursUsed[0])); no.onClick.AddListener(() => this.DestroyFightController()); no.onClick.AddListener(() => l.LoadGameScene()); ok1.onClick.AddListener(() => GameObject.Find(s).GetComponent <Hero>().UpdateTimeTrack(this.hoursUsed[0])); ok1.onClick.AddListener(() => GameObject.Find(s).GetComponent <Hero>().endTurn()); ok1.onClick.AddListener(() => l.LoadGameScene()); ok1.onClick.AddListener(() => this.DestroyFightController()); ok2.onClick.AddListener(() => GameObject.Find(s).GetComponent <Hero>().UpdateTimeTrack(this.hoursUsed[0])); ok2.onClick.AddListener(() => this.DestroyFightController()); ok2.onClick.AddListener(() => l.LoadGameScene()); wpPrize.onClick.AddListener(() => GameObject.Find(s).GetComponent <Hero>().UpdateTimeTrack(this.hoursUsed[0])); wpPrize.onClick.AddListener(() => this.DestroyFightController()); goldPrize.onClick.AddListener(() => GameObject.Find(s).GetComponent <Hero>().UpdateTimeTrack(this.hoursUsed[0])); goldPrize.onClick.AddListener(() => this.DestroyFightController()); yes.onClick.AddListener(() => this.PlayRound()); this.roundOverPanel.SetActive(false); this.heroWinnerPanel.SetActive(false); this.monsterWinnerPanel.SetActive(false); this.outOfHoursPanel.SetActive(false); this.useShieldButton.gameObject.SetActive(false); useHelmButton.gameObject.SetActive(false); this.useBrewButton.gameObject.SetActive(false); this.useRunestonesButton.gameObject.SetActive(false); PlayRound(); }
void quitStore() { LoadGame loading = new LoadGame(); loading.LoadGameScene(); }