campfire/Assets/Scripts/CampfireFog.cs

14 lines
381 B
C#
Raw 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;
public Material FogMaterial;
void Update() {
FogMaterial.SetFloat("_Transparency", Mathf.Min(Mathf.Sqrt(Mathf.Max((transform.position - Player.transform.position).magnitude - 15, 0)) / 100, 0.15f));
}
}