private void SetSelectedWaypoint(CellData cellData) { Metrics.WaypointVisuals(false); WaypointManagerData waypointManager = null; bool isValidPlacement = false; if (selectedObstacle != null) { waypointManager = (WaypointManagerData)selectedObstacle.GetExtension(PStrings.waypointManager); } else if (selectedItem != null) { waypointManager = (WaypointManagerData)selectedItem.GetExtension(PStrings.waypointManager); } else if (selectedEntity != null) { waypointManager = (WaypointManagerData)selectedEntity.GetExtension(PStrings.waypointManager); } if (waypointManager == null) { return; } if (inputMode == InputMode.Constructive) { selectedWaypoint = waypointManager.GetWaypointAt(cellData); if (selectedWaypoint == null) { if (selectedObstacle != null) { isValidPlacement = selectedObstacle.Validation(cellData, activeDirection); } else if (selectedItem != null) { isValidPlacement = selectedItem.Validation(cellData); } else if (selectedEntity != null) { isValidPlacement = selectedEntity.Validation(cellData); } if (isValidPlacement == true) { selectedWaypoint = WaypointData.Instantiate(cellData, waypointManager); } } else { editorUI.SetSelectWaypoint(); } if (selectedWaypoint != null) { editorUI.waypointSelectionUI.SetUIBasedOn(waypointManager, selectedWaypoint); } } else if (inputMode == InputMode.Destructive) { WaypointData.Destroy(cellData, waypointManager); } }
private void CreateAt(CellData cell) { if (creationMode == CreationMode.Null) { ////////////////////////////////////////////////////////////////////////////////////// /// This should never happen but if it does nothing should be created or destroyed /// ////////////////////////////////////////////////////////////////////////////////////// } else if (creationMode == CreationMode.Foundation) { if (inputMode == InputMode.Null) { ////////////////////////////////////////////////////////////////////////////////////// /// This should never happen but if it does nothing should be created or destroyed /// ////////////////////////////////////////////////////////////////////////////////////// } else if (inputMode == InputMode.Constructive) { if (activeFoundation.Validation(cell) == false) { return; } if (editMesh == true) { GridData.InstantiateFoundation(activeFoundation, cell); } if (editMaterial == true) { cell.foundation.materialIndex = activeMegaMaterial; } if (editColor == true) { cell.foundation.colorIndex = activeColor; } if (editElevation == true) { cell.elevation = activeElevation; } string activeID = cell.foundation.instructionSetID; if (activeID == PStrings.pit || activeID == PStrings.pitGrate) { cell.foundation.effectColorIndex = (int)ColI.Red; } else if (activeID == PStrings.pool || activeID == PStrings.poolGrate) { cell.foundation.effectColorIndex = (int)ColI.Blue; } else if (activeID == PStrings.groundGrass) { cell.foundation.effectColorIndex = (int)ColI.Green; } } else if (inputMode == InputMode.Destructive) { if (editMesh == true) { GridData.InstantiateFoundation(defaultFoundation, cell); } if (editMaterial == true) { cell.foundation.materialIndex = defaultMegaMaterial; } if (editColor == true) { cell.foundation.colorIndex = defaultMegaColor; } if (editElevation == true) { cell.elevation = defaultElevation; } } } else if (creationMode == CreationMode.Structure) { if (inputMode == InputMode.Null) { ////////////////////////////////////////////////////////////////////////////////////// /// This should never happen but if it does nothing should be created or destroyed /// ////////////////////////////////////////////////////////////////////////////////////// } else if (inputMode == InputMode.Constructive) { if (activeStructure.Validation(cell) == false) { return; } if (editMesh == true) { GridData.InstantiateStructure(activeStructure, cell); } if (editMaterial == true) { cell.structure.materialIndex = activeMegaMaterial; } if (editColor == true) { cell.structure.colorIndex = activeColor; } if (editElevation == true) { cell.elevation = activeElevation; } } else if (inputMode == InputMode.Destructive) { if (editMesh == true) { GridData.InstantiateStructure(null, cell); } if (editElevation == true) { cell.elevation = defaultElevation; } if (cell.structure == null) { return; } if (editMaterial == true) { cell.structure.materialIndex = defaultMegaMaterial; } if (editColor == true) { cell.structure.colorIndex = defaultMegaColor; } } } else if (creationMode == CreationMode.Ceiling) { if (inputMode == InputMode.Null) { ////////////////////////////////////////////////////////////////////////////////////// /// This should never happen but if it does nothing should be created or destroyed /// ////////////////////////////////////////////////////////////////////////////////////// } else if (inputMode == InputMode.Constructive) { if (activeCeiling.Validation(cell) == false) { return; } if (editMesh == true) { GridData.InstantiateCeiling(activeCeiling, cell); } if (editMaterial == true) { cell.ceiling.materialIndex = activeMegaMaterial; } if (editColor == true) { cell.ceiling.colorIndex = activeColor; } if (editElevation == true) { cell.elevation = activeElevation; } } else if (inputMode == InputMode.Destructive) { if (editMesh == true) { GridData.InstantiateCeiling(null, cell); } if (editElevation == true) { cell.elevation = defaultElevation; } if (cell.ceiling == null) { return; } if (editMaterial == true) { cell.ceiling.materialIndex = defaultMegaMaterial; } if (editColor == true) { cell.ceiling.colorIndex = defaultMegaColor; } } } else if (creationMode == CreationMode.Obstacle) { if (inputMode == InputMode.Null) { ////////////////////////////////////////////////////////////////////////////////////// /// This should never happen but if it does nothing should be created or destroyed /// ////////////////////////////////////////////////////////////////////////////////////// } else if (inputMode == InputMode.Constructive) { if (activeObstacle.Validation(cell, activeDirection) == false) { return; } Metrics.uniqueID++; ObstacleData.Instantiate(activeObstacle, cell, activeDirection, Metrics.uniqueID); } else if (inputMode == InputMode.Destructive) { ObstacleData.Instantiate(null, cell, activeDirection, -1); } } else if (creationMode == CreationMode.Item) { if (inputMode == InputMode.Null) { ////////////////////////////////////////////////////////////////////////////////////// /// This should never happen but if it does nothing should be created or destroyed /// ////////////////////////////////////////////////////////////////////////////////////// } else if (inputMode == InputMode.Constructive) { if (activeItem.Validation(cell) == false) { return; } Metrics.uniqueID++; ItemData.Instantiate(activeItem, cell, Metrics.uniqueID); } else if (inputMode == InputMode.Destructive) { ItemData.Instantiate(null, cell, -1); } } else if (creationMode == CreationMode.Entity) { if (inputMode == InputMode.Null) { ////////////////////////////////////////////////////////////////////////////////////// /// This should never happen but if it does nothing should be created or destroyed /// ////////////////////////////////////////////////////////////////////////////////////// } else if (inputMode == InputMode.Constructive) { if (activeEntity.Validation(cell) == false) { return; } Metrics.uniqueID++; EntityData.Instantiate(activeEntity, cell, activeDirection, Metrics.uniqueID); } else if (inputMode == InputMode.Destructive) { EntityData.Instantiate(null, cell, activeDirection, -1); } } }