campfire/Assets/Scripts/CampfireFog.cs
2020-04-20 23:44:24 +03:00

14 lines
381 B
C#

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));
}
}