public void ReplaceBigToken2(int originalViewID, int newViewID, bool destroy) { if (bigToken.GetComponent <PhotonView>().ViewID == originalViewID) { BigToken token = (BigToken)PhotonView.Find(newViewID).GetComponentInParent <Token>(); string id = convertToKey(newViewID); AllTokens.Add(id, token); AllTokens.Remove(convertToKey(originalViewID)); if (destroy) { GameObject.Destroy(bigToken.gameObject); } bigToken = token; } if (GameManager.instance.MainHero.TokenName.Equals(parentHero)) { EventManager.TriggerInventoryUIHeroUpdate(this); } else if (parentHero.Equals(CharChoice.choice.TokenName)) { EventManager.TriggerInventoryUIHeroPeak(this); } }
public void ReplaceSmallToken2(int originalViewID, int newViewID, bool destroy) { if (smallTokens.Contains(convertToKey(originalViewID))) { SmallToken token = (SmallToken)PhotonView.Find(newViewID).GetComponent <Token>(); string id = convertToKey(newViewID); AllTokens.Remove(convertToKey(originalViewID)); smallTokens.Remove(convertToKey(originalViewID)); smallTokens.Add(id, token); AllTokens.Add(id, token); if (destroy) { Token tkn = PhotonView.Find(originalViewID).GetComponent <Token>(); if (tkn != null) { GameObject.Destroy(tkn.gameObject); } } } if (GameManager.instance.MainHero.TokenName.Equals(parentHero)) { EventManager.TriggerInventoryUIHeroUpdate(this); } else if (parentHero.Equals(CharChoice.choice.TokenName)) { EventManager.TriggerInventoryUIHeroPeak(this); } }
public void AddToken(Token token) { Type listType; listType = Heroes.GetListType(); if (listType.IsCompatibleWith(token.GetType())) { AllTokens.Add(token); Heroes.Add((Hero)token); return; } listType = Enemies.GetListType(); if (listType.IsCompatibleWith(token.GetType())) { AllTokens.Add(token); Enemies.Add((Enemy)token); return; } listType = Farmers.GetListType(); if (listType.IsCompatibleWith(token.GetType())) { AllTokens.Add(token); Farmers.Add((Farmer)token); return; } if (token is Fog) { AllTokens.Add(token); return; } if (token is Well) { AllTokens.Add(token); Well = (Well)token; return; } if (token is Witch) { AllTokens.Add(token); return; } if (token is Thorald) { AllTokens.Add(token); return; } // if none of these options means its an item AddItem(token); }
public void AddHelm2(Helm item) { string id = convertToKey(item.GetComponent <PhotonView>().ViewID); helm = item; AllTokens.Add(id, (Helm)item); if (GameManager.instance.MainHero.TokenName.Equals(parentHero)) { EventManager.TriggerInventoryUIHeroUpdate(this); } else if (parentHero.Equals(CharChoice.choice.TokenName)) { EventManager.TriggerInventoryUIHeroPeak(this); } }
public void AddSmallToken2(SmallToken smallToken) { string id = convertToKey(smallToken.GetComponent <PhotonView>().ViewID); smallTokens.Add(id, (SmallToken)smallToken); AllTokens.Add(id, (SmallToken)smallToken); if (GameManager.instance.MainHero.TokenName.Equals(parentHero)) { EventManager.TriggerInventoryUIHeroUpdate(this); } else if (parentHero.Equals(CharChoice.choice.TokenName)) { EventManager.TriggerInventoryUIHeroPeak(this); } }
public void addGold2(GoldCoin gold) { string id = convertToKey(gold.GetComponent <PhotonView>().ViewID); golds.Add(id, (GoldCoin)gold); AllTokens.Add(id, (GoldCoin)gold); numOfGold++; if (GameManager.instance.MainHero.TokenName.Equals(parentHero)) { EventManager.TriggerInventoryUIHeroUpdate(this); EventManager.TriggerGoldUpdate(GameManager.instance.findHero(parentHero)); } else if (parentHero.Equals(CharChoice.choice.TokenName)) { EventManager.TriggerInventoryUIHeroPeak(this); } }