added dissapear shader & flare removed from sun
This commit is contained in:
24
Assets/8_Scripts/2_General/DissapearShader.cs
Normal file
24
Assets/8_Scripts/2_General/DissapearShader.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class DissapearShader : MonoBehaviour
|
||||
{
|
||||
public Material m_Material;
|
||||
public float m_HeightThresholdMax;
|
||||
public float m_HeightThresholdMin;
|
||||
private float m_InitalHeight;
|
||||
void Awake(){
|
||||
m_InitalHeight = this.transform.position.y;
|
||||
Debug.Log(m_InitalHeight);
|
||||
}
|
||||
void Update(){
|
||||
float value = Mathf.Clamp( Remap(this.transform.position.y, m_HeightThresholdMin, m_HeightThresholdMax, 1, 0), 0, 1 );
|
||||
float slerpValue = Mathf.Lerp(1, 0, Mathf.SmoothStep(1, 0, value));
|
||||
m_Material.SetFloat("_DissapearValue", slerpValue);
|
||||
Debug.Log( slerpValue );
|
||||
}
|
||||
public float Remap (float value, float from1, float to1, float from2, float to2) {
|
||||
return (value - from1) / (to1 - from1) * (to2 - from2) + from2;
|
||||
}
|
||||
}
|
||||
11
Assets/8_Scripts/2_General/DissapearShader.cs.meta
generated
Normal file
11
Assets/8_Scripts/2_General/DissapearShader.cs.meta
generated
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8900da15042aca74aa6defcda76396a3
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -5,8 +5,9 @@ using UnityEngine;
|
||||
public class Rotate : MonoBehaviour
|
||||
{
|
||||
// Update is called once per frame
|
||||
public float m_Speed;
|
||||
void Update()
|
||||
{
|
||||
this.transform.Rotate(0, -Time.fixedDeltaTime / 4, 0, Space.World);
|
||||
this.transform.Rotate(0, -Time.fixedDeltaTime * m_Speed, 0, Space.World);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user