Update
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 304237a0b0ea3bb4caa2d325a310a642
|
||||
folderAsset: yes
|
||||
timeCreated: 1437782135
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,120 @@
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using Invector.Utils;
|
||||
|
||||
namespace Invector.vCharacterController.vActions
|
||||
{
|
||||
// BASIC FEATURES
|
||||
public partial class vMenuComponent
|
||||
{
|
||||
[MenuItem("GameObject/Invector/Utils/Create SimpleTrigger", false)]
|
||||
static void AddSimpleTrigger()
|
||||
{
|
||||
var obj = new GameObject("SimpleTrigger", typeof(vSimpleTrigger));
|
||||
|
||||
|
||||
SceneView view = SceneView.lastActiveSceneView;
|
||||
if (SceneView.lastActiveSceneView == null)
|
||||
throw new UnityException("The Scene View can't be access");
|
||||
|
||||
Vector3 spawnPos = view.camera.ViewportToWorldPoint(new Vector3(0.5f, 0.5f, 5f));
|
||||
if (Selection.activeGameObject)
|
||||
{
|
||||
obj.transform.parent = Selection.activeGameObject.transform;
|
||||
spawnPos = Selection.activeGameObject.transform.position;
|
||||
}
|
||||
obj.transform.position = spawnPos;
|
||||
obj.layer = LayerMask.NameToLayer("Triggers");
|
||||
|
||||
Selection.activeGameObject = obj.gameObject;
|
||||
}
|
||||
|
||||
[MenuItem("GameObject/Invector/Utils/Create SimpleTrigger With Input", false)]
|
||||
static void AddSimpleTriggerWithInput()
|
||||
{
|
||||
var obj = new GameObject("SimpleTrigger WithInput", typeof(vSimpleTriggerWithInput));
|
||||
|
||||
|
||||
SceneView view = SceneView.lastActiveSceneView;
|
||||
if (SceneView.lastActiveSceneView == null)
|
||||
throw new UnityException("The Scene View can't be access");
|
||||
|
||||
Vector3 spawnPos = view.camera.ViewportToWorldPoint(new Vector3(0.5f, 0.5f, 5f));
|
||||
if (Selection.activeGameObject)
|
||||
{
|
||||
obj.transform.parent = Selection.activeGameObject.transform;
|
||||
spawnPos = Selection.activeGameObject.transform.position;
|
||||
}
|
||||
obj.transform.position = spawnPos;
|
||||
obj.layer = LayerMask.NameToLayer("Triggers");
|
||||
|
||||
Selection.activeGameObject = obj.gameObject;
|
||||
}
|
||||
|
||||
[MenuItem("Invector/Basic Locomotion/Actions/Generic Action")]
|
||||
static void GenericActionMenu()
|
||||
{
|
||||
if (Selection.activeGameObject)
|
||||
Selection.activeGameObject.AddComponent<vGenericAction>();
|
||||
else
|
||||
Debug.Log("Please select the Player to add this component.");
|
||||
}
|
||||
|
||||
[MenuItem("Invector/Basic Locomotion/Components/Generic Animation")]
|
||||
static void GenericAnimationMenu()
|
||||
{
|
||||
if (Selection.activeGameObject)
|
||||
Selection.activeGameObject.AddComponent<vGenericAnimation>();
|
||||
else
|
||||
Debug.Log("Please select the Player to add this component.");
|
||||
}
|
||||
|
||||
[MenuItem("Invector/Basic Locomotion/Actions/Ladder Action")]
|
||||
static void LadderActionMenu()
|
||||
{
|
||||
if (Selection.activeGameObject)
|
||||
Selection.activeGameObject.AddComponent<vLadderAction>();
|
||||
else
|
||||
Debug.Log("Please select the Player to add this component.");
|
||||
}
|
||||
|
||||
[MenuItem("Invector/Basic Locomotion/Components/HitDamageParticle")]
|
||||
static void HitDamageMenu()
|
||||
{
|
||||
if (Selection.activeGameObject)
|
||||
Selection.activeGameObject.AddComponent<vHitDamageParticle>();
|
||||
else
|
||||
Debug.Log("Please select a vCharacter to add the component.");
|
||||
}
|
||||
|
||||
[MenuItem("Invector/Basic Locomotion/Components/HeadTrack")]
|
||||
static void HeadTrackMenu()
|
||||
{
|
||||
if (Selection.activeGameObject)
|
||||
Selection.activeGameObject.AddComponent<vHeadTrack>();
|
||||
else
|
||||
Debug.Log("Please select a vCharacter to add the component.");
|
||||
}
|
||||
|
||||
[MenuItem("Invector/Basic Locomotion/Components/FootStep")]
|
||||
static void FootStepMenu()
|
||||
{
|
||||
if (Selection.activeGameObject)
|
||||
Selection.activeGameObject.AddComponent<vFootStep>();
|
||||
else
|
||||
Debug.Log("Please select a GameObject to add the component.");
|
||||
}
|
||||
|
||||
[MenuItem("Invector/Basic Locomotion/Resources/New AudioSurface")]
|
||||
static void NewAudioSurface()
|
||||
{
|
||||
vScriptableObjectUtility.CreateAsset<vAudioSurface>();
|
||||
}
|
||||
|
||||
[MenuItem("Invector/Basic Locomotion/Resources/New Ragdoll Generic Template")]
|
||||
static void RagdollGenericTemplate()
|
||||
{
|
||||
vScriptableObjectUtility.CreateAsset<vRagdollGenericTemplate>();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 75dd66d2e3e1c8443a9fa70b7160ff91
|
||||
timeCreated: 1495231846
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,250 @@
|
||||
using Invector.vCamera;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Invector.vCharacterController
|
||||
{
|
||||
public class vCreateBasicCharacterEditor : EditorWindow
|
||||
{
|
||||
GUISkin skin;
|
||||
public GameObject template;
|
||||
public bool useGameController = true;
|
||||
public GameObject charObj;
|
||||
Animator charAnimator;
|
||||
|
||||
Vector2 rect = new Vector2(500, 590);
|
||||
UnityEditor.Editor humanoidpreview;
|
||||
Texture2D m_Logo;
|
||||
|
||||
/// <summary>
|
||||
/// 3rdPersonController Menu
|
||||
/// </summary>
|
||||
[MenuItem("Invector/Basic Locomotion/Create Basic Controller", false, 0)]
|
||||
public static void CreateNewCharacter()
|
||||
{
|
||||
GetWindow<vCreateBasicCharacterEditor>();
|
||||
}
|
||||
|
||||
bool isHuman, isValidAvatar, charExist;
|
||||
public virtual void OnEnable()
|
||||
{
|
||||
m_Logo = Resources.Load("icon_v2") as Texture2D;
|
||||
if (Selection.activeObject)
|
||||
{
|
||||
charObj = Selection.activeGameObject;
|
||||
}
|
||||
if (charObj)
|
||||
{
|
||||
charAnimator = charObj.GetComponent<Animator>();
|
||||
humanoidpreview = Editor.CreateEditor(charObj);
|
||||
}
|
||||
|
||||
charExist = charAnimator != null;
|
||||
isHuman = charExist ? charAnimator.isHuman : false;
|
||||
isValidAvatar = charExist ? charAnimator.avatar.isValid : false;
|
||||
}
|
||||
|
||||
public virtual void OnGUI()
|
||||
{
|
||||
if (!skin)
|
||||
{
|
||||
skin = Resources.Load("vSkin") as GUISkin;
|
||||
}
|
||||
|
||||
GUI.skin = skin;
|
||||
|
||||
this.minSize = rect;
|
||||
this.titleContent = new GUIContent("Character", null, "Third Person Character Creator");
|
||||
GUILayout.BeginVertical("Character Creator Window", "window");
|
||||
GUILayout.Label(m_Logo, GUILayout.MaxHeight(25));
|
||||
GUILayout.Space(5);
|
||||
|
||||
GUILayout.BeginVertical("box");
|
||||
|
||||
if (!charObj)
|
||||
{
|
||||
EditorGUILayout.HelpBox("Make sure your FBX model is set as Humanoid!", MessageType.Info);
|
||||
}
|
||||
else if (!charExist)
|
||||
{
|
||||
EditorGUILayout.HelpBox("Missing a Animator Component", MessageType.Error);
|
||||
}
|
||||
else if (!isHuman)
|
||||
{
|
||||
EditorGUILayout.HelpBox("This is not a Humanoid", MessageType.Error);
|
||||
}
|
||||
else if (!isValidAvatar)
|
||||
{
|
||||
EditorGUILayout.HelpBox(charObj.name + " is a invalid Humanoid", MessageType.Info);
|
||||
}
|
||||
|
||||
template = EditorGUILayout.ObjectField("Template", template, typeof(GameObject), true, GUILayout.ExpandWidth(true)) as GameObject;
|
||||
charObj = EditorGUILayout.ObjectField("FBX Model", charObj, typeof(GameObject), true, GUILayout.ExpandWidth(true)) as GameObject;
|
||||
|
||||
EditorGUILayout.Space();
|
||||
EditorGUILayout.LabelField("--- Optional---");
|
||||
|
||||
useGameController = EditorGUILayout.Toggle("Add GameController", useGameController);
|
||||
|
||||
if (GUI.changed && charObj != null && charObj.GetComponent<vThirdPersonController>() == null)
|
||||
{
|
||||
humanoidpreview = Editor.CreateEditor(charObj);
|
||||
}
|
||||
|
||||
if (charObj != null && charObj.GetComponent<vThirdPersonController>() != null)
|
||||
{
|
||||
EditorGUILayout.HelpBox("This gameObject already contains the component vThirdPersonController", MessageType.Warning);
|
||||
}
|
||||
|
||||
GUILayout.EndVertical();
|
||||
|
||||
//GUILayout.BeginHorizontal("box");
|
||||
//EditorGUILayout.LabelField("Need to know how it works?");
|
||||
//if (GUILayout.Button("Video Tutorial"))
|
||||
//{
|
||||
// Application.OpenURL("https://www.youtube.com/watch?v=KQ5xha36tfE&index=1&list=PLvgXGzhT_qehtuCYl2oyL-LrWoT7fhg9d");
|
||||
//}
|
||||
//GUILayout.EndHorizontal();
|
||||
|
||||
if (charObj)
|
||||
{
|
||||
charAnimator = charObj.GetComponent<Animator>();
|
||||
}
|
||||
|
||||
charExist = charAnimator != null;
|
||||
isHuman = charExist ? charAnimator.isHuman : false;
|
||||
isValidAvatar = charExist ? charAnimator.avatar.isValid : false;
|
||||
|
||||
if (CanCreate())
|
||||
{
|
||||
DrawHumanoidPreview();
|
||||
GUILayout.BeginHorizontal();
|
||||
GUILayout.FlexibleSpace();
|
||||
|
||||
if (GUILayout.Button("Create"))
|
||||
{
|
||||
Create();
|
||||
}
|
||||
|
||||
GUILayout.FlexibleSpace();
|
||||
GUILayout.EndHorizontal();
|
||||
}
|
||||
|
||||
GUILayout.EndVertical();
|
||||
}
|
||||
|
||||
public virtual bool CanCreate()
|
||||
{
|
||||
return isValidAvatar && isHuman && charObj != null && charObj.GetComponent<vThirdPersonController>() == null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Draw the Preview window
|
||||
/// </summary>
|
||||
public virtual void DrawHumanoidPreview()
|
||||
{
|
||||
GUILayout.FlexibleSpace();
|
||||
|
||||
if (humanoidpreview != null)
|
||||
{
|
||||
humanoidpreview.OnInteractivePreviewGUI(GUILayoutUtility.GetRect(100, 400), "window");
|
||||
}
|
||||
}
|
||||
|
||||
private GameObject InstantiateNewCharacter(GameObject selected)
|
||||
{
|
||||
if (selected == null)
|
||||
{
|
||||
return selected;
|
||||
}
|
||||
|
||||
if (selected.scene.IsValid())
|
||||
{
|
||||
return selected;
|
||||
}
|
||||
|
||||
return PrefabUtility.InstantiatePrefab(selected) as GameObject;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Created the Third Person Controller
|
||||
/// </summary>
|
||||
public virtual void Create()
|
||||
{
|
||||
// base for the character
|
||||
GameObject newCharacter = InstantiateNewCharacter(charObj);
|
||||
|
||||
if (!newCharacter)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
GameObject _template = Instantiate(template, newCharacter.transform.position, newCharacter.transform.rotation);
|
||||
Transform modelParent = _template.transform.Find("3D Model");
|
||||
|
||||
if (modelParent == null)
|
||||
{
|
||||
modelParent = new GameObject("3D Model").transform;
|
||||
modelParent.parent = _template.transform;
|
||||
}
|
||||
|
||||
newCharacter.transform.parent = modelParent;
|
||||
newCharacter.transform.localPosition = Vector3.zero;
|
||||
newCharacter.transform.localEulerAngles = Vector3.zero;
|
||||
_template.name = "vBasicController_" + charObj.gameObject.name;
|
||||
|
||||
Animator animatorController = newCharacter.GetComponent<Animator>();
|
||||
Animator animatorTemplate = _template.GetComponent<Animator>();
|
||||
|
||||
animatorTemplate.avatar = animatorController.avatar;
|
||||
animatorTemplate.Rebind();
|
||||
DestroyImmediate(animatorController);
|
||||
|
||||
newCharacter.tag = "Player";
|
||||
|
||||
var p_layer = LayerMask.NameToLayer("Player");
|
||||
newCharacter.layer = p_layer;
|
||||
|
||||
foreach (Transform t in newCharacter.transform.GetComponentsInChildren<Transform>())
|
||||
{
|
||||
t.gameObject.layer = p_layer;
|
||||
}
|
||||
|
||||
Selection.activeGameObject = _template;
|
||||
|
||||
// search for a MainCamera and attach to the tpCamera
|
||||
var mainCamera = Camera.main;
|
||||
var tpCamera = _template.GetComponentInChildren<vThirdPersonCamera>();
|
||||
|
||||
if (mainCamera == null)
|
||||
{
|
||||
mainCamera = new GameObject("MainCamera", typeof(Camera), typeof(AudioListener)).GetComponent<Camera>();
|
||||
mainCamera.tag = "MainCamera";
|
||||
}
|
||||
|
||||
if (mainCamera.transform.parent != tpCamera.transform)
|
||||
{
|
||||
mainCamera.transform.parent = tpCamera.transform;
|
||||
mainCamera.transform.localPosition = Vector3.zero;
|
||||
mainCamera.transform.localEulerAngles = Vector3.zero;
|
||||
}
|
||||
|
||||
// add the gameController example
|
||||
if (useGameController)
|
||||
{
|
||||
GameObject gC = null;
|
||||
var gameController = FindObjectOfType<vGameController>();
|
||||
if (gameController == null)
|
||||
{
|
||||
gC = new GameObject("vGameController_Example");
|
||||
gC.AddComponent<vGameController>();
|
||||
}
|
||||
}
|
||||
|
||||
UnityEditor.SceneView.lastActiveSceneView.FrameSelected();
|
||||
this.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0be34c7083a012248a83e5a948676d12
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences:
|
||||
- m_PersistentViewDataDictionary: {instanceID: 0}
|
||||
- template: {fileID: 4877562643351836832, guid: ada54f2848144624d9c179056240d24f,
|
||||
type: 3}
|
||||
- charObj: {fileID: 199726, guid: 5563b2c1cf35cae4f8490dfea2d2aa41, type: 3}
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,121 @@
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Invector
|
||||
{
|
||||
class vHelperEditor : EditorWindow
|
||||
{
|
||||
//GUISkin skin;
|
||||
//private Texture2D m_Logo = null;
|
||||
//Vector2 rect = new Vector2(380, 500);
|
||||
|
||||
//void OnEnable()
|
||||
//{
|
||||
// m_Logo = (Texture2D)Resources.Load("logo", typeof(Texture2D));
|
||||
//}
|
||||
|
||||
[MenuItem("Invector/Import ProjectSettings")]
|
||||
public static void ImportProjectSettings()
|
||||
{
|
||||
AssetDatabase.ImportPackage("Assets/Invector-3rdPersonController/Basic Locomotion/Editor/Resources/vProjectSettings.unitypackage", true);
|
||||
}
|
||||
|
||||
//[MenuItem("Invector/Help/Check for Updates")]
|
||||
//public static void About()
|
||||
//{
|
||||
// GetWindow(typeof(vHelperEditor));
|
||||
//}
|
||||
|
||||
[MenuItem("Invector/Help/Forum")]
|
||||
public static void Forum()
|
||||
{
|
||||
Application.OpenURL("http://invector.proboards.com/");
|
||||
}
|
||||
|
||||
[MenuItem("Invector/Help/FAQ")]
|
||||
public static void FAQMenu()
|
||||
{
|
||||
Application.OpenURL("http://inv3ctor.wix.com/invector#!faq/cnni7");
|
||||
}
|
||||
|
||||
[MenuItem("Invector/Help/API")]
|
||||
public static void APIMenu()
|
||||
{
|
||||
Application.OpenURL("http://www.invector.xyz/vapi");
|
||||
}
|
||||
|
||||
[MenuItem("Invector/Help/Release Notes")]
|
||||
public static void ReleaseNotes()
|
||||
{
|
||||
Application.OpenURL("http://inv3ctor.wix.com/invector#!release-notes/eax8d");
|
||||
}
|
||||
|
||||
[MenuItem("Invector/Help/Youtube Tutorials")]
|
||||
public static void Youtube()
|
||||
{
|
||||
Application.OpenURL("https://www.youtube.com/playlist?list=PLvgXGzhT_qehYG_Kzl5P6DuIpHynZP9Ju");
|
||||
}
|
||||
|
||||
[MenuItem("Invector/Help/Online Documentation")]
|
||||
public static void Documentation()
|
||||
{
|
||||
Application.OpenURL("http://www.invector.xyz/thirdpersondocumentation");
|
||||
}
|
||||
|
||||
//void OnGUI()
|
||||
//{
|
||||
// this.titleContent = new GUIContent("About");
|
||||
// this.minSize = rect;
|
||||
|
||||
// GUILayout.Label(m_Logo, GUILayout.MaxHeight(240));
|
||||
|
||||
// if (!skin) skin = Resources.Load("vSkin") as GUISkin;
|
||||
// GUI.skin = skin;
|
||||
|
||||
// GUILayout.BeginVertical("window");
|
||||
|
||||
// GUILayout.BeginHorizontal("box");
|
||||
// GUILayout.FlexibleSpace();
|
||||
// GUILayout.Label("Basic Locomotion Version: 2.4.2", EditorStyles.boldLabel);
|
||||
// GUILayout.FlexibleSpace();
|
||||
|
||||
// if (GUILayout.Button("Check for Update"))
|
||||
// {
|
||||
// UnityEditorInternal.AssetStore.Open("/content/59332");
|
||||
// this.Close();
|
||||
// }
|
||||
// GUILayout.EndHorizontal();
|
||||
|
||||
// GUILayout.BeginHorizontal("box");
|
||||
// GUILayout.FlexibleSpace();
|
||||
// GUILayout.Label("Melee Combat Version: 2.4.2", EditorStyles.boldLabel);
|
||||
// GUILayout.FlexibleSpace();
|
||||
|
||||
// if (GUILayout.Button("Check for Update"))
|
||||
// {
|
||||
// UnityEditorInternal.AssetStore.Open("/content/44227");
|
||||
// this.Close();
|
||||
// }
|
||||
// GUILayout.EndHorizontal();
|
||||
|
||||
// GUILayout.BeginHorizontal("box");
|
||||
// GUILayout.FlexibleSpace();
|
||||
// GUILayout.Label("Shooter Version: 1.3.2", EditorStyles.boldLabel);
|
||||
// GUILayout.FlexibleSpace();
|
||||
// if (GUILayout.Button("Check for Update"))
|
||||
// {
|
||||
// UnityEditorInternal.AssetStore.Open("/content/84583");
|
||||
// this.Close();
|
||||
// }
|
||||
// GUILayout.EndHorizontal();
|
||||
|
||||
// EditorGUILayout.Space();
|
||||
// EditorGUILayout.HelpBox("UPDATE INSTRUCTIONS: \n\n *ALWAYS BACKUP YOUR PROJECT BEFORE UPDATE!* \n\n Delete the Invector's Folder from the Project before import the new version", MessageType.Info);
|
||||
|
||||
// GUILayout.EndVertical();
|
||||
|
||||
// EditorGUILayout.Space();
|
||||
// EditorGUILayout.Space();
|
||||
//}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 07e2f10ae6225e54eaea15db1567ff5f
|
||||
timeCreated: 1456153208
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user