This commit is contained in:
corn
2026-06-07 22:59:32 +08:00
commit a62ff7379b
7171 changed files with 10015624 additions and 0 deletions

View File

@@ -0,0 +1,73 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Serialization;
using UnityEngine.UIElements;
public class Bolt : MonoBehaviour
{
public static Bolt instance;
public enum states
{
Null,
idle,
select,
done
}
public states boltstate;
public Transform originalTransform;
public Vector3 pos;
public List<CharacterJoint> connectedJoints;
public CharacterJoint otherObject;
public Vector3 offset;
public bool touch;
private void Awake()
{
instance = this;
}
void Start()
{
originalTransform = gameObject.transform;
pos = transform.localPosition;
//print(pos);
//boltstate = states.idle;
}
void Update()
{
}
private void OnMouseDrag()
{
if (boltstate == states.select)
{
transform.position = (Mousepos() + offset);
}
}
private void OnMouseDown()
{
if (boltstate == states.select)
{
offset = transform.position - Mousepos();
}
}
Vector3 Mousepos()
{
var mouseScreenPos = Input.mousePosition;
mouseScreenPos.z = Camera.main.WorldToScreenPoint(transform.position).z;
return Camera.main.ScreenToWorldPoint(mouseScreenPos);
}
}