campfire/Assets/Scripts/CampfireFog.cs

14 lines
386 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CampfireFog : MonoBehaviour {
public GameObject Player;
public MeshRenderer FogMesh;
void Update() {
FogMesh.material.SetFloat("_Transparency", Mathf.Min(Mathf.Sqrt(Mathf.Max((transform.position - Player.transform.position).magnitude - 15, 0)) / 100, 0.15f));
}
}