04.07.2022

This commit is contained in:
Plotnikov
2022-07-04 13:15:35 +03:00
parent 5fad2bcf6b
commit 696daa0b2e
7224 changed files with 3814576 additions and 0 deletions

View File

@@ -0,0 +1,67 @@
//using System.Diagnostics;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
//using Debug = UnityEngine.Debug;
public class Handle2 : MonoBehaviour, IPointerDownHandler
{
public GameObject handle_on;
public GameObject handle_off;
// Start is called before the first frame update
void Start()
{
handle_off.SetActive(true);
handle_on.SetActive(false);
}
// Update is called once per frame
//void Update()
//{
/* Vector2 CurMousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
if (Input.GetMouseButtonUp(0))
{
//Для работы Raycast необходимо, чтоб объект имел компонент Collider
//В rayHit мы занесем результат выполнения команды Raycast
//там будет либо null, если raycast никого не задел, либо первый
//объект, стоящий на пути мышки (какой объект будет первым
//решает его положение Z в мировом пространстве)
RaycastHit2D rayHit = Physics2D.Raycast(CurMousePos, Vector2.zero);
if (rayHit.transform !=null)
{
Debug.Log("Selected object: "+ rayHit.transform.name);
// handle_on.SetActive(true);
}
} */
//}
public void OnPointerDown(PointerEventData eventData)
{
Vector2 CurMousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
RaycastHit2D rayHit = Physics2D.Raycast(CurMousePos, Vector2.zero);
if (rayHit.transform !=null)
{
Debug.Log("Selected object: "+ rayHit.transform.name);
}
}
/* void OnMouseDown()
{
print("handle_off click");
handle_off.SetActive(false);
handle_on.SetActive(true);
} */
}