Exemplo n.º 1
0
 //transforming the temporary instance into a permanent one
 //and moving it to the desired position
 private void PlaceObject()
 {
     actualSpawner      = tempSpawner;
     actualSpawner.name = objName;
     actualSpawner.transform.position = new Vector3(xPos, yPos, zPos);
     spawner    = actualSpawner;
     valuesSync = spawner.GetComponent <ValuesSync>();
     _instance  = actualSpawner;
 }
Exemplo n.º 2
0
        private void OnEnable()
        {
            InstantiateTempObject();

            objName      = spawner.name;
            valuesSync   = spawner.GetComponent <ValuesSync>();
            valuesSyncSo = new SerializedObject(valuesSync);

            GetInstance();
            CreateList();
        }
Exemplo n.º 3
0
        private void OnGUI()
        {
            //UI positioning and fields
            scrollPosition = GUILayout.BeginScrollView(scrollPosition, false, true, GUILayout.Width(450), GUILayout.Height(245));
            //target field
            GUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Select the target spawn", EditorStyles.boldLabel);
            _generalHelp = GUILayout.Button("Need help?", EditorStyles.miniButton);
            GUILayout.EndHorizontal();
            EditorGUILayout.Space();
            EditorGUI.BeginChangeCheck();
            spawner = (GameObject)EditorGUILayout.ObjectField("Target", spawner, typeof(GameObject), true);
            EditorGUILayout.Space();
            //Gizmos color
            valuesSync.color = EditorGUILayout.ColorField("Gizmos area color", valuesSync.color);

            if (EditorGUI.EndChangeCheck())
            {
                valuesSync   = spawner.GetComponent <ValuesSync>();
                valuesSyncSo = new SerializedObject(valuesSync);
                CreateList();
                objName = spawner.name;
            }
            EditorGUILayout.Space();

            //other fields
            CreateLinkedFields();
            CreateGameObjectFields();
            GUILayout.EndScrollView();

            //buttons
            GUILayout.BeginArea(new Rect(15, 250, 400, 150));
            CreateButtons();
            GUILayout.EndArea();
            //text box
            GUILayout.BeginArea(new Rect(440, 255, 250, 150));
            InfoSpawner();
            GUILayout.EndArea();

            //updating the reorderable list
            if (valuesSyncSo != null)
            {
                valuesSyncSo.Update();
                _objectList.DoList(objectListRect);
                valuesSyncSo.ApplyModifiedProperties();
            }

            ButtonChecks();
        }
Exemplo n.º 4
0
 private void Start()
 {
     _valuesSync = GetComponent <ValuesSync>();
     StartCoroutine(StartSpawning());
 }