57 lines
2.0 KiB
C#
57 lines
2.0 KiB
C#
using DG.Tweening;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
/*******************************************************************************
|
|
*Create By CG
|
|
*Function
|
|
*******************************************************************************/
|
|
namespace Test
|
|
{
|
|
public class Test : MonoBehaviour
|
|
{
|
|
private void Start()
|
|
{
|
|
float cur = 205.0f;
|
|
DOTween.To(() => cur, x => cur = x, 202.0f, 1.0f).OnUpdate(()=> {
|
|
Debug.Log(cur);
|
|
});
|
|
}
|
|
|
|
private void Update()
|
|
{
|
|
if (Input.GetMouseButton(0))
|
|
{
|
|
Ray rayOrigin = Camera.main.ScreenPointToRay(Input.mousePosition);
|
|
RaycastHit cast;
|
|
Debug.DrawRay(rayOrigin.origin, rayOrigin.direction, Color.red, 1.0f);
|
|
if (Physics.Raycast(rayOrigin,out cast))
|
|
{
|
|
Debug.Log("ÉäÏßÓëBoxÏཻ");
|
|
}
|
|
|
|
|
|
//Vector3 mousePos3 = Camera.main.ScreenToWorldPoint(Input.mousePosition);
|
|
//Vector2 mousePos2 = new Vector2(mousePos3.x, mousePos3.y);
|
|
//Debug.DrawRay(mousePos2, Vector3.zero, Color.red, 1.0f);
|
|
//RaycastHit2D hit = Physics2D.Raycast(Camera.main.ScreenToWorldPoint(Input.mousePosition), Vector2.zero);
|
|
|
|
//if (hit.collider != null)
|
|
//{
|
|
// Debug.Log("Target Position: " + hit.collider.gameObject.transform.position);
|
|
// //and do what you want
|
|
//}
|
|
|
|
|
|
//Ray rayOrigin = Camera.main.ScreenPointToRay(Input.mousePosition);
|
|
|
|
//Debug.DrawRay(Camera.main.(Input.mousePosition), Vector3.forward,Color.red,1.0f);
|
|
//RaycastHit2D castHit = Physics2D.Raycast(Input.mousePosition, Vector3.forward, Mathf.Infinity);
|
|
//if (castHit.collider != null)
|
|
//{
|
|
// Debug.Log("ÉäÏßÓëBoxÏཻ");
|
|
//}
|
|
}
|
|
}
|
|
}
|
|
} |