add time based street light, fix directional room entrance
This commit is contained in:
@@ -1070,6 +1070,7 @@ GameObject:
|
|||||||
- component: {fileID: 410087041}
|
- component: {fileID: 410087041}
|
||||||
- component: {fileID: 410087040}
|
- component: {fileID: 410087040}
|
||||||
- component: {fileID: 410087042}
|
- component: {fileID: 410087042}
|
||||||
|
- component: {fileID: 410087043}
|
||||||
m_Layer: 0
|
m_Layer: 0
|
||||||
m_Name: Directional Light
|
m_Name: Directional Light
|
||||||
m_TagString: Untagged
|
m_TagString: Untagged
|
||||||
@@ -1186,6 +1187,20 @@ MonoBehaviour:
|
|||||||
m_ShadowLayerMask: 1
|
m_ShadowLayerMask: 1
|
||||||
m_RenderingLayers: 1
|
m_RenderingLayers: 1
|
||||||
m_ShadowRenderingLayers: 1
|
m_ShadowRenderingLayers: 1
|
||||||
|
--- !u!114 &410087043
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 410087039}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 1df4995bc2c404c47986a4f90cf3ca4f, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier: Assembly-CSharp::SunRotation
|
||||||
|
directionalLight: {fileID: 0}
|
||||||
|
offset: 270
|
||||||
--- !u!1 &430850200
|
--- !u!1 &430850200
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@@ -2838,7 +2853,7 @@ MonoBehaviour:
|
|||||||
m_Script: {fileID: 11500000, guid: 1b892c02d92dd70419f61cf0ae34b9d8, type: 3}
|
m_Script: {fileID: 11500000, guid: 1b892c02d92dd70419f61cf0ae34b9d8, type: 3}
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier: Assembly-CSharp::TimeManager
|
m_EditorClassIdentifier: Assembly-CSharp::TimeManager
|
||||||
TEST_TEXT_BOX: {fileID: 0}
|
currentHour: 12
|
||||||
--- !u!1 &986462055
|
--- !u!1 &986462055
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ public class TimeManager : MonoBehaviour
|
|||||||
private const int MINUTES_PER_HOUR = 60;
|
private const int MINUTES_PER_HOUR = 60;
|
||||||
public const int SECONDS_PER_MINUTE = 2;
|
public const int SECONDS_PER_MINUTE = 2;
|
||||||
|
|
||||||
|
[SerializeField]
|
||||||
private int currentHour = 12;
|
private int currentHour = 12;
|
||||||
private int currentMinute = 0;
|
private int currentMinute = 0;
|
||||||
private float currentSecond = 0;
|
private float currentSecond = 0;
|
||||||
|
|||||||
@@ -123,16 +123,6 @@ public void WalkInDirection(Vector3 direction)
|
|||||||
{
|
{
|
||||||
Vector3 forwardDir = direction;
|
Vector3 forwardDir = direction;
|
||||||
forwardDir.y = 0; // don't move on the y axis
|
forwardDir.y = 0; // don't move on the y axis
|
||||||
|
|
||||||
if (cameraController != null)
|
|
||||||
{
|
|
||||||
// re-matrix the rotation direction so movement is consistent no matter what
|
|
||||||
// the camera rotation is
|
|
||||||
|
|
||||||
Matrix4x4 matrix = Matrix4x4.Rotate(Quaternion.Euler(0, cameraController.playerCamHome.rotation.eulerAngles.y, 0));
|
|
||||||
forwardDir = matrix.MultiplyPoint3x4(forwardDir);
|
|
||||||
}
|
|
||||||
|
|
||||||
forwardDir *= walkSpeed;
|
forwardDir *= walkSpeed;
|
||||||
|
|
||||||
characterController.Move(forwardDir * Time.deltaTime);
|
characterController.Move(forwardDir * Time.deltaTime);
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
public class SunRotation : MonoBehaviour
|
public class SunRotation : MonoBehaviour
|
||||||
{
|
{
|
||||||
public Light directionalLight;
|
Light directionalLight;
|
||||||
public float offset = 270f; // Adjust for sunrise/sunset timing
|
public float offset = 270f; // Adjust for sunrise/sunset timing
|
||||||
|
|
||||||
void Start()
|
void Start()
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
using System;
|
||||||
|
using System.Linq;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
public class Streetlight : MonoBehaviour
|
||||||
|
{
|
||||||
|
// Hours that the light starts and ends
|
||||||
|
public int[] activeHours = { 18, 19, 20, 21, 22, 23, 0, 1, 2, 3, 4, 5, 6 };
|
||||||
|
|
||||||
|
Light objectLight;
|
||||||
|
private float lightIntensity;
|
||||||
|
|
||||||
|
void Start()
|
||||||
|
{
|
||||||
|
objectLight = GetComponent<Light>();
|
||||||
|
lightIntensity = objectLight.intensity;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update is called once per frame
|
||||||
|
void Update()
|
||||||
|
{
|
||||||
|
if (activeHours.Contains(GameManager.Instance.TimeManager.GetCurrentHour()))
|
||||||
|
{
|
||||||
|
objectLight.intensity = lightIntensity;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
objectLight.intensity = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 67529f5a831c7b240bc979c3bd269016
|
||||||
Reference in New Issue
Block a user