コード例 #1
0
        /// <summary>
        /// Description : Update Image source
        /// </summary>
        private void UpdateDatas()
        {
            _spriteExtension = gameObject.GetComponent <SpriteExtension>();

            _index = _spriteExtension._enumIndex;

            _image.sprite = _spriteExtension._imageLibrary.GetSprite(_index);
        }
コード例 #2
0
        /// <summary>
        /// Description : init the sprite data
        /// </summary>
        /// <returns></returns>
        private void Init()
        {
            if (gameObject.GetComponent <SpriteExtension>() == null)
            {
                gameObject.AddComponent <SpriteExtension>();
            }

            if (gameObject.GetComponent <Image>() == null)
            {
                gameObject.AddComponent <Image>();
            }

            _image = gameObject.GetComponent <Image>();

            // Set SpriteExtension
            _spriteExtension = gameObject.GetComponent <SpriteExtension>();
        }