plantilla base para movimiento básico
This commit is contained in:
Robii Aragon
2026-02-05 05:07:55 -08:00
parent ed7b223c04
commit fd87a6ffd5
14441 changed files with 13711084 additions and 20 deletions

View File

@@ -0,0 +1,109 @@
using UnityEngine;
using System.Collections;
#if UNITY_EDITOR
using UnityEditor;
[CustomEditor (typeof(meleeWeaponTransformInfoSystem))]
public class meleeWeaponTransformInfoSystemEditor : Editor
{
meleeWeaponTransformInfoSystem manager;
Vector3 curretPositionHandle;
Quaternion currentRotationHandle;
void OnEnable ()
{
manager = (meleeWeaponTransformInfoSystem)target;
}
void OnSceneGUI ()
{
if (manager.showGizmo) {
if (Application.isPlaying) {
if (manager.currentWeaponObjectTransform != null) {
showPositionHandle (manager.currentWeaponObjectTransform.transform, "Edit Melee Weapon Hand Transform Values");
}
if (manager.currentWeaponMeshGameObject != null) {
showPositionHandle (manager.currentWeaponMeshGameObject.transform, "Edit Melee Weapon Mesh Transform Values");
}
}
}
}
public override void OnInspectorGUI ()
{
DrawDefaultInspector ();
EditorGUILayout.Space ();
GUILayout.Label ("EDITOR BUTTONS", EditorStyles.boldLabel);
EditorGUILayout.Space ();
if (GUILayout.Button ("Copy Transform Values")) {
manager.copyTransformValuesToBuffer ();
}
if (GUILayout.Button ("Paste Transform Values")) {
manager.pasteTransformValuesToBuffer ();
}
if (GUILayout.Button ("Clear Values")) {
manager.cleanPositionsOnScriptable ();
}
EditorGUILayout.Space ();
if (GUILayout.Button ("Toggle Edit Weapon Values In-Game")) {
manager.toggleEditWeaponTransformValuesIngameStateState ();
}
EditorGUILayout.Space ();
if (GUILayout.Button ("Show/Hide Handle Gizmo")) {
manager.toggleShowHandleGizmo ();
}
EditorGUILayout.Space ();
if (GUILayout.Button ("Select Current Weapon Object In-Game")) {
manager.selectCurrentWeaponObjectInGame ();
}
EditorGUILayout.Space ();
if (GUILayout.Button ("Update Weapon Reference Values")) {
manager.updateGrabbedWeaponReferenceValuesOnAllWeaponInfoList ();
}
EditorGUILayout.Space ();
}
public void showPositionHandle (Transform currentTransform, string handleName)
{
currentRotationHandle = Tools.pivotRotation == PivotRotation.Local ? currentTransform.rotation : Quaternion.identity;
EditorGUI.BeginChangeCheck ();
curretPositionHandle = currentTransform.position;
if (Tools.current == Tool.Move) {
curretPositionHandle = Handles.DoPositionHandle (curretPositionHandle, currentRotationHandle);
}
currentRotationHandle = currentTransform.rotation;
if (Tools.current == Tool.Rotate) {
currentRotationHandle = Handles.DoRotationHandle (currentRotationHandle, curretPositionHandle);
}
if (EditorGUI.EndChangeCheck ()) {
Undo.RecordObject (currentTransform, handleName);
currentTransform.position = curretPositionHandle;
currentTransform.rotation = currentRotationHandle;
}
}
}
#endif