BuildDetail/BuildDetail/Assets/Scripts/MovePosition.cs
Dvurechensky 2563d86a23 1.0.0
all in
2025-05-12 12:32:24 +03:00

37 lines
982 B
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*
* Author: Nikolay Dvurechensky
* Site: https://www.dvurechensky.pro/
* Gmail: dvurechenskysoft@gmail.com
* Last Updated: 12 мая 2025 12:24:39
* Version: 1.0.
*/
using UnityEngine;
namespace Assets.Scripts
{
/// <summary>
/// Перемещение объекта в позицию X, Y, Z
/// </summary>
public class MovePosition : MonoBehaviour
{
[SerializeField] private float x;
[SerializeField] private float y;
[SerializeField] private float z;
[Space(10)]
[SerializeField] private float speedMove;
public bool EnableMove { get; set; }
private void Update()
{
if(EnableMove)
transform.position = Vector3.Lerp(transform.position, new Vector3(x, y, z), Time.deltaTime * speedMove);
}
private void OnMouseDown()
{
EnableMove = !EnableMove;
}
}
}