예제 #1
0
        public void RetargetList(BuildItemContainer buildingContainer)
        {
            objPlacer = GetComponent <ObjectPlacer>();
            activeKey = objPlacer.ToggleKey;
            if (BuilderMenuPrefab == null)
            {
                Debug.LogError("Missing BuilderMenuPrefab, please assign it!");
                return;
            }
            if (buildObjectList == null)
            {
                Debug.LogError("Missing buildObjectList, please assign it!");
                return;
            }

            //Transform parent = PlayerInterface.Instance.gameObject.transform;
            builderUI = Instantiate(BuilderMenuPrefab).GetComponentInChildren <IItemSelectionUI>(); //create the ui
            if (builderUI == null)
            {
                Debug.LogError("Please make sure that the UI prefab has one script that implements: IItemSlectionUI interface");
                return;
            }

            builderUI.Populatemenu(buildObjectList, this); //populate it

            if (!buildObjectList.isValid())
            {
                //Debug.LogError("Please add some some Items to list");
                return;
            }
        }
예제 #2
0
        /****************************************************
         * Unity Functions
         * *************************************************/

        // Use this for initialization
        void Start()
        {
            if (cam == null)
            {
                cam = Camera.main;
            }
            if (cam == null)
            {
                Debug.LogError("Missing Camera, please add one");
            }

            camT = cam.transform;

            //add outline component to camera if missing
            OutlineEffect of = cam.GetComponent <OutlineEffect>();

            if (of == null)
            {
                of = cam.gameObject.AddComponent <OutlineEffect>();
            }

            //set outline color if the user want to
            if (useCustomOutlineColor)
            {
                of.lineColor0 = outlineColor;
            }

            object_placer   = GetComponent <ObjectPlacer>();
            object_selector = GetComponent <ObjectSelector>();
        }
예제 #3
0
        /****************************************************
         * Initialization
         * *************************************************/

        private void Start()
        {
            objPlacer = GetComponent <ObjectPlacer>();
            activeKey = objPlacer.ToggleKey;
            if (BuilderMenuPrefab == null)
            {
                Debug.LogError("Missing BuilderMenuPrefab, please assign it!");
                return;
            }
            if (buildObjectList == null)
            {
                Debug.LogError("Missing buildObjectList, please assign it!");
                return;
            }


            builderUI = Instantiate(BuilderMenuPrefab).GetComponentInChildren <IItemSelectionUI>(); //create the ui
            if (builderUI == null)
            {
                Debug.LogError("Please make sure that the UI prefab has one script that implements: IItemSlectionUI interface");
                return;
            }

            builderUI.Populatemenu(buildObjectList, this); //populate it

            if (!buildObjectList.isValid())
            {
                Debug.LogError("Please add some some Items to list");
                return;
            }

            objPlacer.SetObjectToPlace(buildObjectList.items[0]); //use the first item as default and set it
        }