This commit is contained in:
2026-05-30 09:16:35 +07:00
parent 2f87ce19a7
commit 1c0ee6efb7
4001 changed files with 3363438 additions and 1738 deletions

View File

@@ -0,0 +1,76 @@
using UnityEngine;
using UnityEditor;
using System.Collections;
using System;
namespace Invector.vShooter
{
public class vCreateShooterWeaponEditor : EditorWindow
{
GUISkin skin;
GameObject weaponObj;
Vector2 rect = new Vector2(400, 100);
Texture2D m_Logo;
[MenuItem("Invector/Shooter/Create Shooter Weapon")]
public static void CreateNewCharacter()
{
GetWindow<vCreateShooterWeaponEditor>();
}
void OnGUI()
{
if (!skin) skin = Resources.Load("vSkin") as GUISkin;
GUI.skin = skin;
this.minSize = rect;
this.titleContent = new GUIContent("ShooterWeapon", null, "Window Creator");
m_Logo = Resources.Load("icon_v2") as Texture2D;
GUILayout.BeginVertical("Shooter Weapon Creator Window", "window");
GUILayout.Label(m_Logo, GUILayout.MaxHeight(25));
GUILayout.Space(5);
GUILayout.BeginVertical("box");
weaponObj = EditorGUILayout.ObjectField("FBX Model", weaponObj, typeof(GameObject), true, GUILayout.ExpandWidth(true)) as GameObject;
if (weaponObj != null)
{
if (GUILayout.Button("Create"))
Create();
}
GUILayout.EndVertical();
GUILayout.EndVertical();
}
private GameObject InstantiateNewWeapon(GameObject selected)
{
if (selected == null) return selected;
if (selected.scene.IsValid()) return selected;
return PrefabUtility.InstantiatePrefab(selected) as GameObject;
}
private void Create()
{
var template = Resources.Load("ShooterWeaponTemplate") as GameObject;
GameObject weapon;
if (template)
weapon =(GameObject) PrefabUtility.InstantiatePrefab(template);
else
weapon = new GameObject(" ", typeof(vShooterWeapon));
var newWeapon = InstantiateNewWeapon(weaponObj);
if (!newWeapon) return;
newWeapon.transform.SetParent(weapon.transform);
newWeapon.transform.localPosition = Vector3.zero;
newWeapon.transform.localEulerAngles = Vector3.zero;
Selection.activeGameObject = weapon;
SceneView.lastActiveSceneView.FrameSelected();
this.Close();
}
}
}

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: b30f4047c00cbd649b90a62edbda97cc
timeCreated: 1486752106
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: