68 lines
1.8 KiB
C#
68 lines
1.8 KiB
C#
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
|
|||
|
using System.Text;
|
|||
|
using UnityEngine;
|
|||
|
|
|||
|
namespace Thousandto.Core.Base
|
|||
|
{
|
|||
|
/// <summary>
|
|||
|
/// 每日时间分区
|
|||
|
/// </summary>
|
|||
|
public class DayTimeSpan
|
|||
|
{
|
|||
|
//类型
|
|||
|
public DayTimeSpanType TimeType;
|
|||
|
//开始时间
|
|||
|
public int StartTime;
|
|||
|
//结束时间
|
|||
|
public int EndTime;
|
|||
|
//是否有太阳
|
|||
|
public bool HaveSun;
|
|||
|
//是否有月亮
|
|||
|
public bool HaveMoon;
|
|||
|
//是否是白天的Lightmap
|
|||
|
public bool IsDayLightMap;
|
|||
|
//是否需要改变白天黑夜
|
|||
|
public bool NeedChangeDayNight;
|
|||
|
//太阳的开始位置
|
|||
|
public Vector3 SunStartPos = -Vector3.one;
|
|||
|
//太阳的结束位置
|
|||
|
public Vector3 SunEndPos = -Vector3.one;
|
|||
|
//月亮的开始位置
|
|||
|
public Vector3 MoonStartPos = -Vector3.one;
|
|||
|
//月亮的结束位置
|
|||
|
public Vector3 MoonEndPos = -Vector3.one;
|
|||
|
|
|||
|
public DayTimeSpan(int startTime, int endTime, DayTimeSpanType timeType = DayTimeSpanType.Morning)
|
|||
|
{
|
|||
|
this.StartTime = startTime;
|
|||
|
this.EndTime = endTime;
|
|||
|
this.TimeType = timeType;
|
|||
|
}
|
|||
|
|
|||
|
public void SetSunPos(Vector3 startPos, Vector3 endPos)
|
|||
|
{
|
|||
|
HaveSun = true;
|
|||
|
SunStartPos = startPos;
|
|||
|
SunEndPos = endPos;
|
|||
|
}
|
|||
|
|
|||
|
public void SetMoonPos(Vector3 startPos, Vector3 endPos)
|
|||
|
{
|
|||
|
HaveMoon = true;
|
|||
|
MoonStartPos = startPos;
|
|||
|
MoonEndPos = endPos;
|
|||
|
}
|
|||
|
|
|||
|
public DayTimeSpan FindSpanByTime(int time)
|
|||
|
{
|
|||
|
if (StartTime <= time && time <= EndTime)
|
|||
|
{
|
|||
|
return this;
|
|||
|
}
|
|||
|
return null;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|