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);
        }
    }
 void FarmerDestroyed(Farmer farmer)
 {
     if (Farmers.Contains(farmer))
     {
         Farmers.Remove(farmer);
         AllTokens.Remove(farmer);
     }
 }
 public void RemoveSmallToken2(int viewID)
 {
     AllTokens.Remove(convertToKey(viewID));
     smallTokens.Remove(convertToKey(viewID));
     if (GameManager.instance.MainHero.TokenName.Equals(parentHero))
     {
         EventManager.TriggerInventoryUIHeroUpdate(this);
     }
     else if (parentHero.Equals(CharChoice.choice.TokenName))
     {
         EventManager.TriggerInventoryUIHeroPeak(this);
     }
 }
 public void RemoveGold2(int viewID)
 {
     numOfGold--;
     AllTokens.Remove(convertToKey(viewID));
     golds.Remove(convertToKey(viewID));
     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);
     }
 }
 public void RemoveHelm2(int viewID)
 {
     if (helm.GetComponent <PhotonView>().ViewID == viewID)
     {
         helm = null;
         AllTokens.Remove(convertToKey(viewID));
     }
     if (GameManager.instance.MainHero.TokenName.Equals(parentHero))
     {
         EventManager.TriggerInventoryUIHeroUpdate(this);
     }
     else if (parentHero.Equals(CharChoice.choice.TokenName))
     {
         EventManager.TriggerInventoryUIHeroPeak(this);
     }
 }
    public void RemoveToken(int objectIndex)
    {
        if (objectIndex > AllTokens.Count - 1 || objectIndex < 0)
        {
            return;
        }

        Token token = AllTokens[objectIndex];

        AllTokens.Remove(token);

        Type listType = Heroes.GetListType();

        if (listType.IsCompatibleWith(token.GetType()))
        {
            Heroes.Remove((Hero)token);
            InventoryUICell.instance.ForceUpdate(this, cellID);
            return;
        }

        listType = Enemies.GetListType();
        if (listType.IsCompatibleWith(token.GetType()))
        {
            Enemies.Remove((Enemy)token);
            InventoryUICell.instance.ForceUpdate(this, cellID);
            return;
        }

        listType = Farmers.GetListType();
        if (listType.IsCompatibleWith(token.GetType()))
        {
            Farmers.Remove((Farmer)token);
            InventoryUICell.instance.ForceUpdate(this, cellID);
            return;
        }

        if (typeof(Well).IsCompatibleWith(token.GetType()))
        {
            Well = null;
            InventoryUICell.instance.ForceUpdate(this, cellID);
            return;
        }

        InventoryUICell.instance.ForceUpdate(this, cellID);
    }