コード例 #1
0
                private void SpawnEditorPreviewCreep(GameObject prefab)
                {
                    var go = WaveEditorHelper.BuildBareMeshCopy(prefab);

                    go.name = AddPreviewSuffix(go.name);

                    go.transform.position = new Vector3(SpawnPosition.x, go.transform.position.y, SpawnPosition.z);

                    _PreviewObjects.Add(go);
                    SaveCurrentSpawnData();
                }
コード例 #2
0
                private void SetupSpawnPreview()
                {
                    if (!_PreviewRendered)
                    {
                        foreach (var datapoint in _Context._SelectedSpawn.SpawnData)
                        {
                            var preview = WaveEditorHelper.BuildBareMeshCopy(_CreepPrefabs.Single(x => x.name == datapoint.CreepIdentifier));
                            preview.name = AddPreviewSuffix(preview.name);

                            var spawntransform = _Context._Spawnpoint.transform;

                            var relativecreeppos = spawntransform.TransformPoint(datapoint.RelativePosition);

                            preview.transform.position = relativecreeppos;

                            _PreviewObjects.Add(preview);
                        }

                        _PreviewRendered = true;
                    }
                }
コード例 #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);
            });
        }