change multiple scene system to dynamic indoor scene

This commit is contained in:
Vova
2024-05-27 08:23:54 +03:00
parent e071a29c90
commit 4a59cee5e6
109 changed files with 3740 additions and 83901 deletions
@@ -0,0 +1,44 @@
using UnityEngine;
public class BuildingManager : MonoBehaviour
{
public bool IsOpen { get; set; }
public bool IsInside { get; set; }
private string _address;
public IndoorSO Indoor;
public void BuildingInteract(IndoorSO indoor)
{
IsOpen = CheckIsOpen(indoor.OpenHoursFrom, indoor.OpenHoursTo);
if (!IsInside)
{
EnterBuilding(indoor);
}
else
{
ExitBuilding();
}
}
private void EnterBuilding(IndoorSO indoor)
{
if(IsOpen)
{
Indoor = indoor;
IsInside = true;
GameManager.Instance.Scene.Change("indoor");
}
}
public void ExitBuilding()
{
GameManager.Instance.Scene.Change("city");
}
private bool CheckIsOpen(int from, int to)
{
return GameManager.Instance.Time.CurrentTime.Hours >= from
&& GameManager.Instance.Time.CurrentTime.Hours <= to;
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: ebdd79e4ca65877429c8e85a1f0a1bf3
+3
View File
@@ -13,7 +13,9 @@ public class GameManager : MonoBehaviour
private SceneManager _sceneManager;
private TimeSystem _timeSystem;
private InGameMouseHandler _gameMouseHandler;
private BuildingManager _buildingManager;
public BuildingManager BuildingSystem => _buildingManager;
public InputSystem Input => _inputSystem;
public SceneManager Scene => _sceneManager;
public TimeSystem Time => _timeSystem;
@@ -30,6 +32,7 @@ public class GameManager : MonoBehaviour
Instance = this;
DontDestroyOnLoad(gameObject);
_buildingManager = new BuildingManager();
_inputSystem = new InputSystem();
_sceneManager = new SceneManager();
_timeSystem = new TimeSystem();
+1 -3
View File
@@ -9,10 +9,8 @@ public class SceneManager
UnityEngine.SceneManagement.SceneManager.sceneLoaded += SceneManager_sceneLoaded;
}
public void Change(string sceneName,string spawnLocationName)
public void Change(string sceneName)
{
_spawnLocationName = spawnLocationName;
UnityEngine.SceneManagement.SceneManager.LoadScene(sceneName);
}