using System.Collections; using System.Collections.Generic; using UnityEngine; public class CreateRoleHeroPlatform : MonoBehaviour { Vector3 prevScreenPosition = Vector3.zero; float allowDragTime = 0f; public void ForbidSeconds(float _seconds) { allowDragTime = Time.time + _seconds; } private void OnMouseDown() { if (Time.time < allowDragTime) { return; } prevScreenPosition = Input.mousePosition; } private void OnMouseDrag() { if (Time.time < allowDragTime) { return; } var delta = Input.mousePosition - prevScreenPosition; this.transform.localEulerAngles += new Vector3(0, -delta.x, 0); prevScreenPosition = Input.mousePosition; } private void OnMouseUp() { if (Time.time < allowDragTime) { return; } } }