2021-06-25 22:58:25 +00:00
|
|
|
|
using SanAndreasUnity.Importing.RenderWareStream;
|
2021-06-25 12:37:24 +00:00
|
|
|
|
using SanAndreasUnity.Utilities;
|
2021-04-17 22:07:49 +00:00
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
|
|
namespace SanAndreasUnity.Behaviours.World
|
|
|
|
|
{
|
|
|
|
|
public class LightSource : MonoBehaviour
|
|
|
|
|
{
|
|
|
|
|
public TwoDEffect.Light LightInfo { get; private set; }
|
|
|
|
|
|
|
|
|
|
public static LightSource Create(
|
|
|
|
|
Transform parent,
|
|
|
|
|
TwoDEffect.Light lightInfo)
|
|
|
|
|
{
|
2021-06-25 12:37:24 +00:00
|
|
|
|
var go = Instantiate(Cell.Instance.lightSourcePrefab, parent);
|
|
|
|
|
go.transform.localPosition = lightInfo.Position;
|
|
|
|
|
go.transform.localScale = Vector3.one * lightInfo.CoronaSize * Cell.Instance.lightScaleMultiplier;
|
|
|
|
|
|
|
|
|
|
var lightSource = go.GetComponentOrThrow<LightSource>();
|
|
|
|
|
lightSource.LightInfo = lightInfo;
|
|
|
|
|
|
|
|
|
|
var spriteRenderer = go.GetComponentOrThrow<SpriteRenderer>();
|
|
|
|
|
spriteRenderer.color = lightInfo.Color;
|
|
|
|
|
|
|
|
|
|
return lightSource;
|
|
|
|
|
}
|
2021-04-17 22:07:49 +00:00
|
|
|
|
}
|
|
|
|
|
}
|