align steles puzzle
This commit is contained in:
20
Assets/Station46/Modules/Steles/Scripts/AlignStele.cs
Normal file
20
Assets/Station46/Modules/Steles/Scripts/AlignStele.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using NaughtyAttributes;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Station46.Modules.Steles.Scripts
|
||||
{
|
||||
public class AlignStele : MonoBehaviour
|
||||
{
|
||||
public float speed;
|
||||
|
||||
[ShowNativeProperty] public float Displacement { get; set; }
|
||||
|
||||
private void Update()
|
||||
{
|
||||
var t = transform;
|
||||
var position = t.localPosition;
|
||||
var delta = position.y - Displacement;
|
||||
t.localPosition = new Vector3(0, position.y - delta * speed, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user