DynamicColor, Crystal prefab, Finish Puzzle B

This commit is contained in:
2022-11-28 23:31:00 +01:00
parent 60e390a993
commit 450c16c94f
63 changed files with 2915 additions and 361 deletions

View File

@@ -0,0 +1,29 @@
using System;
using UnityEngine;
namespace EscapeRoomEngine.Desert.Runtime.Puzzle_B
{
[RequireComponent(typeof(Emission))]
public class Rotator : MonoBehaviour
{
[Range(0, 359)] public int angle;
[Range(0, 1)] public float speed;
public Emission Emission { get; private set; }
private void Awake()
{
Emission = GetComponent<Emission>();
}
private void Update()
{
angle %= 360;
var angleDifference = angle - transform.localEulerAngles.y;
if (Math.Abs(angleDifference) >= 0.1)
{
transform.Rotate(0, angleDifference*Mathf.Pow(speed, 2), 0, Space.Self);
}
}
}
}