Exemplo n.º 1
0
    public void Activate(Critter newCritter)
    {
        if (!hex)
        {
            hex = GetComponentInParent<Hex>();
            Image[] tempIcons = GetComponentsInChildren<Image>();
            List<Image> addedIcons = new List<Image>();

            for (int i = 0; i < tempIcons.Length; i += 2)
            {
                addedIcons.Add(tempIcons[i]);
            }

            icons = addedIcons.ToArray();

            locoSprites = Resources.LoadAll<Sprite>("LocomotionIcons");
        }

        critter = newCritter;

        if (critter)
        {
            if (!gameObject.activeInHierarchy)
            {
                gameObject.SetActive(true);

                Populate(hex);
            }
            else
            {
                if (locomotion.Length != critter.GetLocomotion().Length || restrictions.Length != critter.GetRestrictions().Length)
                {
                    Populate(hex);
                }
            }
        }
    }