public void Redo(ILevelEditorUndo undo)
 {
     if (LevelEditorWorld.TryGetObject(targetInstanceId, out var target))
     {
         undo.LevelEditor.ObjectManager.DeleteObject(target, false);
     }
 }
Esempio n. 2
0
 public override void OnModeLateUpdate()
 {
     if (Input.GetButtonDown(selectAction) && CanSelectObject())
     {
         GameObject go = LevelEditorWorld.Raycast(LevelEditor.LevelEditorCamera.CameraComponent.ScreenPointToRay(Input.MousePosition));
         Selection.SetSelection(go != null ? go.GetComponent <ILevelEditorObject>() : null);
     }
 }
Esempio n. 3
0
        public T[] GetObjects <T>() where T : Object
        {
            if (objects == null || objects.Length == 0)
            {
                return(Array.Empty <T>());
            }

            return(LevelEditorWorld.TryGetObjects(objects, out T[] value) ? value : Array.Empty <T>());
        }
Esempio n. 4
0
        public Object GetObject(Type type)
        {
            if (objects == null || objects.Length == 0)
            {
                return(null);
            }

            return(LevelEditorWorld.TryGetObject(objects[0], type, out Object value) ? value : null);
        }
Esempio n. 5
0
        public void OnPooled()
        {
            LevelEditorWorld.RemoveObject(this);

            for (int i = 0; i < poolables.Length; i++)
            {
                poolables[i].OnLevelEditorPooled();
            }
        }
Esempio n. 6
0
        public bool TryGetObject(out ILevelEditorObject value)
        {
            if (objects == null || objects.Length == 0)
            {
                value = null;
                return(false);
            }

            return(LevelEditorWorld.TryGetObject(objects[0], out value));
        }
Esempio n. 7
0
        public bool TryGetObject <T>(Type type, out T value) where T : Object
        {
            if (objects == null || objects.Length == 0)
            {
                value = null;
                return(false);
            }

            return(LevelEditorWorld.TryGetObject(objects[0], out value));
        }
 public void Redo(ILevelEditorUndo undo)
 {
     if (LevelEditorWorld.TryGetObject(objects, out ILevelEditorObject target))
     {
         Transform targetTransform = target.MyGameObject.transform;
         targetTransform.position    = toPositions;
         targetTransform.eulerAngles = toRotations;
         targetTransform.localScale  = toScales;
     }
 }
        public void Show(Type type, bool sceneObject)
        {
            if (sceneObject)
            {
                List <UnityObject> allObjects = new List <UnityObject>(LevelEditorWorld.GetObjects(type));
                allObjects.Insert(0, null);

                listView.SetItems(allObjects);
            }

            Show(true);
        }
 public void Redo(ILevelEditorUndo undo)
 {
     for (int i = 0; i < objects.Length; i++)
     {
         if (LevelEditorWorld.TryGetObject(objects[i], out ILevelEditorObject target))
         {
             Transform targetTransform = target.MyGameObject.transform;
             targetTransform.position    = toPositions[i];
             targetTransform.eulerAngles = toRotations[i];
             targetTransform.localScale  = toScales[i];
         }
     }
 }
Esempio n. 11
0
        public void OnUnPooled()
        {
            LevelEditorWorld.AddObject(this);

            if (originalValues != null)
            {
                for (int i = 0; i < originalValues.Length; i++)
                {
                    exposedComponents[i].ApplyWrapper(originalValues[i], true);
                }
            }

            for (int i = 0; i < poolables.Length; i++)
            {
                poolables[i].OnLevelEditorUnpooled();
            }
        }