mirror of
https://github.com/GTA-ASM/SanAndreasUnity
synced 2024-11-23 04:23:04 +00:00
create LightSource script
This commit is contained in:
parent
0a3a11a5e0
commit
f87eb89c63
3 changed files with 36 additions and 3 deletions
24
Assets/Scripts/Behaviours/World/LightSource.cs
Normal file
24
Assets/Scripts/Behaviours/World/LightSource.cs
Normal file
|
@ -0,0 +1,24 @@
|
|||
using SanAndreasUnity.Importing.RenderWareStream;
|
||||
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 = GameObject.CreatePrimitive(PrimitiveType.Cube);
|
||||
go.transform.SetParent(parent);
|
||||
go.transform.localPosition = lightInfo.Position;
|
||||
|
||||
var lightSource = go.AddComponent<LightSource>();
|
||||
lightSource.LightInfo = lightInfo;
|
||||
|
||||
return lightSource;
|
||||
}
|
||||
}
|
||||
}
|
11
Assets/Scripts/Behaviours/World/LightSource.cs.meta
Normal file
11
Assets/Scripts/Behaviours/World/LightSource.cs.meta
Normal file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 8b9d0e4e930be6b418ff0ddaff0600f9
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -202,9 +202,7 @@ namespace SanAndreasUnity.Behaviours.World
|
|||
{
|
||||
foreach (var lightInfo in geometry.TwoDEffect.Lights)
|
||||
{
|
||||
var go = GameObject.CreatePrimitive(PrimitiveType.Cube);
|
||||
go.transform.SetParent(tr);
|
||||
go.transform.localPosition = lightInfo.Position;
|
||||
LightSource.Create(tr, lightInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue