You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
931 B
C#
35 lines
931 B
C#
3 weeks ago
|
using System;
|
||
|
using Unity.BossRoom.Utils;
|
||
|
using UnityEngine;
|
||
|
|
||
|
namespace Unity.BossRoom.Gameplay.UI
|
||
|
{
|
||
|
public class ClickFeedbackLerper : MonoBehaviour
|
||
|
{
|
||
|
PositionLerper m_PositionLerper;
|
||
|
|
||
|
Vector3 m_TargetPosition;
|
||
|
|
||
|
// The amount of offset to keep the click feedback object from intersecting with the floor
|
||
|
const float k_HoverHeight = 0.15f;
|
||
|
const float k_LerpTime = 0.04f;
|
||
|
|
||
|
void Start()
|
||
|
{
|
||
|
m_PositionLerper = new PositionLerper(Vector3.zero, k_LerpTime);
|
||
|
}
|
||
|
|
||
|
void Update()
|
||
|
{
|
||
|
transform.position = m_PositionLerper.LerpPosition(transform.position, m_TargetPosition);
|
||
|
}
|
||
|
|
||
|
public void SetTarget(Vector3 clientInputPosition)
|
||
|
{
|
||
|
m_TargetPosition.x = clientInputPosition.x;
|
||
|
m_TargetPosition.y = k_HoverHeight;
|
||
|
m_TargetPosition.z = clientInputPosition.z;
|
||
|
}
|
||
|
}
|
||
|
}
|