private void Start() { BtnLayout.onClick.AddListener(() => { m_CurrentMode = LevelEditorMode.Layout; OnEditorModeChanged(); }); BtnStartRotation.onClick.AddListener(() => { m_CurrentMode = LevelEditorMode.Start; OnEditorModeChanged(); }); BtnSolution.onClick.AddListener(() => { m_CurrentMode = LevelEditorMode.Solution; OnEditorModeChanged(); }); BtnSave.onClick.AddListener(SaveLevel); BtnClear.onClick.AddListener(ClearLevel); PopulateGrid(); BtnLayout.interactable = false; PopulateDropdown(); LevelSelectorDropdown.onValueChanged.AddListener(delegate { OnValueSelected(LevelSelectorDropdown); }); BtnClose.onClick.AddListener(() => Destroy(gameObject)); }
private void SetCurrentMode(LevelEditorMode theNewMode) { currentMode = theNewMode; // We stop the simulation only if it is objectPlacement mode //if ( theNewMode == LevelEditorMode.ObjectPlacement ) // StopSimulation(); }
private void OnChooseSquad(GameObject go) { string text = go.name; if (text == null) { return; } chosenSquadType = TypeContainer <SquadType> .get(text); mode = LevelEditorMode.Squad; }
private void OnChooseTerrain(GameObject go) { string text = go.name; //go.GetComponent<UITooltip>().text.text; if (text == null) { return; } chosenTerrainType = TypeContainer <TerrainType> .get(text); mode = LevelEditorMode.Terrain; }
private void OnChooseProperty(GameObject go) { string text = go.name; if (text == null) { return; } chosenPropertyType = TypeContainer <PropertyType> .get(text); mode = LevelEditorMode.Property; }
public void SetMode(LevelEditorMode m) { Mode = m; switch (m) { case LevelEditorMode.Mouse: GDHUD.ModePanel.SetActiveButton(GDHUD.ModePanel.BtnMouse); break; case LevelEditorMode.AddCannon: GDHUD.ModePanel.SetActiveButton(GDHUD.ModePanel.BtnCannon); break; case LevelEditorMode.AddWall: GDHUD.ModePanel.SetActiveButton(GDHUD.ModePanel.BtnWall); break; case LevelEditorMode.AddObstacle: GDHUD.ModePanel.SetActiveButton(GDHUD.ModePanel.BtnObstacle); break; case LevelEditorMode.AddPortal: GDHUD.ModePanel.SetActiveButton(GDHUD.ModePanel.BtnPortal); break; default: SAMLog.Error("LES::EnumSwitch_TICS", "Mode = " + m); break; } }
private void OnChooseTerrain(GameObject go) { string text = go.name; //go.GetComponent<UITooltip>().text.text; if (text == null) return; chosenTerrainType = TypeContainer<TerrainType>.get( text ); mode = LevelEditorMode.Terrain; }
private void OnChooseSquad(GameObject go) { string text = go.name; if (text == null) return; chosenSquadType = TypeContainer<SquadType>.get( text ); mode = LevelEditorMode.Squad; }
private void OnChooseProperty(GameObject go) { string text = go.name; if (text == null) return; chosenPropertyType = TypeContainer<PropertyType>.get( text ); mode = LevelEditorMode.Property; }
void Update() { //Debug.Log(Camera.main.ScreenToWorldPoint(Input.mousePosition)); // Only allow map editing if the game is not simulating if (!isSimulating && mapEditMode) { // If a mouse click is detected while in edit mode if (Input.GetMouseButtonDown(0) && GUIUtility.hotControl == 0) { // We get any levelObject at the position from where the mouse is clicked LevelObject objectAtMousePosition = GetObjectAtMousePosition(); // This handles the levelObjectPlacement if (objectToSpawn != ObjectType.None && // We check if we have something to spawn CurrentMode == LevelEditorMode.PlacementMode && // We also check if the current mode is objectPlacement objectAtMousePosition == null) // Finally we check if there is an object at the current position { // If there is none, then continue the object placement HandleLevelObjectPlacement(); } // This handles the picking of level Objects for editing else if (objectAtMousePosition != null && CurrentMode == LevelEditorMode.PickToEditMode && CurrentMode != LevelEditorMode.PickToLinkMode) // If there is an object { // We open the attribute window OpenAttributeWindow(objectAtMousePosition); } // This handles the picking of level objects for linking else if (CurrentMode == LevelEditorMode.PickToLinkMode) { objectToDisplay.GetComponent <Switch>().PlaceInLinkedObjectsListAtIndex(objectAtMousePosition); CurrentMode = LevelEditorMode.EditingMode; } } // Pressing the right mouse button deletes the object at mouse position else if (Input.GetMouseButtonDown(1) && GUIUtility.hotControl == 0) { HandleLevelObjectDeletion(); } // Pressing the middle mouse button edits the object at mouse position else if (Input.GetMouseButtonDown(2) && GUIUtility.hotControl == 0) { // We get any levelObjsect at the position from where the mouse is clicked LevelObject objectAtMousePosition = GetObjectAtMousePosition(); OpenAttributeWindow(objectAtMousePosition); } } if (Registry.debugConfig.isCameraOrthographic) { return; } if (mapEditMode) { Camera.main.orthographic = true; originMarkerRenderer.enabled = true; } else { Camera.main.orthographic = false; originMarkerRenderer.enabled = false; } }
/* Sets the active editor mode */ public void SetEditorMode(LevelEditorMode mode) { currentEditorMode = mode; }