forked from zxl/Frame
1
0
Fork 0
Frame/Assets/Scripts/Test.cs

81 lines
2.3 KiB
C#

using System;
using Sirenix.OdinInspector;
using UnityEngine;
using UnityEngine.SceneManagement;
namespace Game
{
public class Test : MonoBehaviour
{
// public Transform tr;
private void Update()
{
if (Input.GetKeyDown(KeyCode.A))
{
// var go = Game.resourceManager.LoadGameObjectSync(@"player");
// // var go = ResourceManager.Instance.LoadGameObject_MMM(@"hh");
// go.name = "123";
}
if (Input.GetKeyDown(KeyCode.D))
{
//
// ResourceManager.Instance.Release("hh");
//
// CommonHelper.FindChildDeep<Image>(tr, "imag");
// Debug.Log("找到此组件l");
//
// ResourceManager.Instance.LoadSceneAsync("Game", LoadSceneMode.Additive);
//
// EventManager.Instance.FireNow(this, new LoadingGameSceneFinishEventArgs(true));
//
//var value = this.GetType().ToString().Split(".");
// Debug.Log(value[^1]);
//
// var values = Enum.GetValues(typeof(ProcedureType));
// foreach (var value in values)
// {
// UnityEngine.Debug.Log( value.ToString());
// }
}
RaycastHit2D hit = Physics2D.Raycast(Input.mousePosition, Vector2.up);
// If it hits something...
if (hit.collider != null)
{
Debug.Log($"碰撞的是 {hit.collider.name} 鼠标的点在 {hit.point}");
}
Debug.Log(hit.point);
}
private void OnMouseDown()
{
Debug.Log("123");
}
public Transform room_RightUp;
public Transform room_LeftDown;
public Transform room_Pos;
[Button]
public Vector2 GetJoinPosition()
{
var vector2 = this.room_RightUp.position - this.room_LeftDown.position;
Vector2 vec = new Vector2(UnityEngine.Random.Range(0, vector2.x), UnityEngine.Random.Range(0, vector2.y));
vec += (Vector2)this.room_LeftDown.position;
this.room_Pos.position = vec;
return vec;
}
}
}