Пример #1
0
        public void Show(BuildPlace buildPlace, List <ConstructData> constructDataList)
        {
            if (InputMouse.longTapAbleSelected == buildPlace)
            {
                return;
            }

            // if (InputMouse.longTapAbleSelected != null)
            //     InputMouse.ClearSelection();

            // InputMouse.longTapAbleSelected = buildPlace;
            _buildPlace = buildPlace;

            gameObject.SetActive(true);
            Vector3 newPos = (Vector2)buildPlace.transform.position;

            newPos.z           -= 1;
            _transform.position = newPos;

            _transform.localScale = Vector3.zero;
            float scaleTime = 0.1f;

            LeanTween.scale(gameObject, Vector3.one, scaleTime);

            for (int i = 0; i < constructDataList.Count; i++)
            {
                ConstructionWheelSlot slot = GameObject.Instantiate(SlotPrefab, transform).GetComponent <ConstructionWheelSlot>();
                slot.Init(constructDataList[i]);
                slot.Button.onClick.AddListener(() => Build(slot));
                SlotsList.Add(slot);
            }

            LeanTween.delayedCall(scaleTime, ActivateSlots);
        }
Пример #2
0
        void Build(ConstructionWheelSlot slot)
        {
            Hide();

            GameObject go = Instantiate(slot.BuildingPrefab);

            go.transform.position = _buildPlace.transform.position;

            Destroy(_buildPlace.gameObject);
        }