Ejemplo n.º 1
0
    public void AddLevel()
    {
        EnemyLevel enemyLevel = ScriptableObject.CreateInstance <EnemyLevel>();

        ScriptableObjects.Add(enemyLevel, this);
        levels.Add(enemyLevel);
    }
Ejemplo n.º 2
0
    public void AddLevel()
    {
        ItemLevel itemLevel = ScriptableObject.CreateInstance <ItemLevel>();

        ScriptableObjects.Add(itemLevel, this);
        levels.Add(itemLevel);
    }
Ejemplo n.º 3
0
    public void AddLevel()
    {
        HeroLevel heroLevel = ScriptableObject.CreateInstance <HeroLevel>();

        ScriptableObjects.Add(heroLevel, this);
        levels.Add(heroLevel);
    }
Ejemplo n.º 4
0
    public void ShowStageDefinitions(Vector3 position)
    {
        HideStageDefinitions();
        int count = _selectedStageSet.stageDefinitions.Count;

        Add(_stages = new Layout("StageDefinitionButtons", 4, 1 * (count + 1), 0.25f, 0.1f, count + 1, container));
        _stages.SetPosition(position + (Vector3.left * (stageSets.width - 0.5f)) + (Vector3.back * ((count * 0.5f) + (0.25f * 0.5f))));
        _stages.Add(new List <RenameableDeletableButton>(RenameableDeletableButton.GetButtons(count, (int index) => new RenameableDeletableButton(GetStageDefinition(index).name, 4, 1, container,
                                                                                                                                                  fontSize: 20,
                                                                                                                                                  DeleteStay: (Button b) =>
        {
            if (Input.GetMouseButtonUp(0))
            {
                _selectedStageSet.Remove(GetStageDefinition(index));
                ShowStageDefinitions(position);
            }
        },
                                                                                                                                                  EndInput: (Field field) =>
        {
            GetStageDefinition(index).name = field.label.text;
            field.SetColor(Color.white);
        },
                                                                                                                                                  Enter: (Button button) => button.SetColor(Color.green),
                                                                                                                                                  Stay: (Button button) =>
        {
            if (_selectedStageSet != null && Input.GetMouseButtonDown(0))
            {
                selectedStageDefinition = GetStageDefinition(index);

                HideStageSets();
                HideStageDefinitions();
                HideStage();

                SetStageDefinition(selectedStageDefinition);
                _editor.testButton.Enable();
                _editor.testButton.Show();
                ShowStage();

                ShowStageSets();
                ShowStageEditor();
                ShowMissionTimeline();
                ShowMissionEditor();
            }
        },
                                                                                                                                                  Exit: (Button button) => button.SetColor(Color.white)))));

        _stages.Add(new Button("Add Stage\nDefinition", 4, 1, container, "AddStageDefinition",
                               fontSize: 20,
                               Enter: (Button button) => button.SetColor(Color.green),
                               Stay: (Button button) =>
        {
            if (_selectedStageSet != null && Input.GetMouseButtonDown(0))
            {
                ScriptableObjects.Add(StageDefinition.Default(), _selectedStageSet);
                ShowStageDefinitions(position);
            }
        },
                               Exit: (Button button) => button.SetColor(Color.white)), true);
    }
Ejemplo n.º 5
0
    private void ShowConnectorAndTerminal(int index, RenameableDeletableButton button)
    {
        Button connector = new Button("+", 0.5f, 0.5f, container, "Connector+",
                                      Enter: (Button butt) => butt.SetColor(butt.selected ? butt.color : Color.green),
                                      Stay: (Button butt) =>
        {
            if (Input.GetMouseButtonDown(0))
            {
                butt.Select();
                butt.SetColor(Color.yellow);
                _selectedConnectorIndex = index;
                _dummyContainer         = new GameObject("DummyContainer");
                _dummyConnector         = GameObject.CreatePrimitive(PrimitiveType.Quad);
                _dummyConnector.transform.SetParent(_dummyContainer.transform);
                _dummyConnector.transform.localPosition += Vector3.up * 0.5f;
                _dummyContainer.transform.position       = butt.position + Vector3.up;
            }
        },
                                      Exit: (Button butt) => butt.SetColor(butt.selected ? butt.color : Color.white),
                                      Close: (Button butt) =>
        {
            if (Input.GetMouseButtonUp(0))
            {
                butt.Deselect();
                butt.SetColor(Color.white);

                if (_dummyContainer != null)
                {
                    butt.Deselect();
                    GameObject.Destroy(_dummyContainer);
                    _dummyContainer = null;
                    _dummyConnector = null;
                }
            }
        });

        Button terminator = new Button("-", 0.5f, 0.5f, container, "Terminator-",
                                       Enter: (Button butt) => butt.SetColor(_selectedConnectorIndex >= 0 ? Color.yellow : Color.green),
                                       Stay: (Button butt) =>
        {
            if (_selectedConnectorIndex >= 0 && _selectedConnectorIndex != index && Input.GetMouseButtonUp(0))
            {
                ScriptableObjects.Add(ScriptableObject.CreateInstance <Connection>().Initialize(_selectedConnectorIndex, index), selectedCampaign);
                _selectedConnectorIndex = -1;
                butt.SetColor(Color.white);
                ShowConnections();
            }
        },
                                       Exit: (Button butt) => butt.SetColor(Color.white));

        Add(connector);
        Add(terminator);
        _connectorsAndTerminators.Add(connector);
        _connectorsAndTerminators.Add(terminator);

        connector.SetPosition(new Vector3(button.rect.xMax + 0.25f, button.position.y, button.rect.center.y));
        terminator.SetPosition(new Vector3(button.rect.xMin - 0.25f, button.position.y, button.rect.center.y));
    }
Ejemplo n.º 6
0
    public void ShowCampaigns(int index, Vector3 position)
    {
        HideCampaigns();
        int count = selectedCampaignSet.campaignDefinitions.Count;

        Add(_campaigns = new Layout("CampaignLayout", 4, count + 1, 0.25f, 0.1f, count + 1, container));
        _campaigns.SetPosition(position + (Vector3.left * (campaignSets.width - 0.5f)) + (Vector3.back * ((_campaigns.height * 0.5f) - 0.5f)));

        _campaigns.Add(new List <RenameableDeletableButton>(
                           RenameableDeletableButton.GetButtons(count,
                                                                (int capturedIndex) => new RenameableDeletableButton(GetCampaign(capturedIndex).name, 4, 1, container,
                                                                                                                     fontSize: 20,
                                                                                                                     DeleteStay: (Button button) =>
        {
            if (Input.GetMouseButtonUp(0))
            {
                selectedCampaignSet.Remove(GetCampaign(index));
                ShowCampaigns(index, position);
                ShowCampaignSets();
            }
        },
                                                                                                                     EndInput: (Field field) =>
        {
            GetCampaign(capturedIndex).name = field.label.text;
            field.SetColor(Color.white);
        },
                                                                                                                     Enter: (Button button) => button.SetColor(Color.green),
                                                                                                                     Stay: (Button button) =>
        {
            if (Input.GetMouseButtonDown(0))
            {
                selectedCampaign = GetCampaign(capturedIndex);

                HideCampaigns();
                HideCampaignSets();

                ShowCampaignMap();
                ShowCampaignSets();
                ShowCampaignEditor();
            }
        },
                                                                                                                     Exit: (Button button) => button.SetColor(Color.white)))));

        _campaigns.Add(new Button("New Campaign", 4, 1, container, "NewCampaign",
                                  fontSize: 20,
                                  Enter: (Button button) => button.SetColor(Color.green),
                                  Stay: (Button button) =>
        {
            if (Input.GetMouseButtonDown(0))
            {
                ScriptableObjects.Add(CampaignDefinition.Default(), selectedCampaignSet);
                ShowCampaigns(index, position);
            }
        },
                                  Exit: (Button button) => button.SetColor(Color.white)), true);
    }
Ejemplo n.º 7
0
    private void ShowWaveDefinitions(Vector3 position, float width = 4, float height = 1, float padding = 0.25f, float spacing = 0.1f)
    {
        HideWaveDefinitions();
        int count = selectedWaveSet.waveDefinitions.Count;

        Add(_waveDefinitionLayout = new Layout("WaveDefinitionButtons", width, height * (count + 1), padding, spacing, count + 1, container));
        _waveDefinitionLayout.SetPosition(position + (Vector3.right * width) + (Vector3.back * ((count * 0.5f) + (0.25f * 0.5f))));

        _waveDefinitionLayout.Add(new List <RenameableDeletableButton>(RenameableDeletableButton.GetButtons(count, (int index) => new RenameableDeletableButton(GetWaveDefinition(index).name, width, height, container,
                                                                                                                                                                fontSize: 20,
                                                                                                                                                                DeleteStay: (Button b) =>
        {
            if (Input.GetMouseButtonUp(0))
            {
                selectedWaveSet.Remove(GetWaveDefinition(index));
                ShowWaveDefinitions(position);
            }
        },
                                                                                                                                                                EndInput: (Field field) =>
        {
            GetWaveDefinition(index).name = field.label.text;
            field.SetColor(Color.white);
        },
                                                                                                                                                                Enter: (Button button) => button.SetColor(Color.green),
                                                                                                                                                                Stay: (Button button) =>
        {
            if (selectedWaveSet != null && Input.GetMouseButtonDown(0))
            {
                selectedWaveDefinition = selectedWaveSet.waveDefinitions[index];
                AddWaveToTimeline(selectedWaveDefinition, _editor.timelineEditor.timelinePosition);
                ShowWaveEventButtons();
                HideWaveDefinitions();
                HideWaveSets();
            }
        },
                                                                                                                                                                Exit: (Button button) => button.SetColor(Color.white)))));

        _waveDefinitionLayout.Add(new Button("Add Wave\nDefinition", width, height, container, "AddWaveDefinition",
                                             fontSize: 20,
                                             Enter: (Button button) => button.SetColor(Color.green),
                                             Stay: (Button button) =>
        {
            if (selectedWaveSet != null && Input.GetMouseButtonDown(0))
            {
                ScriptableObjects.Add(ScriptableObject.CreateInstance <WaveDefinition>(), selectedWaveSet);
                HideWaveDefinitions();
                ShowWaveDefinitions(position);
            }
        },
                                             Exit: (Button button) => button.SetColor(Color.white)), true);
    }
Ejemplo n.º 8
0
    private void HandleLaneHover()
    {
        if (timelineEditor.heldWave == null && stage != null && (conveyor == null || !conveyor.showing) && waveEditor.selectedWaveDefinition != null && waveEditor.waveSets == null && waveEditor.waveEventEditor == null)
        {
            Lane hoveredLane = stage.GetHoveredLane(mousePos);
            stage.SetLaneColor(Color.black);

            if (hoveredLane != null)
            {
                hoveredLane.color = Color.yellow;
                int laneIndex = stage.IndexOf(hoveredLane);

                if (Input.GetMouseButtonDown(0) && laneIndex >= 0 && waveEditor.waveEventLayouts.Count > laneIndex && !waveEditor.waveEventLayouts[laneIndex].containsMouse)
                {
                    int index = stage.IndexOf(hoveredLane);
                    WaveEventDefinition waveEventDefinition = ScriptableObject.CreateInstance <WaveEventDefinition>();
                    waveEventDefinition.Initialize(0, index, WaveEvent.Type.SpawnEnemy, 0, Helpers.Normalize(mousePos.x, hoveredLane.width, hoveredLane.start.x));
                    ScriptableObjects.Add(waveEventDefinition, waveEditor.selectedWaveDefinition);
                    waveEditor.HideWaveEventButtons();
                    waveEditor.ShowWaveEventButtons();
                }
            }

            if (waveEditor.heldWaveEvent != null)
            {
                waveEditor.heldWaveEvent.SetPosition(mousePos);

                if (Input.GetMouseButtonUp(0))
                {
                    if (hoveredLane != null)
                    {
                        waveEditor.heldWaveEvent.waveEventDefinition.SetLane(stage.IndexOf(hoveredLane));
                        waveEditor.heldWaveEvent.waveEventDefinition.entryPoint = Helpers.Normalize(mousePos.x, hoveredLane.end.x, hoveredLane.start.x);
                        waveEditor.HideWaveEventButtons();
                        waveEditor.ShowWaveEventButtons();
                    }

                    waveEditor.heldWaveEvent.Destroy();
                    waveEditor.heldWaveEvent = null;
                }
            }
        }
    }
Ejemplo n.º 9
0
    private void ShowWaveSets(float width = 4, float height = 1, float padding = 0.25f, float spacing = 0.1f)
    {
        HideWaveSets();
        int count = _editor.waveData.waveSets.Count;

        Add(waveSets = new Layout("WaveSetButtons", width, height * (count + 1), padding, spacing, count + 1, container));
        waveSets.SetLocalPosition(_editor.timelineEditor.indicatorPosition + (Vector3.back * (height * count * 0.5f)) + Vector3.up);
        waveSets.Add(new List <RenameableDeletableButton>(RenameableDeletableButton.GetButtons(count, (int index) => new RenameableDeletableButton(GetWaveSet(index).name, width, height, container,
                                                                                                                                                   fontSize: 20,
                                                                                                                                                   DeleteStay: (Button b) =>
        {
            if (Input.GetMouseButtonUp(0))
            {
                if (b.selected)
                {
                    HideWaveDefinitions();
                }

                _editor.waveData.Remove(GetWaveSet(index));
                ShowWaveSets();
            }
        },
                                                                                                                                                   EndInput: (Field field) =>
        {
            GetWaveSet(index).name = field.label.text;
            field.SetColor(Color.white);
        },
                                                                                                                                                   Enter: (Button button) => button.SetColor(selectedWaveSet == GetWaveSet(index) ? button.color : Color.green),
                                                                                                                                                   Stay: (Button button) =>
        {
            if (Input.GetMouseButtonDown(0))
            {
                button.Select();
                button.SetColor(Color.yellow);
                selectedWaveSet = GetWaveSet(index);

                HideWaveDefinitions();
                ShowWaveDefinitions(button.position);
            }
        },
                                                                                                                                                   Exit: (Button button) => button.SetColor(selectedWaveSet == _editor.waveData.waveSets[index] ? button.color : Color.white)))));

        waveSets.Add(new Button("Add Wave Set", width, height, container, "AddWaveSet",
                                fontSize: 20,
                                Enter: (Button button) => button.SetColor(Color.green),
                                Stay: (Button button) =>
        {
            if (Input.GetMouseButtonDown(0))
            {
                ScriptableObjects.Add(ScriptableObject.CreateInstance <WaveSet>(), _editor.waveData);
                Refresh();
            }
        },
                                Exit: (Button button) => button.SetColor(Color.white),
                                Close: (Button button) =>
        {
            if (Input.GetMouseButtonDown(0) && !waveSets.containsMouse && (_waveDefinitionLayout == null || !_waveDefinitionLayout.containsMouse))
            {
                button.SetColor(Color.white);
                HideWaveDefinitions();
                HideWaveSets();
            }
        }), true);
    }
Ejemplo n.º 10
0
    public void ShowStageSets()
    {
        HideStageSets();
        int count = _editor.stageData.stageSets.Count;

        Add(stageSets = new Layout("StageSetButtons", 4, (count + 2), 0.25f, 0.1f, count + 2, container));

        stageSets.SetViewportPosition(new Vector2(1, 1));
        stageSets.SetPosition(stageSets.position + (Vector3.left * stageSets.width) + Vector3.up + (Vector3.back * 0.5f));

        stageSets.Add(new List <RenameableDeletableButton>(RenameableDeletableButton.GetButtons(count, (int index) => new RenameableDeletableButton(GetStageSet(index).name, 4, 1, container,
                                                                                                                                                    fontSize: 20,
                                                                                                                                                    DeleteStay: (Button b) =>
        {
            if (Input.GetMouseButtonUp(0))
            {
                if (b.selected)
                {
                    HideStageDefinitions();
                }

                _editor.stageData.Remove(GetStageSet(index));
                ShowStageSets();
            }
        },
                                                                                                                                                    EndInput: (Field field) =>
        {
            GetStageSet(index).name = field.label.text;
            field.SetColor(Color.white);
        },
                                                                                                                                                    Enter: (Button button) => button.SetColor(_stages != null && _selectedStageSet == GetStageSet(index) ? button.color : Color.green),
                                                                                                                                                    Stay: (Button button) =>
        {
            if (Input.GetMouseButtonDown(0))
            {
                _selectedStageSet = GetStageSet(index);
                ShowStageDefinitions(button.position);
                button.SetColor(Color.yellow);
                button.Select();
            }
        },
                                                                                                                                                    Exit: (Button button) => button.SetColor(_stages != null && _selectedStageSet == GetStageSet(index) ? button.color : Color.white),
                                                                                                                                                    Close: (Button button) =>
        {
            if (button.selected && Input.GetMouseButtonDown(0) && (_stages == null || !_stages.containsMouse))
            {
                HideStageDefinitions();
                button.Deselect();
                _selectedStageSet = null;
                button.SetColor(Color.white);
            }
        }))));

        stageSets.Add(new Button("Add Stage Set", 4, 1, container, "AddStageSet",
                                 fontSize: 20,
                                 Enter: (Button button) => button.SetColor(Color.green),
                                 Stay: (Button button) =>
        {
            if (Input.GetMouseButtonDown(0))
            {
                ScriptableObjects.Add(ScriptableObject.CreateInstance <StageSet>(), _editor.stageData);

                if (selectedStageDefinition != null)
                {
                    ShowStageEditor();
                }

                ShowStageSets();
                _editor.missionEditor.ShowMissionEditor();
            }
        },
                                 Exit: (Button button) => button.SetColor(Color.white)));

        stageSets.Add(new Button("Back to Campaign", 4, 1, container, "BackToCampaign", fontSize: 20,
                                 Enter: (Button button) => button.SetColor(Color.green),
                                 Stay: (Button button) =>
        {
            if (Input.GetMouseButtonDown(0))
            {
                _selectedStageSet       = null;
                selectedStageDefinition = null;
                _editor.missionEditor.SetSelectedMission(null);
                _editor.missionEditor.SetSelectedMissionSet(null);

                _editor.testButton.Disable();
                _editor.testButton.Hide();
                _editor.waveEditor.Hide();
                _editor.stageEditor.Hide();
                _editor.missionEditor.Hide();
                _editor.timelineEditor.Hide();
                _editor.missionEditor.HideMissionEditor();
                _editor.timelineEditor.HideMissionTimeline();

                _editor.campaignEditor.ShowCampaignSets();
                _editor.campaignEditor.ShowCampaignEditor();
                _editor.campaignMapEditor.ShowCampaignMap();
            }
        },
                                 Exit: (Button button) => button.SetColor(Color.white)), true);
    }
Ejemplo n.º 11
0
    public void ShowMissionSets(int index, Vector3 position)
    {
        HideMissionSets();
        int count = _editor.campaignData.missionSets.Count;

        Add(missionSets = new Layout("MissionSets", 4, count + 1, 0.25f, 0.1f, count + 1, container));
        missionSets.SetPosition(position + (Vector3.right * missionSets.width * 0.5f) + (Vector3.back * missionSets.height * 0.5f));

        missionSets.Add(new List <RenameableDeletableButton>(RenameableDeletableButton.GetButtons(count,
                                                                                                  (int capturedIndex) => new RenameableDeletableButton(_editor.campaignData.missionSets[capturedIndex].name, 3, 1, container,
                                                                                                                                                       fontSize: 20,
                                                                                                                                                       DeleteStay: (Button button) =>
        {
            if (Input.GetMouseButtonUp(0))
            {
                if (button.selected)
                {
                    HideMissions();
                }

                _editor.campaignData.Remove(GetMissionSet(capturedIndex));
                ShowMissionSets(index, position);
            }
        },
                                                                                                                                                       EndInput: (Field field) =>
        {
            GetMissionSet(capturedIndex).name = field.label.text;
            ShowMissionSets(index, position);
        },
                                                                                                                                                       Enter: (Button button) => button.SetColor(selectedMissionSet == GetMissionSet(capturedIndex) ? button.color : Color.green),
                                                                                                                                                       Stay: (Button button) =>
        {
            if (Input.GetMouseButtonDown(0))
            {
                button.SetColor(Color.yellow);
                selectedMissionSet = GetMissionSet(capturedIndex);
                ShowMissions(index, button.position + new Vector3(missionSets.width * 0.5f, 0, button.height * 0.5f));
            }
        },
                                                                                                                                                       Exit: (Button button) => button.SetColor(selectedMissionSet == GetMissionSet(capturedIndex) ? button.color : Color.white),
                                                                                                                                                       Close: (Button button) =>
        {
            if (Input.GetMouseButtonDown(0) && selectedMissionSet == GetMissionSet(capturedIndex) && missions != null && !missions.containsMouse)
            {
                HideMissions();
                selectedMissionSet = null;
                button.SetColor(Color.white);
            }
        }))));

        missionSets.Add(new Button("New Set", 4, 1, container, "NewMissionSet",
                                   fontSize: 20,
                                   Enter: (Button button) => button.SetColor(Color.green),
                                   Stay: (Button button) =>
        {
            if (Input.GetMouseButtonDown(0))
            {
                HideMissions();
                ScriptableObjects.Add(ScriptableObject.CreateInstance <MissionSet>(), _editor.campaignData);
                ShowMissionSets(index, position);
            }
        },
                                   Exit: (Button button) => button.SetColor(Color.white)), true);
    }
Ejemplo n.º 12
0
    public void ShowCampaignSets()
    {
        HideCampaignSets();
        int count = _editor.campaignData.campaignSets.Count;

        Add(campaignSets = new Layout("CampaignSets", 4, count + 1, 0.25f, 0.1f, count + 1, container));

        campaignSets.SetViewportPosition(new Vector2(1, 1));
        campaignSets.SetPosition(campaignSets.position + Vector3.up + (Vector3.left * campaignSets.width) + (Vector3.back * 0.5f));

        campaignSets.Add(new List <RenameableDeletableButton>(
                             RenameableDeletableButton.GetButtons(count,
                                                                  (int index) => new RenameableDeletableButton(GetCampaignSet(index).name, 4, 1, container,
                                                                                                               fontSize: 20,
                                                                                                               DeleteStay: ( Button button ) =>
        {
            if (Input.GetMouseButtonUp(0))
            {
                if (button.selected)
                {
                    HideCampaigns();
                }

                _editor.campaignData.Remove(GetCampaignSet(index));
                ShowCampaignSets();
            }
        },
                                                                                                               EndInput: (Field field) =>
        {
            GetCampaignSet(index).name = field.label.text;
            field.SetColor(Color.white);
        },
                                                                                                               Enter: (Button button) => button.SetColor(_campaigns != null && selectedCampaignSet == GetCampaignSet(index) ? button.color : Color.green),
                                                                                                               Stay: (Button button) =>
        {
            if (Input.GetMouseButtonDown(0))
            {
                selectedCampaignSet = GetCampaignSet(index);
                ShowCampaigns(index, button.position);
                button.SetColor(Color.yellow);
                button.Select();
            }
        },
                                                                                                               Exit: (Button button) => button.SetColor(_campaigns != null && selectedCampaignSet == GetCampaignSet(index) ? button.color : Color.white),
                                                                                                               Close: (Button button) =>
        {
            if (button.selected && Input.GetMouseButtonDown(0) && (_campaigns == null || !_campaigns.containsMouse))
            {
                HideCampaigns();
                button.Deselect();
                selectedCampaignSet = null;
                button.SetColor(Color.white);
            }
        })
                                                                  )));

        campaignSets.Add(new Button("New Set", 4, 1, container, "NewCampaignSet",
                                    fontSize: 20,
                                    Enter: (Button button) => button.SetColor(Color.green),
                                    Stay: (Button button) =>
        {
            if (Input.GetMouseButtonDown(0))
            {
                HideCampaigns();
                ScriptableObjects.Add(ScriptableObject.CreateInstance <CampaignSet>(), _editor.campaignData);
                ShowCampaignSets();

                if (selectedCampaign != null)
                {
                    ShowCampaignEditor();
                }
            }
        },
                                    Exit: (Button button) => button.SetColor(Color.white)), true);
    }
Ejemplo n.º 13
0
    public Editor(Player player, GameObject parent) : base("Editor", parent)
    {
        session = new Session(new Player());
        session.Hide();

        waveData     = Assets.Get(Assets.WaveDataSets.Default);
        stageData    = Assets.Get(Assets.StageDataSets.Default);
        objectData   = Assets.Get(Assets.ObjectDataSets.Default);
        campaignData = Assets.Get(Assets.CampaignDataSets.Default);

        if (waveData == null)
        {
            waveData = Assets.Create <WaveData>(Assets.waveDataPath);
        }

        if (stageData == null)
        {
            stageData = Assets.Create <StageData>(Assets.stageDataPath);
        }

        if (campaignData == null)
        {
            campaignData = Assets.Create <CampaignData>(Assets.campaignDataPath);
        }

        if (objectData == null)
        {
            objectData = Assets.Create <ObjectData>(Assets.objectDataPath);
        }

        if (objectData.enemySets.Count == 0)
        {
            ScriptableObjects.Add(ScriptableObject.CreateInstance <EnemySet>(), objectData);
        }

        if (objectData.itemSets.Count == 0)
        {
            ScriptableObjects.Add(ScriptableObject.CreateInstance <ItemSet>(), objectData);
        }

        if (objectData.heroSets.Count == 0)
        {
            ScriptableObjects.Add(ScriptableObject.CreateInstance <HeroSet>(), objectData);
        }

        for (int i = objectData.enemySets[(int)Assets.ObjectDataSets.Default].enemyDefinitions.Count; (int)Definitions.Enemies.Count > i; i++)
        {
            ScriptableObjects.Add(ScriptableObject.CreateInstance <EnemyDefinition>().Initialize(((Definitions.Enemies)i).ToString(), 2, 1, (Definitions.Enemies)i), objectData.enemySets[(int)Assets.ObjectDataSets.Default]);
        }

        for (int i = objectData.heroSets[(int)Assets.ObjectDataSets.Default].heroDefinitions.Count; (int)Definitions.Heroes.Count > i; i++)
        {
            ScriptableObjects.Add(ScriptableObject.CreateInstance <HeroDefinition>().Initialize(((Definitions.Heroes)i).ToString(), 2, 1, (Definitions.Heroes)i), objectData.heroSets[(int)Assets.ObjectDataSets.Default]);
        }

        for (int i = objectData.itemSets[(int)Assets.ObjectDataSets.Default].itemDefinitions.Count; (int)Definitions.Items.Count > i; i++)
        {
            ScriptableObjects.Add(ScriptableObject.CreateInstance <ItemDefinition>().Initialize(((Definitions.Items)i).ToString(), 2, 1, (Definitions.Items)i), objectData.itemSets[(int)Assets.ObjectDataSets.Default]);
        }

        Definitions.Initialize(objectData);

        Add(testButton = new Button("Test", 1.5f, 0.5f, container, "Test",
                                    fontSize: 20,
                                    Enter: (Button button) => button.SetColor(stage != null && missionEditor.selectedMission != null ? Color.green : button.color),
                                    Stay: (Button button) =>
        {
            if (stage != null && missionEditor.selectedMission != null && Input.GetMouseButtonDown(0))
            {
                if (level == null)
                {
                    stage.conveyor.Show();
                    session.SetLevel(new Level(missionEditor.selectedMission.duration, showProgress: false));

                    for (int i = 0; missionEditor.selectedMission.waveDefinitions.Count > i; i++)
                    {
                        Wave wave = new Wave(missionEditor.selectedMission.waveTimes[i] * missionEditor.selectedMission.duration, stage);
                        level.Add(wave);

                        for (int j = 0; missionEditor.selectedMission.waveDefinitions[i].waveEvents.Count > j; j++)
                        {
                            switch ((WaveEvent.Type)missionEditor.selectedMission.waveDefinitions[i].waveEvents[j].type)
                            {
                            case WaveEvent.Type.SpawnEnemy:
                                wave.Add(new SpawnEnemyEvent(Definitions.Enemy((Definitions.Enemies)missionEditor.selectedMission.waveDefinitions[i].waveEvents[j].subType), missionEditor.selectedMission.waveDefinitions[i].waveEvents[j]));
                                break;
                            }
                        }
                    }

                    button.SetLabel("Stop");
                    button.SetPosition(saveButton.position);

                    saveButton.Hide();
                    saveButton.Disable();
                    objectsButton.Hide();
                    campaignButton.Hide();
                    stageEditor.HideStageSets();
                    stageEditor.HideStageEditor();
                    stageEditor.HideStageDefinitions();
                    missionEditor.HideMissionEditor();
                    waveEditor.HideWaveEventButtons();
                    session.Start();
                }
                else
                {
                    session.Stop();
                    stage.ClearLanes();
                    conveyor.Hide();
                    conveyor.Clear();
                    button.SetLabel("Test");
                    level.DestroyProgress();
                    session.SetLevel(null);
                    _heldItem = null;
                    _itemTime = 0;

                    saveButton.Show();
                    saveButton.Enable();
                    objectsButton.Show();
                    campaignButton.Show();
                    stageEditor.ShowStageSets();
                    stageEditor.ShowStageEditor();
                    missionEditor.ShowMissionEditor();
                    testButton.SetPosition(saveButton.position + Vector3.right * (saveButton.width));

                    if (waveEditor.selectedWaveDefinition != null)
                    {
                        waveEditor.ShowWaveEventButtons();
                    }
                }
            }
        },
                                    Exit: (Button button) => button.SetColor(Color.white)));


        Add(saveButton = new Button("Save", 1.5f, 0.5f, container, "Save",
                                    fontSize: 20,
                                    Enter: (Button button) => button.SetColor(Color.green),
                                    Stay: (Button button) =>
        {
            if (Input.GetMouseButtonDown(0))
            {
                EditorUtility.SetDirty(campaignData);
                EditorUtility.SetDirty(objectData);
                EditorUtility.SetDirty(stageData);
                EditorUtility.SetDirty(waveData);
                ScriptableObjects.Save();
            }
        },
                                    Exit: (Button button) => button.SetColor(Color.white)));

        saveButton.SetViewportPosition(new Vector2(0, 1));
        saveButton.SetPosition(saveButton.position + Vector3.up);
        testButton.SetPosition(saveButton.position + Vector3.right * (saveButton.width));
        testButton.Disable();
        testButton.Hide();

        Add(campaignButton = new Button("Campaigns", 2, 0.5f, container, "CampaignsButton",
                                        fontSize: 20,
                                        Enter: (Button button) => button.SetColor(button.selected ? button.color : Color.green),
                                        Stay: (Button button) =>
        {
            if (!button.selected && Input.GetMouseButtonDown(0))
            {
                ShowCampaignEditor();
            }
        },
                                        Exit: (Button button) => button.SetColor(button.selected ? button.color : Color.white)));

        campaignButton.SetViewportPosition(new Vector2(1, 1));
        campaignButton.SetPosition(campaignButton.position + (Vector3.left * campaignButton.width) + Vector3.up);

        Add(objectsButton = new Button("Objects", 2, 0.5f, container, "ObjectsButton",
                                       fontSize: 20,
                                       Enter: (Button button) => button.SetColor(button.selected ? button.color : Color.green),
                                       Stay: (Button button) =>
        {
            if (!button.selected && Input.GetMouseButtonDown(0))
            {
                ShowObjectEditors();
            }
        },
                                       Exit: (Button button) => button.SetColor(button.selected ? button.color : Color.white)));

        objectsButton.SetPosition(campaignButton.position + Vector3.left * (objectsButton.width));

        Add(campaignMapEditor = new CampaignMapEditor(this, container));
        Add(campaignEditor    = new CampaignEditor(this, Vector3.zero, container));
        Add(timelineEditor    = new TimelineEditor(this, container));
        Add(missionEditor     = new MissionEditor(this, container));
        Add(stageEditor       = new StageEditor(this, container));
        Add(enemyEditor       = new EnemyEditor(this, container));
        Add(waveEditor        = new WaveEditor(this, container));
        Add(itemEditor        = new ItemEditor(this, container));
        Add(heroEditor        = new HeroEditor(this, container));
        ShowCampaignEditor();
    }