using System.Collections; using System.Collections.Generic; using UnityEngine; public class castShadowLine : MonoBehaviour { public bool refreshEverySecond = true; public Environment environment; public GameObject startPos; public GameObject endPos; public sbyte shadowStrength = 50; // Start is called before the first frame update Vector3 oldPositionS; Vector3 oldPositionE; void Start() { // environment.addShadowLine(startPos.GetComponent().position, endPos.GetComponent().position, shadowStrength); oldPositionS = startPos.GetComponent().position; oldPositionE = endPos.GetComponent().position; } // Update is called once per frame int frame = 0; void Update() { if(refreshEverySecond&&frame%60==59) { environment.addShadowLine(oldPositionS, oldPositionE, (sbyte)(-1 * shadowStrength)); environment.addShadowLine(startPos.GetComponent().position, endPos.GetComponent().position, shadowStrength); oldPositionS = startPos.GetComponent().position; oldPositionE = endPos.GetComponent().position; } frame++; } }