change multiple scene system to dynamic indoor scene
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1aa8851f1bf646546ac965f2f963173e
|
||||
guid: 4968f85f2354996498d344d4c5f24247
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
File diff suppressed because it is too large
Load Diff
+2
-3
@@ -1,8 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b850b50568fa8244c8b801f983427ee9
|
||||
NativeFormatImporter:
|
||||
guid: 7320b55b8e7543941a3631c47acce9c3
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 23800000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -650,6 +650,7 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
_interactionPoint: {fileID: 1450117643}
|
||||
BuildingInfo: {fileID: 0}
|
||||
_scene: JobAgency
|
||||
_spawnPointInSceneName: Door
|
||||
_exitName: JobAgency
|
||||
@@ -1421,6 +1422,7 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
_interactionPoint: {fileID: 35419154}
|
||||
BuildingInfo: {fileID: 0}
|
||||
_scene: School
|
||||
_spawnPointInSceneName: Door
|
||||
_exitName: School
|
||||
@@ -2050,6 +2052,7 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
_interactionPoint: {fileID: 1595984949156300432}
|
||||
BuildingInfo: {fileID: 0}
|
||||
_scene: MiniMarket
|
||||
_spawnPointInSceneName: Door
|
||||
_exitName: MiniMarket
|
||||
@@ -2578,6 +2581,7 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
_interactionPoint: {fileID: 1959637279}
|
||||
BuildingInfo: {fileID: 11400000, guid: 3b7f8c4d01cacb9498458de9b784391f, type: 2}
|
||||
_scene: House
|
||||
_spawnPointInSceneName: Door
|
||||
_exitName: House
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,230 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!29 &1
|
||||
OcclusionCullingSettings:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 2
|
||||
m_OcclusionBakeSettings:
|
||||
smallestOccluder: 5
|
||||
smallestHole: 0.25
|
||||
backfaceThreshold: 100
|
||||
m_SceneGUID: 00000000000000000000000000000000
|
||||
m_OcclusionCullingData: {fileID: 0}
|
||||
--- !u!104 &2
|
||||
RenderSettings:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 10
|
||||
m_Fog: 0
|
||||
m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
|
||||
m_FogMode: 3
|
||||
m_FogDensity: 0.01
|
||||
m_LinearFogStart: 0
|
||||
m_LinearFogEnd: 300
|
||||
m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1}
|
||||
m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1}
|
||||
m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1}
|
||||
m_AmbientIntensity: 1
|
||||
m_AmbientMode: 0
|
||||
m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1}
|
||||
m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_HaloStrength: 0.5
|
||||
m_FlareStrength: 1
|
||||
m_FlareFadeSpeed: 3
|
||||
m_HaloTexture: {fileID: 0}
|
||||
m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0}
|
||||
m_DefaultReflectionMode: 0
|
||||
m_DefaultReflectionResolution: 128
|
||||
m_ReflectionBounces: 1
|
||||
m_ReflectionIntensity: 1
|
||||
m_CustomReflection: {fileID: 0}
|
||||
m_Sun: {fileID: 0}
|
||||
m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
m_UseRadianceAmbientProbe: 0
|
||||
--- !u!157 &3
|
||||
LightmapSettings:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 12
|
||||
m_GISettings:
|
||||
serializedVersion: 2
|
||||
m_BounceScale: 1
|
||||
m_IndirectOutputScale: 1
|
||||
m_AlbedoBoost: 1
|
||||
m_EnvironmentLightingMode: 0
|
||||
m_EnableBakedLightmaps: 1
|
||||
m_EnableRealtimeLightmaps: 0
|
||||
m_LightmapEditorSettings:
|
||||
serializedVersion: 12
|
||||
m_Resolution: 2
|
||||
m_BakeResolution: 40
|
||||
m_AtlasSize: 1024
|
||||
m_AO: 0
|
||||
m_AOMaxDistance: 1
|
||||
m_CompAOExponent: 1
|
||||
m_CompAOExponentDirect: 0
|
||||
m_ExtractAmbientOcclusion: 0
|
||||
m_Padding: 2
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_LightmapsBakeMode: 1
|
||||
m_TextureCompression: 1
|
||||
m_ReflectionCompression: 2
|
||||
m_MixedBakeMode: 2
|
||||
m_BakeBackend: 1
|
||||
m_PVRSampling: 1
|
||||
m_PVRDirectSampleCount: 32
|
||||
m_PVRSampleCount: 500
|
||||
m_PVRBounces: 2
|
||||
m_PVREnvironmentSampleCount: 500
|
||||
m_PVREnvironmentReferencePointCount: 2048
|
||||
m_PVRFilteringMode: 2
|
||||
m_PVRDenoiserTypeDirect: 0
|
||||
m_PVRDenoiserTypeIndirect: 0
|
||||
m_PVRDenoiserTypeAO: 0
|
||||
m_PVRFilterTypeDirect: 0
|
||||
m_PVRFilterTypeIndirect: 0
|
||||
m_PVRFilterTypeAO: 0
|
||||
m_PVREnvironmentMIS: 0
|
||||
m_PVRCulling: 1
|
||||
m_PVRFilteringGaussRadiusDirect: 1
|
||||
m_PVRFilteringGaussRadiusIndirect: 5
|
||||
m_PVRFilteringGaussRadiusAO: 2
|
||||
m_PVRFilteringAtrousPositionSigmaDirect: 0.5
|
||||
m_PVRFilteringAtrousPositionSigmaIndirect: 2
|
||||
m_PVRFilteringAtrousPositionSigmaAO: 1
|
||||
m_ExportTrainingData: 0
|
||||
m_TrainingDataDestination: TrainingData
|
||||
m_LightProbeSampleCountMultiplier: 4
|
||||
m_LightingDataAsset: {fileID: 0}
|
||||
m_LightingSettings: {fileID: 1709286000}
|
||||
--- !u!196 &4
|
||||
NavMeshSettings:
|
||||
serializedVersion: 2
|
||||
m_ObjectHideFlags: 0
|
||||
m_BuildSettings:
|
||||
serializedVersion: 3
|
||||
agentTypeID: 0
|
||||
agentRadius: 0.3
|
||||
agentHeight: 1.7
|
||||
agentSlope: 45
|
||||
agentClimb: 0.4
|
||||
ledgeDropHeight: 0
|
||||
maxJumpAcrossDistance: 0
|
||||
minRegionArea: 2
|
||||
manualCellSize: 0
|
||||
cellSize: 0.1
|
||||
manualTileSize: 0
|
||||
tileSize: 256
|
||||
buildHeightMesh: 0
|
||||
maxJobWorkers: 0
|
||||
preserveTilesOutsideBounds: 0
|
||||
debug:
|
||||
m_Flags: 0
|
||||
m_NavMeshData: {fileID: 0}
|
||||
--- !u!1 &650146554
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 650146556}
|
||||
- component: {fileID: 650146555}
|
||||
m_Layer: 0
|
||||
m_Name: Controller
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!114 &650146555
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 650146554}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: d1add187954d66d4594d1b192ce4a248, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!4 &650146556
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 650146554}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 139.04602, y: 10.990694, z: 228.35544}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!850595691 &1709286000
|
||||
LightingSettings:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name:
|
||||
serializedVersion: 8
|
||||
m_EnableBakedLightmaps: 1
|
||||
m_EnableRealtimeLightmaps: 0
|
||||
m_RealtimeEnvironmentLighting: 1
|
||||
m_BounceScale: 1
|
||||
m_AlbedoBoost: 1
|
||||
m_IndirectOutputScale: 1
|
||||
m_UsingShadowmask: 1
|
||||
m_BakeBackend: 1
|
||||
m_LightmapMaxSize: 1024
|
||||
m_LightmapSizeFixed: 0
|
||||
m_UseMipmapLimits: 1
|
||||
m_BakeResolution: 40
|
||||
m_Padding: 2
|
||||
m_LightmapCompression: 3
|
||||
m_AO: 0
|
||||
m_AOMaxDistance: 1
|
||||
m_CompAOExponent: 1
|
||||
m_CompAOExponentDirect: 0
|
||||
m_ExtractAO: 0
|
||||
m_MixedBakeMode: 2
|
||||
m_LightmapsBakeMode: 1
|
||||
m_FilterMode: 1
|
||||
m_LightmapParameters: {fileID: 15204, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_ExportTrainingData: 0
|
||||
m_TrainingDataDestination: TrainingData
|
||||
m_RealtimeResolution: 2
|
||||
m_ForceWhiteAlbedo: 0
|
||||
m_ForceUpdates: 0
|
||||
m_PVRCulling: 1
|
||||
m_PVRSampling: 1
|
||||
m_PVRDirectSampleCount: 32
|
||||
m_PVRSampleCount: 512
|
||||
m_PVREnvironmentSampleCount: 256
|
||||
m_PVREnvironmentReferencePointCount: 2048
|
||||
m_LightProbeSampleCountMultiplier: 4
|
||||
m_PVRBounces: 2
|
||||
m_PVRMinBounces: 2
|
||||
m_PVREnvironmentImportanceSampling: 1
|
||||
m_PVRFilteringMode: 1
|
||||
m_PVRDenoiserTypeDirect: 1
|
||||
m_PVRDenoiserTypeIndirect: 1
|
||||
m_PVRDenoiserTypeAO: 1
|
||||
m_PVRFilterTypeDirect: 0
|
||||
m_PVRFilterTypeIndirect: 0
|
||||
m_PVRFilterTypeAO: 0
|
||||
m_PVRFilteringGaussRadiusDirect: 1
|
||||
m_PVRFilteringGaussRadiusIndirect: 5
|
||||
m_PVRFilteringGaussRadiusAO: 2
|
||||
m_PVRFilteringAtrousPositionSigmaDirect: 0.5
|
||||
m_PVRFilteringAtrousPositionSigmaIndirect: 2
|
||||
m_PVRFilteringAtrousPositionSigmaAO: 1
|
||||
m_RespectSceneVisibilityWhenBakingGI: 0
|
||||
--- !u!1660057539 &9223372036854775807
|
||||
SceneRoots:
|
||||
m_ObjectHideFlags: 0
|
||||
m_Roots:
|
||||
- {fileID: 650146556}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c4ffc2ff3b0920c4894bdeeab1ceeede
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e7867055090004b45a26df89aa12576d
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,20 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 5fd44e1aaa501ac4c8f210861aa1b08c, type: 3}
|
||||
m_Name: House
|
||||
m_EditorClassIdentifier:
|
||||
BuidingName: House
|
||||
Address: House
|
||||
SpawnPointInSceneName: Door
|
||||
Prefab: {fileID: 8126641580437622147, guid: 7320b55b8e7543941a3631c47acce9c3, type: 3}
|
||||
OpenHoursFrom: 0
|
||||
OpenHoursTo: 23
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6235c156d2659c540ac9413e7b98bb8a
|
||||
guid: 3b7f8c4d01cacb9498458de9b784391f
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 23800000
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -8,7 +8,7 @@ public abstract class BaseCharacter : MonoBehaviour
|
||||
{
|
||||
[SerializeField]
|
||||
protected NavMeshAgent _navAgent;
|
||||
|
||||
public NavMeshAgent NavAgent => _navAgent;
|
||||
protected Animator _animator;
|
||||
private const string WALK_VELOCITY = "WalkVelocity";
|
||||
private readonly Queue<PlayerTasks> _tasks = new Queue<PlayerTasks>();
|
||||
|
||||
+4
-2
@@ -1,7 +1,9 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class Door : BaseInteractableObject
|
||||
public class DoorController : BaseInteractableObject
|
||||
{
|
||||
[SerializeField]
|
||||
public IndoorSO BuildingInfo;
|
||||
[SerializeField]
|
||||
private string _scene;
|
||||
[SerializeField]
|
||||
@@ -16,7 +18,7 @@ public class Door : BaseInteractableObject
|
||||
|
||||
protected override void InteractAction(RadialMenuActions interactAction)
|
||||
{
|
||||
GameManager.Instance.Scene.Change(_scene, _spawnPointInSceneName);
|
||||
GameManager.Instance.BuildingSystem.BuildingInteract(BuildingInfo);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
using Unity.AI.Navigation;
|
||||
using UnityEngine;
|
||||
|
||||
public class IndoorController : MonoBehaviour
|
||||
{
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
var indoor = GameManager.Instance.BuildingSystem.Indoor;
|
||||
Instantiate(indoor.Prefab, Vector3.zero, Quaternion.identity);
|
||||
|
||||
Player.Instance.NavAgent.Warp(SpawnPlayer(indoor));
|
||||
// If the NavMeshSurface is not assigned in the Inspector, try to find it
|
||||
var navMeshSurface = indoor.Prefab.GetComponentInChildren<NavMeshSurface>();
|
||||
Player.Instance.NavAgent.enabled = true;
|
||||
// Build the NavMesh
|
||||
if (navMeshSurface != null)
|
||||
{
|
||||
navMeshSurface.BuildNavMesh();
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogError("NavMeshSurface is not assigned and not found on the GameObject.");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private Vector3 SpawnPlayer(IndoorSO indoor)
|
||||
{
|
||||
var spawnPoints = GameObject.FindGameObjectsWithTag("Respawn");
|
||||
BaseInteractableObject interactable = null;
|
||||
if (spawnPoints != null)
|
||||
{
|
||||
foreach (var spawn in spawnPoints)
|
||||
{
|
||||
if (spawn.name.ToLower() == indoor.SpawnPointInSceneName.ToLower())
|
||||
{
|
||||
interactable = spawn.GetComponent<BaseInteractableObject>();
|
||||
Player.Instance.SetPosition(interactable._interactionPoint);
|
||||
}
|
||||
}
|
||||
}
|
||||
GameManager.Instance.Camera.ResetToPlayerPosition();
|
||||
return (interactable == null) ? Vector3.zero : interactable._interactionPoint.position;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d1add187954d66d4594d1b192ce4a248
|
||||
@@ -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
|
||||
@@ -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();
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using UnityEngine;
|
||||
|
||||
[CreateAssetMenu()]
|
||||
[CreateAssetMenu(menuName ="LifeJourney/Container")]
|
||||
public class ContainerSO : ScriptableObject
|
||||
{
|
||||
public string Name;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user