ZMWSLI0-SL2021-GR11/cw5/zadanie1.cs

35 lines
845 B
C#
Raw Normal View History

2021-05-20 21:16:43 +02:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class castShadow : MonoBehaviour
{
public bool refreshEverySecond = true;
public Environment environment;
public sbyte shadowStrength = 50;
Vector3 oldPosition;
void Start()
{
}
int frame = 0;
// Update is called once per frame
void Update()
{
if(frame == 2)
{
}
if(refreshEverySecond&&frame%60==0&&frame>60)
{
var newPosition = gameObject.GetComponent<Transform>().position;
if (oldPosition != newPosition)
{
environment.removeShadow(oldPosition, shadowStrength);
environment.addShadow(newPosition, shadowStrength);
}
oldPosition = newPosition;
}
frame++;
}
}