campfire/Assets/Scripts/CampfireFog.cs

14 lines
386 B
C#
Raw Permalink Normal View History

2020-04-20 22:44:24 +02:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CampfireFog : MonoBehaviour {
public GameObject Player;
2020-04-20 23:13:04 +02:00
public MeshRenderer FogMesh;
2020-04-20 22:44:24 +02:00
void Update() {
2020-04-20 23:13:04 +02:00
FogMesh.material.SetFloat("_Transparency", Mathf.Min(Mathf.Sqrt(Mathf.Max((transform.position - Player.transform.position).magnitude - 15, 0)) / 100, 0.15f));
2020-04-20 22:44:24 +02:00
}
}