コード例 #1
0
                public WaveEditingScene(WaveEditorSceneContext context)
                {
                    _Context = context;

                    CreateNewButtonStyle    = _Context._EditorGUISkin.GetStyle("CreateNewButton");
                    ReturnButtonStyle       = _Context._EditorGUISkin.GetStyle("ReturnButton");
                    WaveSpawnNavButtonStyle = _Context._EditorGUISkin.GetStyle("WaveSpawnNavButton");
                    DeleteButtonStyle       = _Context._EditorGUISkin.GetStyle("DeleteButton");
                }
コード例 #2
0
                public SpawnEditingScene(WaveEditorSceneContext context)
                {
                    _Context = context;

                    _CreepPrefabs = Resources.LoadAll("CreepPrefabs").Cast <GameObject>().ToArray();

                    ReturnButtonStyle = _Context._EditorGUISkin.GetStyle("ReturnButton");
                    CreepButtonStyle  = _Context._EditorGUISkin.GetStyle("CreepButton");
                    SaveButtonStyle   = _Context._EditorGUISkin.GetStyle("SaveButton");
                    DeleteButtonStyle = _Context._EditorGUISkin.GetStyle("DeleteButton");

                    SpawnPosition = _Context._Spawnpoint.transform.position;
                }
コード例 #3
0
        public static void BeginWaveEditing(GameObject spawnpoint, WavesManager wavesmanager)
        {
            EditorSceneManager.SaveOpenScenes();

            if (spawnpoint == null)
            {
                Debug.Log("Need a spawnpoint to edit");
                return;
            }

            if (wavesmanager == null)
            {
                Debug.Log($"Must have one component <{nameof(WavesManager)}> attached");
                return;
            }

            //Pre-setup for wave editor scene.
            GameObject spawnobjectcopy = WaveEditorHelper.BuildBareMeshCopy(spawnpoint);

            spawnobjectcopy.name = "Spawn-Preview";

            spawnobjectcopy.AddComponent <ImmutableGameObject>();

            spawnobjectcopy.transform.position = spawnpoint.transform.position;
            spawnobjectcopy.transform.rotation = spawnpoint.transform.rotation;

            HideAllObjectsExcept(spawnobjectcopy);
            Selection.activeGameObject = spawnobjectcopy;
            SceneView.lastActiveSceneView.FrameSelected();

            var editorgui = new WaveEditorSceneContext(spawnobjectcopy, wavesmanager.WavesContainer, () =>
            {
                RestoreOriginalScene();
                GameObject.DestroyImmediate(spawnobjectcopy);
            });
        }