Пример #1
0
        /// <summary>
        ///     初始化基础数据
        /// </summary>
        /// <param name="manager"></param>
        /// <param name="dataId"></param>
        /// <param name="type"></param>
        /// <param name="isCard"></param>
        protected void InitBase(MagicWallManager manager, int dataId, DataTypeEnum dataType, DaoTypeEnum daoTypeEnum)
        {
            //Debug.Log("Init Base : " + dataId);

            _manager     = manager;
            _data_id     = dataId;
            _dataType    = dataType;
            _daoTypeEnum = daoTypeEnum;

            _flockTweenerManager = new FlockTweenerManager();
            _flockStatus         = FlockStatusEnum.NORMAL;
        }
Пример #2
0
        void Awake()
        {
            _flockTweenerManager = new FlockTweenerManager();

            _createTime = Time.time;
            GetComponent <RectTransform>().localScale = new Vector3(0, 0, 0);

            // 生成动画
            GetComponent <RectTransform>().DOScale(1f, 1f).OnComplete(() => {
                _status = KinectAgentStatusEnum.Normal;

                //Debug.Log("Width : " + GetWidth());
            });
        }
Пример #3
0
        /// <summary>
        ///     初始化卡片类型浮动块数据
        /// </summary>
        /// <param name="manager"></param>
        /// <param name="dataId"></param>
        /// <param name="dataType"></param>
        /// <param name="genPosition">生成位置</param>
        /// <param name="scaleVector3">缩放比例</param>
        /// <param name="originAgent">原关联的浮块</param>
        public void InitComponent(MagicWallManager manager, int dataId, DataTypeEnum dataType,
                                  Vector3 genPosition, FlockAgent originAgent)
        {
            //InitBase(manager, dataId, dataType, true);
            _tweenerManager = new FlockTweenerManager();

            _manager = manager;
            _dataId  = dataId;


            // 初始化框体长宽
            UpdateUI();


            //  命名
            if (originAgent != null)
            {
                name = dataType.ToString() + "(" + originAgent.name + ")";


                _daoTypeEnum = originAgent.daoTypeEnum;

                //  添加原组件
                OriginAgent = originAgent;
            }

            //  定出生位置
            GetComponent <RectTransform>().anchoredPosition3D = genPosition;

            //  配置scene
            _sceneIndex = _manager.SceneIndex;

            //Debug.Log("设置Scene Index : " + _manager.SceneIndex);


            //  初始化长宽字段
            _width  = GetComponent <RectTransform>().rect.width;
            _height = GetComponent <RectTransform>().rect.height;

            // 初始化移动组件
            _moveBtnObservers = new List <MoveBtnObserver>();

            _moveBtnComponent?.Init(DoMove, this);
            _moveBtnComponentInThree?.Init(DoMove, this);

            parentRtf = transform.parent as RectTransform;
        }
Пример #4
0
        /// <summary>
        ///     重置 Agent
        /// </summary>
        public void Reset()
        {
            if (!gameObject.activeSelf)
            {
                gameObject.SetActive(true);
            }

            _flockTweenerManager.Reset();
            _flockTweenerManager = new FlockTweenerManager();



            // 透明度调整
            if (GetComponent <Image>().color != new Color(255, 255, 255, 255))
            {
                GetComponent <Image>().color = new Color(255, 255, 255, 255);
            }

            // 设置 scale
            Vector3 scale = new Vector3(1, 1, 1);

            if (GetComponent <RectTransform>().localScale != scale)
            {
                GetComponent <RectTransform>().localScale = scale;
            }

            GetComponent <RectTransform>().anchoredPosition   = Vector2.zero;
            GetComponent <RectTransform>().anchoredPosition3D = Vector3.zero;
            GetComponent <RectTransform>().sizeDelta          = new Vector2(300, 300);

            GetComponent <Image>().sprite = null;
            isCreateSuccess = false;
            CanEffected     = true;
            _oriVector2     = Vector2.zero;
            _nextVector2    = Vector2.zero;

            _flockStatus = FlockStatusEnum.PREPARED;
        }