public void CreateOnlyPlanet() { StreamingAssetAccessor.Platform = RuntimePlatform.WindowsPlayer; TextManager.SetLanguage(SystemLanguage.English); ResourcesManager.Instance.Init(); if (ftuePlanetName != string.Empty) { GameManager.PARTY_TYPE = EPartyType.NEW; playingPlanetName = ftuePlanetName; PlanetSave.LoadCitizens(playingPlanetName); PlanetSave.LoadPlayer(playingPlanetName); PlanetSave.LoadPNJs(playingPlanetName); CreatePlanet(); } else if (planetName != string.Empty) { GameManager.PARTY_TYPE = EPartyType.NEW; playingPlanetName = planetName; PlanetSave.LoadCitizens(playingPlanetName); PlanetSave.LoadPlayer(playingPlanetName); PlanetSave.LoadPNJs(playingPlanetName); CreatePlanet(); } }
public void StartMainPlanet() { Events.Instance.AddListener <OnEndPlanetCreation>(OnEndCreation); FtueManager.instance.ForceClear(); PARTY_TYPE = EPartyType.NEW; EarthManager.Instance.playingPlanetName = EarthManager.Instance.planetName; PlanetSave.LoadPlayer(EarthManager.Instance.playingPlanetName); PlanetSave.LoadCitizens(EarthManager.Instance.playingPlanetName); PlanetSave.LoadPNJs(EarthManager.Instance.playingPlanetName); EarthManager.Instance.playerPositions = PlanetSave.DeserializePlayerPositions(PlanetSave.BasePlayerPos); EarthManager.Instance.CreatePlanet(); }
public void OnClickOnStartButton() { Events.Instance.AddListener <OnEndPlanetCreation>(OnEndCreation); FtueManager.instance.Display(false); FtueManager.instance.Restart(); PARTY_TYPE = EPartyType.NEW; EarthManager.Instance.playingPlanetName = EarthManager.Instance.ftuePlanetName; PlanetSave.LoadPlayer(EarthManager.Instance.playingPlanetName); PlanetSave.LoadPNJs(EarthManager.Instance.playingPlanetName); EarthManager.Instance.playerPositions = PlanetSave.DeserializePlayerPositions(PlanetSave.BasePlayerPos); EarthManager.Instance.CreatePlanet(); }
public void OnClickOnContinueButton() { PARTY_TYPE = EPartyType.SAVE; if (!FtueManager.instance.Finish) { FtueManager.instance.ForceClear(); } Events.Instance.AddListener <OnEndPlanetCreation>(OnEndCreation); InventoryPlayer.Instance.Load(); List <SavePlayerPosition> players; ArrayExtensions.ToList(PlanetSave.GameStateSave.SavedPlayers, out players); EarthManager.Instance.playerPositions = PlanetSave.DeserializePlayerPositions(players); EarthManager.Instance.playingPlanetName = EarthManager.Instance.planetName; PlanetSave.LoadPlayer(EarthManager.Instance.playingPlanetName); PlanetSave.LoadCitizens(EarthManager.Instance.playingPlanetName); PlanetSave.LoadPNJs(EarthManager.Instance.playingPlanetName); EarthManager.Instance.CreatePlanet(); }
public void LoadGameParty() { bool hasParty = PlanetSave.LoadParty(); if (hasParty) { if (PlanetSave.GameStateSave.version == VERSION) { Events.Instance.Raise(new PartyLoaded(hasParty)); } else { PlanetSave.DeleteParty(); PARTY_TYPE = EPartyType.NONE; Events.Instance.Raise(new PartyLoaded(false)); } } else { Events.Instance.Raise(new PartyLoaded(hasParty)); } }
protected IEnumerator LoadCoroutine(string sceneName, LoadSceneMode mode) { _isChangingScene = true; AsyncOperation loadingScene = SceneManager.LoadSceneAsync(sceneName, mode); while (!loadingScene.isDone) { yield return(null); } _loadedScene = (SceneString)Enum.Parse(typeof(SceneString), sceneName); if (PARTY_TYPE == EPartyType.NEW) { FtueManager.instance.Launch(); } if (EarthManager.Instance.playingPlanetName == EarthManager.Instance.planetName && !TimeManager.Instance.active) { WorldManager.Instance.InitPolution(); if (PARTY_TYPE == EPartyType.SAVE) { TimeManager.Instance.LoadSave(); } TimeManager.Instance.Active(); PlanetSave.SaveParty(); } _isChangingScene = false; Events.Instance.Raise(new SharePlayerPosition(EarthManager.Instance.playerPositions)); Events.Instance.Raise(new OnSceneLoaded(_loadedScene)); UIManager.instance.ActivePanelTransition(false); if (!_gameStarted) { _gameStarted = true; Events.Instance.Raise(new OnSwitchScene(ECameraTargetType.MAP)); } }
public void GoToMenu() { if (!FtueManager.instance.active) { PlanetSave.SaveParty(); } _gameStarted = false; UIManager.instance.Clear(); TimeManager.Instance.Stop(); LinkDatabase.Instance.Clear(); WorldManager.Instance.Clear(); ControllerInput.instance.ResetDatasTouch(); InteractablePNJ.PNJs.Clear(); ResourcesManager.Instance.Clear(); CameraManager.Instance.Reset(); InventoryPlayer.Instance.Clear(); PlayerManager.Instance.Clear(); EarthManager.Instance.DestroyPlanet(); Events.Instance.Raise(new OnGoToMenu()); StartCoroutine(LoadMainMenu()); }
protected void CreateCells(EPartyType partyType) { foreach (GroundMesh ground in planetLink.allGroundMesh) { GameObject newGo = Instantiate(_cellPrefab, Vector3.zero, Quaternion.identity, planetLink.transform); _cellsObj.Add(newGo); Cell newCell = newGo.GetComponent <Cell>(); newCell.SetID(); newCell.Init(ground); Mesh finalMesh = newCell.gameObject.GetComponent <MeshFilter>().mesh; finalMesh.vertices = ground.smoothVertex; finalMesh.triangles = ground.smoothTriangles; finalMesh.normals = ground.smoothNormals; finalMesh.uv = ground.UVs; newCell.gameObject.GetComponent <MeshCollider>().sharedMesh = finalMesh; finalMesh.RecalculateBounds(); _cells.Add(newCell); } planetLink.GenerateNeighborLinks(planetLink.GetMinimalNeighborDistance(), _cells); if (partyType == EPartyType.SAVE) { int l = _cells.Count; Cell cCell; for (int i = 0; i < l; i++) { cCell = _cells[i]; Mesh finalMesh = cCell.gameObject.GetComponent <MeshFilter>().mesh; List <SaveCell> outCells; ArrayExtensions.ToList(PlanetSave.GameStateSave.SavedCells, out outCells); SaveCell sCell = outCells.Find(c => c.ID == cCell.ID); cCell.Init(sCell); cCell.SetPolution(sCell.poluted); if (sCell.poluted) { PolutionArea.CELLS_USED.Add(cCell); } cCell.SetDeforestation(sCell.deforested); if (sCell.deforested) { DeforestationArea.CELLS_USED.Add(cCell); } UpdateNbCell(cCell.State); finalMesh.vertices = cCell.GroundMesh.smoothVertex; finalMesh.triangles = cCell.GroundMesh.smoothTriangles; finalMesh.normals = cCell.GroundMesh.smoothNormals; finalMesh.uv = cCell.GroundMesh.UVs; cCell.gameObject.GetComponent <MeshCollider>().sharedMesh = finalMesh; finalMesh.RecalculateBounds(); } } else if (partyType == EPartyType.NEW) { if (PlanetSave.LoadCells(playingPlanetName)) { foreach (Cell cCell in _cells) { Mesh finalMesh = cCell.gameObject.GetComponent <MeshFilter>().mesh; SaveCell sCell = PlanetSave.BaseCells.Find(c => c.ID == cCell.ID); cCell.Init(sCell); UpdateNbCell(cCell.State); finalMesh.vertices = cCell.GroundMesh.smoothVertex; finalMesh.triangles = cCell.GroundMesh.smoothTriangles; finalMesh.normals = cCell.GroundMesh.smoothNormals; finalMesh.uv = cCell.GroundMesh.UVs; cCell.gameObject.GetComponent <MeshCollider>().sharedMesh = finalMesh; finalMesh.RecalculateBounds(); } } } }
public void OnGUI() { if (!showButtons) { return; } if (GUI.Button(new Rect(10, 10, 50, 25), "Save")) { PlanetSave.SaveCells(EarthManager.Instance.Cells, EarthManager.Instance.playingPlanetName); } if (GUI.Button(new Rect(10, 45, 120, 25), "Save Player")) { PlanetSave.SavePlayer(EarthManager.Instance.playingPlanetName); } if (GUI.Button(new Rect(70, 10, 50, 25), "Light")) { RecalulateNormals(); } if (GUI.Button(new Rect(130, 10, 50, 25), "UVs")) { EarthManager.Instance.RecalculateUVMap(); } if (GUI.Button(new Rect(300, 10, 120, 25), "Save Pnjs")) { PlanetSave.SavePnjs(EarthManager.Instance.playingPlanetName); } if (GUI.Button(new Rect(430, 10, 120, 25), "Save Citizens")) { PlanetSave.SaveCitizens(EarthManager.Instance.playingPlanetName); } if (GUI.Button(new Rect(430, 70, 50, 25), "Load")) { EarthManager.Instance.CreateOnlyPlanet(); } float y = 100; if (_selectedCells.Count > 0) { foreach (CellState state in Enum.GetValues(typeof(CellState))) { if (GUI.Button(new Rect(10, y, 90, 25), state.ToString())) { foreach (Cell lCell in _selectedCells) { lCell.SetCellState(lCell.GroundMesh, state); } } y += 35; } biomeIDEdit = GUI.TextField(new Rect(10, y, 20, 20), biomeIDEdit, 25); bool apply = GUI.Button(new Rect(35, y, 60, 20), "Apply"); if (string.Empty != biomeIDEdit && apply) { foreach (Cell lCell in _selectedCells) { lCell.BiomeID = int.Parse(biomeIDEdit); } } if (GUI.Button(new Rect(10, y + 35, 20, 20), "X")) { _selectedCells.Clear(); _selectedCell = null; } } if (_selectedProps.Count > 0) { if (GUI.Button(new Rect(10, 100, 70, 25), "DELETE")) { foreach (Props p in _selectedProps) { Destroy(p.transform.gameObject.GetComponent <Props>()); } _selectedProp = null; _selectedProps.Clear(); } if (GUI.Button(new Rect(10, 160, 20, 20), "X") || Input.GetKeyDown(KeyCode.Q)) { _selectedProp = null; _selectedProps.Clear(); } } }