mirror of
				https://github.com/DerTyp7/fps-citybuild-unity.git
				synced 2025-10-31 13:17:07 +01:00 
			
		
		
		
	Interactable Class
This commit is contained in:
		| @@ -0,0 +1,51 @@ | ||||
| using UnityEngine; | ||||
| using System.Collections; | ||||
|  | ||||
|  | ||||
| namespace TMPro.Examples | ||||
| { | ||||
|      | ||||
|     public class ShaderPropAnimator : MonoBehaviour | ||||
|     { | ||||
|  | ||||
|         private Renderer m_Renderer; | ||||
|         private Material m_Material; | ||||
|  | ||||
|         public AnimationCurve GlowCurve; | ||||
|  | ||||
|         public float m_frame; | ||||
|  | ||||
|         void Awake() | ||||
|         { | ||||
|             // Cache a reference to object's renderer | ||||
|             m_Renderer = GetComponent<Renderer>(); | ||||
|  | ||||
|             // Cache a reference to object's material and create an instance by doing so. | ||||
|             m_Material = m_Renderer.material; | ||||
|         } | ||||
|  | ||||
|         void Start() | ||||
|         { | ||||
|             StartCoroutine(AnimateProperties()); | ||||
|         } | ||||
|  | ||||
|         IEnumerator AnimateProperties() | ||||
|         { | ||||
|             //float lightAngle; | ||||
|             float glowPower; | ||||
|             m_frame = Random.Range(0f, 1f); | ||||
|  | ||||
|             while (true) | ||||
|             { | ||||
|                 //lightAngle = (m_Material.GetFloat(ShaderPropertyIDs.ID_LightAngle) + Time.deltaTime) % 6.2831853f; | ||||
|                 //m_Material.SetFloat(ShaderPropertyIDs.ID_LightAngle, lightAngle); | ||||
|  | ||||
|                 glowPower = GlowCurve.Evaluate(m_frame); | ||||
|                 m_Material.SetFloat(ShaderUtilities.ID_GlowPower, glowPower); | ||||
|  | ||||
|                 m_frame += Time.deltaTime * Random.Range(0.2f, 0.3f); | ||||
|                 yield return new WaitForEndOfFrame(); | ||||
|             } | ||||
|         } | ||||
|     } | ||||
| } | ||||
		Reference in New Issue
	
	Block a user
	 DerTyp187
					DerTyp187