mirror of
https://github.com/GTA-ASM/SanAndreasUnity
synced 2024-11-26 05:50:18 +00:00
28 lines
932 B
C#
28 lines
932 B
C#
using SanAndreasUnity.Importing.RenderWareStream;
|
|
using SanAndreasUnity.Utilities;
|
|
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)
|
|
{
|
|
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;
|
|
}
|
|
}
|
|
}
|