public void PlaceObject(IPlacedObject objectToPlace, Vector3 mousePosition, bool checksEnabled = true, ILevelElement levelElement = null, bool cloneObject = true) { if (objectToPlace == null) { return; } if (checksEnabled) { bool containsLevelElement = objectInformationModule.CheckIfLevelTilesContainsLevelElements(objectToPlace, mousePosition); if (containsLevelElement) { return; } if (objectToPlace.Type == PrefabType.PLAYER) { bool playerExists = objectInformationModule.CheckIfPlayerExists(); if (playerExists) { return; } } } if (objectToPlace.Type == PrefabType.LEVELELEMENT) { PlaceLevelElement(mousePosition, objectToPlace, levelElement, cloneObject); } else { PlaceNonLevelElement(mousePosition, objectToPlace, cloneObject); } }
public void OnSaveLevelSelection() { SwitchState(null); bool playerExists = objectInformationModule.CheckIfPlayerExists(); bool winConditionCanBeSatisfied = objectInformationModule.CheckIfEndZoneOrEnemyExists(inScenePlacedObjects); if (!playerExists || !winConditionCanBeSatisfied) { return; } levelDataManager.SavePlacedObjects(inScenePlacedObjects, level); levelController.SetLevelDataCollection(levelDataManager.GetLevelDataCollection()); levelController.SaveLevel(true); }