示例#1
0
        public virtual void Spawn(string id, int count, Sprite sprite)
        {
            // float spawnPosX = transform.position.x + (50f * count);
            // Vector3 spawnPos = new Vector3(spawnPosX, transform.position.y, transform.position.z);
            // Icons are 75 units square
            float           spawnPosX = (iconOffset * count);
            Vector3         spawnPos  = new Vector3(spawnPosX, 0, 0);
            EffectIconImage instance  = null;

            if (fxIconStack.Count == 0)
            {
                // instance = Instantiate(fxIcon, spawnPos, Quaternion.identity, transform);
                instance = Instantiate(fxIcon, transform);
                instance.SetPosition(spawnPos);
            }
            else
            {
                instance = fxIconStack.Pop();
                instance.SetPosition(spawnPos);
                instance.gameObject.SetActive(true);
                instance.transform.SetAsLastSibling();
            }
            instance.SetIcon(sprite);
            iconInstances[id] = instance;
        }
        public override void Spawn(string id, int count, Sprite sprite)
        {
            float           spawnPosX = (50f * count);
            Vector3         spawnPos  = new Vector3(spawnPosX, 0, 0);
            EffectIconImage instance  = null;

            if (fxIconStack.Count == 0)
            {
                instance = Instantiate(fxIcon, transform);
                instance.SetPosition(spawnPos);
            }
            else
            {
                instance = fxIconStack.Pop();
                instance.SetPosition(spawnPos);
                instance.gameObject.SetActive(true);
                instance.transform.SetAsLastSibling();
            }
            instance.SetIcon(sprite);
            iconInstances[id] = instance;

            // Set tooltip info
            fxDisplay = instance.GetComponent <EffectDisplay>();
            fxDisplay.SetEffectName(id);
        }