mirror of
https://github.com/GTA-ASM/SanAndreasUnity
synced 2025-02-17 05:18:27 +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)
|
foreach (var lightInfo in geometry.TwoDEffect.Lights)
|
||||||
{
|
{
|
||||||
var go = GameObject.CreatePrimitive(PrimitiveType.Cube);
|
LightSource.Create(tr, lightInfo);
|
||||||
go.transform.SetParent(tr);
|
|
||||||
go.transform.localPosition = lightInfo.Position;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue