Filip Iliescu
8 年前
当前提交
ff01d44e
共有 6 个文件被更改,包括 103 次插入 和 23 次删除
-
12Assets/TestScenes/MobileDeferredTest/ClassicDeferredPipeline.asset
-
53Assets/TestScenes/MobileDeferredTest/ClassicDeferredTest.unity
-
9Assets/TestScenes/MobileDeferredTest/Scripts.meta
-
40Assets/TestScenes/MobileDeferredTest/Scripts/Sun.cs
-
12Assets/TestScenes/MobileDeferredTest/Scripts/Sun.cs.meta
|
|||
fileFormatVersion: 2 |
|||
guid: 4f9828a3db4dc4d848659b3602e34801 |
|||
folderAsset: yes |
|||
timeCreated: 1493098543 |
|||
licenseType: Pro |
|||
DefaultImporter: |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System.Collections; |
|||
using System.Collections.Generic; |
|||
using UnityEngine; |
|||
|
|||
public class Sun : MonoBehaviour { |
|||
|
|||
public Transform eyePosition; |
|||
Light sunlight; |
|||
|
|||
public Color daytimeSkyColor = new Color(0.31f, 0.88f, 1f); |
|||
public Color nighttimeSkyColor = new Color(0.04f, 0.19f, 0.27f); |
|||
|
|||
// Use this for initialization
|
|||
void Start () { |
|||
sunlight = GetComponent<Light> (); |
|||
sunlight.color = daytimeSkyColor; |
|||
} |
|||
|
|||
public float radius = 6; |
|||
public float daySeconds = 1200; |
|||
public float speed = 0.01f; |
|||
public float blend = 0.25f; |
|||
|
|||
private float timeAnim = 0; |
|||
|
|||
// Update is called once per frame
|
|||
void Update () { |
|||
|
|||
timeAnim = (timeAnim + speed * Time.deltaTime) % daySeconds; |
|||
|
|||
Vector3 midpoint = eyePosition.position; midpoint.y -= 0.5f; |
|||
float sunangle = timeAnim * 360; |
|||
|
|||
sunlight.transform.position = midpoint + Quaternion.Euler(0,0,sunangle)*(radius*Vector3.right); |
|||
sunlight.transform.LookAt (midpoint); |
|||
|
|||
sunlight.color = Color.Lerp(daytimeSkyColor, nighttimeSkyColor, timeAnim/blend); |
|||
|
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 86fb67de2496b4335bc8326f24b35f39 |
|||
timeCreated: 1493092812 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
撰写
预览
正在加载...
取消
保存
Reference in new issue