Example #1
0
        private void OnCursorDown()
        {
            SelectInfo sInfo = TowerManager.GetSelectInfo(Input.mousePosition);

            bool select = false;
            bool build  = false;

            if (sInfo.HasValidPoint())
            {
                if (sInfo.GetTower() != null)
                {
                    select = true;
                    SelectControl.SelectUnit(sInfo.GetTower());
                    UITowerSelect.Show(sInfo.GetTower());
                }
                else if (buildMode == _BuildMode.PointNBuild && sInfo.AvailableForBuild())
                {
                    build = true;
                    UIBuildButton.Show(sInfo);
                    SelectControl.SelectNode(sInfo.platform, sInfo.nodeID);
                }
            }

            if (buildMode == _BuildMode.PointNBuild && !build)
            {
                SelectControl.ClearNode();
                UIBuildButton.Hide();
            }
            if (!select)
            {
                SelectControl.ClearUnit();
                UITowerSelect.Hide();
            }
        }
Example #2
0
        public static void ShowSampleTower(int prefabID, SelectInfo sInfo)
        {
            int idx = -1;

            for (int i = 0; i < instance.sampleList.Count; i++)
            {
                if (instance.sampleList[i].prefabID == prefabID)
                {
                    idx = i; break;
                }
            }

            instance.sampleList[idx].GetT().rotation = sInfo.GetRot();
            instance.sampleList[idx].GetT().position = sInfo.GetPos();
            instance.sampleList[idx].GetObj().SetActive(true);
            instance.activeSampleTowerIdx = idx;

            SelectControl.SelectUnit(instance.sampleList[idx]);
        }
Example #3
0
        public static UnitTower CreateDragNDropTower(UnitTower prefab)
        {
            if (instance.dndTower != null)
            {
                Destroy(instance.dndTower.gameObject);
            }

            GameObject obj = (GameObject)Instantiate(prefab.gameObject, new Vector3(0, 999, 0), Quaternion.identity);

            instance.dndTower           = obj.GetComponent <UnitTower>();
            instance.dndTower.isPreview = true;

            SelectControl.SelectUnit(instance.dndTower);

            dndCooldown    = Time.unscaledTime;
            dndInstanceID += 1;

            return(instance.dndTower);
        }