refactor modules

This commit is contained in:
2023-03-22 17:03:55 +01:00
parent 52cf3a7fbd
commit 128ab216d2
503 changed files with 1835 additions and 379 deletions

View File

@@ -0,0 +1,36 @@
using System;
using UnityEngine;
namespace Station46.Runtime.Puzzle_B
{
/// <summary>
/// The rotator component used by the hexagon module.
/// </summary>
[RequireComponent(typeof(Emission))]
public class Rotator : MonoBehaviour
{
[Tooltip("The angle this rotator should rotate towards.")]
[Range(0, 359)]
public int angle;
[Tooltip("How quickly to rotate towards the target 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);
}
}
}
}