Update
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6f76efe6e52c0254bb6c56ad6a01f7ed
|
||||
folderAsset: yes
|
||||
timeCreated: 1495164888
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,15 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 2f22f37f63bcec14080b11ce5e381ce6, type: 3}
|
||||
m_Name: vEditorStartupPrefs
|
||||
m_EditorClassIdentifier:
|
||||
displayWelcomeScreen: 1
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1c9f2caa0db14374aaaabef8a5c88ce5
|
||||
timeCreated: 1570641149
|
||||
licenseType: Store
|
||||
NativeFormatImporter:
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,62 @@
|
||||
using System;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Invector.vCharacterController
|
||||
{
|
||||
[Serializable]
|
||||
public class vEditorStartupPrefs : ScriptableObject
|
||||
{
|
||||
private static vEditorStartupPrefs instance;
|
||||
public static vEditorStartupPrefs Instance
|
||||
{
|
||||
get
|
||||
{
|
||||
if (instance == null)
|
||||
{
|
||||
instance = Resources.Load<vEditorStartupPrefs>("vEditorStartupPrefs");
|
||||
if (instance == null)
|
||||
{
|
||||
instance = CreateInstance<vEditorStartupPrefs>();
|
||||
}
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
}
|
||||
|
||||
[SerializeField] private bool displayWelcomeScreen = true;
|
||||
|
||||
public static bool DisplayWelcomeScreen
|
||||
{
|
||||
get { return Instance.displayWelcomeScreen; }
|
||||
set
|
||||
{
|
||||
if (value != Instance.displayWelcomeScreen)
|
||||
{
|
||||
Instance.displayWelcomeScreen = value;
|
||||
SaveStartupPrefs();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void SaveStartupPrefs()
|
||||
{
|
||||
if (!AssetDatabase.Contains(Instance))
|
||||
{
|
||||
var copy = CreateInstance<vEditorStartupPrefs>();
|
||||
EditorUtility.CopySerialized(Instance, copy);
|
||||
instance = Resources.Load<vEditorStartupPrefs>("vEditorStartupPrefs");
|
||||
if (instance == null)
|
||||
{
|
||||
AssetDatabase.CreateAsset(copy, "Assets/Invector-3rdPersonController/Basic Locomotion/Resources/vEditorStartupPrefs.asset");
|
||||
AssetDatabase.Refresh();
|
||||
instance = copy;
|
||||
|
||||
return;
|
||||
}
|
||||
EditorUtility.CopySerialized(copy, instance);
|
||||
}
|
||||
EditorUtility.SetDirty(Instance);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2f22f37f63bcec14080b11ce5e381ce6
|
||||
timeCreated: 1570638069
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3f7f845cfdfb83b4597aae966022b206
|
||||
timeCreated: 1437763044
|
||||
licenseType: Store
|
||||
NativeFormatImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3bf719ecb264d6242b5836d7f03f3b71
|
||||
timeCreated: 1570561745
|
||||
licenseType: Store
|
||||
NativeFormatImporter:
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,153 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Invector.vCharacterController
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(GenericInput))]
|
||||
public class vGenericInputDrawer : PropertyDrawer
|
||||
{
|
||||
public static GUISkin skin;
|
||||
public static GUIContent axisContent;
|
||||
public static GUIContent invertAxisContent;
|
||||
public static GUIContent unityInputContent;
|
||||
public static float heightOpen => ((EditorGUIUtility.singleLineHeight) * 7) + 10;
|
||||
|
||||
const string axisButtonTootip = "IsTriggerAxis?\nConvert Input Axis to Trigger Axis \nThis is usefull if you want to use a axis input like a trigger button.\n \n***Ps. This work only if input is used for GetButton or GetButton(down,up), not if is used for GetAxis";
|
||||
const string invertAxisButtonTootip = "InvertTriggerAxis?\nIf the Input is an TriggerAxis button you can invert the valid input.\nIf enable the valid axis input is -1 else valid axis input is 1";
|
||||
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
|
||||
{
|
||||
Color color = new Color(1f, 0.549f, 0f );
|
||||
GUI.color = property.isExpanded ? color : Color.white;
|
||||
if (axisContent == null)
|
||||
{
|
||||
axisContent = new GUIContent(EditorGUIUtility.IconContent("d_MoveTool On@2x"));
|
||||
axisContent.tooltip = axisButtonTootip;
|
||||
|
||||
}
|
||||
if (invertAxisContent == null)
|
||||
{
|
||||
invertAxisContent = new GUIContent(EditorGUIUtility.IconContent("Mirror"));
|
||||
invertAxisContent.tooltip = invertAxisButtonTootip;
|
||||
}
|
||||
if (unityInputContent == null)
|
||||
{
|
||||
unityInputContent = new GUIContent();
|
||||
}
|
||||
|
||||
var rect1 = new Rect(position.x, position.y, EditorGUIUtility.singleLineHeight * 2f, EditorGUIUtility.singleLineHeight);
|
||||
var rect2 = new Rect(position.x + rect1.width, position.y, position.width - rect1.width, EditorGUIUtility.singleLineHeight);
|
||||
|
||||
var useInput = property.FindPropertyRelative("useInput");
|
||||
|
||||
if (property.isExpanded)
|
||||
{
|
||||
var bgRect = position;
|
||||
bgRect.height = heightOpen;
|
||||
|
||||
GUI.Box(bgRect, "", EditorStyles.helpBox);
|
||||
}
|
||||
|
||||
if (useInput != null)
|
||||
{
|
||||
useInput.boolValue = GUI.Toggle(rect1, useInput.boolValue, "USE", EditorStyles.miniButtonMid);
|
||||
if (useInput.boolValue == false)
|
||||
{
|
||||
property.isExpanded = false;
|
||||
}
|
||||
|
||||
GUI.enabled = useInput.boolValue;
|
||||
}
|
||||
|
||||
property.isExpanded = GUI.Toggle(rect2, property.isExpanded, property.displayName, EditorStyles.miniButtonMid);
|
||||
GUI.color = Color.white;
|
||||
if (property.isExpanded)
|
||||
{
|
||||
|
||||
var keyboard = property.FindPropertyRelative("keyboard");
|
||||
var joystick = property.FindPropertyRelative("joystick");
|
||||
var mobile = property.FindPropertyRelative("mobile");
|
||||
|
||||
var keyboardAxis = property.FindPropertyRelative("keyboardAxis");
|
||||
var joystickAxis = property.FindPropertyRelative("joystickAxis");
|
||||
var mobileAxis = property.FindPropertyRelative("mobileAxis");
|
||||
|
||||
var joystickAxisInvert = property.FindPropertyRelative("joystickAxisInvert");
|
||||
var keyboardAxisInvert = property.FindPropertyRelative("keyboardAxisInvert");
|
||||
var mobileAxisInvert = property.FindPropertyRelative("mobileAxisInvert");
|
||||
|
||||
var isUnityInput = property.FindPropertyRelative("isUnityInput");
|
||||
|
||||
EditorGUI.indentLevel++;
|
||||
|
||||
var totalRect = position;
|
||||
|
||||
totalRect.height = EditorGUIUtility.singleLineHeight;
|
||||
|
||||
totalRect.width -= 10;
|
||||
totalRect.x += 5;
|
||||
DrawInput(ref totalRect, "Mouse Keyboard Input", keyboard, keyboardAxis, keyboardAxisInvert, isUnityInput, true);
|
||||
DrawInput(ref totalRect, "Joystick Input", joystick, joystickAxis, joystickAxisInvert, null, false);
|
||||
DrawInput(ref totalRect,"Mobile Input", mobile, mobileAxis, mobileAxisInvert, null, false);
|
||||
|
||||
}
|
||||
GUI.enabled = true;
|
||||
|
||||
}
|
||||
void DrawInput(ref Rect totalRect,string tooltip, SerializedProperty input, SerializedProperty axis, SerializedProperty invert, SerializedProperty isUnityInput = null, bool withKeys = false)
|
||||
{
|
||||
totalRect.y += EditorGUIUtility.singleLineHeight ;
|
||||
GUI.Label(totalRect, tooltip,EditorStyles.miniLabel);
|
||||
totalRect.y += EditorGUIUtility.singleLineHeight;
|
||||
var width1 = EditorGUIUtility.singleLineHeight * 1.5f;
|
||||
var width2 = totalRect.width - (width1 * 3);
|
||||
var rectA = new Rect(totalRect.x, totalRect.y, width1, totalRect.height);
|
||||
var rectB = new Rect(totalRect.x + width1, totalRect.y, width2, totalRect.height);
|
||||
var rectC = new Rect(totalRect.x + width1 + width2, totalRect.y, width1, totalRect.height);
|
||||
var rectD = new Rect(totalRect.x + (width1) * 2 + width2, totalRect.y, width1, totalRect.height);
|
||||
|
||||
var content = unityInputContent;
|
||||
content.tooltip = (isUnityInput == null || isUnityInput.boolValue) ? "Input is a UnityInput" : "Input is a KeyCode";
|
||||
content.image = (isUnityInput == null || isUnityInput.boolValue) ? EditorGUIUtility.IconContent("UnityLogo").image : EditorGUIUtility.IconContent("Font Icon").image;
|
||||
|
||||
GUI.Box(rectA, content, EditorStyles.miniButton);
|
||||
DrawInputEnum(input, isUnityInput, rectB, withKeys);
|
||||
|
||||
GUI.color = axis.boolValue ? Color.grey : Color.white;
|
||||
axis.boolValue = GUI.Toggle(rectC, axis.boolValue, axisContent, EditorStyles.miniButton);
|
||||
GUI.color = invert.boolValue ? Color.grey : Color.white;
|
||||
GUI.enabled = axis.boolValue;
|
||||
|
||||
invert.boolValue = GUI.Toggle(rectD, invert.boolValue, invertAxisContent, EditorStyles.miniButton) && axis.boolValue;
|
||||
GUI.enabled = true;
|
||||
GUI.color = Color.white;
|
||||
}
|
||||
|
||||
void DrawInputEnum(SerializedProperty input, SerializedProperty isUnityInput, Rect rect, bool withKeys = false)
|
||||
{
|
||||
|
||||
if (GUI.Button(rect, new GUIContent(input.stringValue), EditorStyles.miniPullDown))
|
||||
{
|
||||
PopupWindow.Show(rect, new vGenericInputSelector
|
||||
("Input for " + input.displayName, input.stringValue, withKeys, isUnityInput == null || isUnityInput.boolValue, (string newInput, bool isKey) =>
|
||||
{
|
||||
input.stringValue = newInput;
|
||||
if (isUnityInput != null)
|
||||
{
|
||||
isUnityInput.boolValue = !isKey;
|
||||
}
|
||||
|
||||
input.serializedObject.ApplyModifiedProperties();
|
||||
input.serializedObject.Update();
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
|
||||
{
|
||||
return !property.isExpanded ? EditorGUIUtility.singleLineHeight : heightOpen;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 100554bba32332448baa745ce3875587
|
||||
timeCreated: 1475778971
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,140 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using System;
|
||||
|
||||
public class vGenericInputSelector : PopupWindowContent
|
||||
{
|
||||
public vGenericInputSelector (string label,string lastInput, bool drawKeys,bool isUnityInput, UnityEngine.Events.UnityAction<string, bool> onSelectInput)
|
||||
{
|
||||
this.label = label;
|
||||
this.drawKeys = drawKeys;
|
||||
this.onSelectInput = onSelectInput;
|
||||
this.isUnityInput = isUnityInput;
|
||||
this.lastInput = lastInput;
|
||||
if(drawKeys)
|
||||
{
|
||||
toolBar = new GUIContent[] { new GUIContent("Unity Inputs", unityInputToolip), new GUIContent("KeyCodes", keyCodeTooltip) };
|
||||
selectedToolBar = isUnityInput?0:1;
|
||||
}
|
||||
else toolBar = new GUIContent[] { new GUIContent("Unity Inputs", unityInputToolip)};
|
||||
|
||||
|
||||
}
|
||||
const string keyCodeTooltip = "KeyCode use a Enum (GetKey, GetKeyDown,GetKeyUp)";
|
||||
const string unityInputToolip = "Unity input use input names created in InputManager (GetButton, GetButtonDown, GetButtonUp";
|
||||
public static UnityEngine.Object inputManager;
|
||||
public static string[] _unityInputs = new string[0];
|
||||
public static string[] _unityKeys = new string[0];
|
||||
public static float minHeight = EditorGUIUtility.singleLineHeight*10;
|
||||
public static float maxHeight = EditorGUIUtility.singleLineHeight * 50;
|
||||
public static float height= EditorGUIUtility.singleLineHeight;
|
||||
public string label;
|
||||
public string search;
|
||||
|
||||
protected Vector2 scrollView;
|
||||
protected Vector2 scrollView2;
|
||||
protected int selectedToolBar = 0;
|
||||
protected bool drawKeys =true;
|
||||
protected bool isUnityInput;
|
||||
protected string lastInput;
|
||||
protected GUIContent[] toolBar;
|
||||
/// <summary>
|
||||
/// Event to return the select input and if the input is an keycode
|
||||
/// </summary>
|
||||
public UnityEngine.Events.UnityAction<string, bool> onSelectInput;
|
||||
|
||||
public override Vector2 GetWindowSize()
|
||||
{
|
||||
return new Vector2(300, Mathf.Clamp((height * UnityInputs.Length),minHeight,maxHeight));
|
||||
}
|
||||
|
||||
public override void OnGUI(Rect rect)
|
||||
{
|
||||
GUILayout.BeginArea(rect,"","box");
|
||||
GUILayout.Box(label,GUILayout.ExpandWidth(true));
|
||||
DrawFilter();
|
||||
|
||||
selectedToolBar = GUILayout.Toolbar(selectedToolBar, toolBar);
|
||||
if(selectedToolBar==0) DrawInput( UnityInputs, false, ref scrollView,isUnityInput );
|
||||
else if (selectedToolBar ==1) DrawInput( UnityKeys, true, ref scrollView2,!isUnityInput);
|
||||
GUILayout.EndArea();
|
||||
// if(GUI.GetNameOfFocusedControl()!= "Search Field") EditorGUI.FocusTextInControl("Search Field");
|
||||
|
||||
}
|
||||
void DrawInput( string[] inputs,bool isKey,ref Vector2 scrollView,bool hightlightName = false)
|
||||
{
|
||||
GUILayout.BeginVertical();
|
||||
GUILayout.Space(10);
|
||||
scrollView = GUILayout.BeginScrollView(scrollView);
|
||||
for (int i=0;i< inputs.Length;i++)
|
||||
{
|
||||
var input = inputs[i];
|
||||
if (string.IsNullOrEmpty(search) || input.Trim().StartsWith(search) || input.Trim().ToLower().StartsWith(search.ToLower()))
|
||||
{
|
||||
if (hightlightName && input.Equals(lastInput)) GUI.color = Color.green;
|
||||
if (GUILayout.Button(input, EditorStyles.toolbarButton))
|
||||
{
|
||||
onSelectInput?.Invoke(input, isKey);
|
||||
editorWindow.Close();
|
||||
}
|
||||
}
|
||||
GUI.color = Color.white;
|
||||
}
|
||||
GUILayout.EndScrollView();
|
||||
GUILayout.EndVertical();
|
||||
}
|
||||
|
||||
void DrawFilter()
|
||||
{
|
||||
|
||||
GUILayout.BeginHorizontal();
|
||||
|
||||
GUI.SetNextControlName("Search Field");
|
||||
search = GUILayout.TextField(search, EditorStyles.toolbarSearchField);
|
||||
if(string.IsNullOrEmpty(search))
|
||||
{
|
||||
var fieldRect = GUILayoutUtility.GetLastRect();
|
||||
GUI.Label(fieldRect, " ....Search for input",EditorStyles.centeredGreyMiniLabel);
|
||||
}
|
||||
|
||||
|
||||
GUILayout.EndHorizontal();
|
||||
}
|
||||
|
||||
static string[] UnityKeys
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_unityKeys != null && _unityKeys.Length > 0) return _unityKeys;
|
||||
_unityKeys = Enum.GetNames(typeof(KeyCode));
|
||||
return _unityKeys;
|
||||
}
|
||||
}
|
||||
|
||||
static string[] UnityInputs
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_unityInputs != null && _unityInputs.Length > 0) return _unityInputs;
|
||||
|
||||
if (!inputManager)
|
||||
inputManager = AssetDatabase.LoadAllAssetsAtPath("ProjectSettings/InputManager.asset")[0];
|
||||
|
||||
SerializedObject obj = new SerializedObject(inputManager);
|
||||
SerializedProperty axisArray = obj.FindProperty("m_Axes");
|
||||
|
||||
if (_unityInputs.Length != axisArray.arraySize)
|
||||
_unityInputs = new string[axisArray.arraySize];
|
||||
for (int i = 0; i < axisArray.arraySize; ++i)
|
||||
{
|
||||
var axis = axisArray.GetArrayElementAtIndex(i);
|
||||
var name = axis.FindPropertyRelative("m_Name").stringValue;
|
||||
_unityInputs[i] = name;
|
||||
}
|
||||
|
||||
return _unityInputs;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 84f66b9391c9b2d49ae30e0ef8ece31d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,30 @@
|
||||
using UnityEditor;
|
||||
|
||||
namespace Invector.vCharacterController
|
||||
{
|
||||
[InitializeOnLoad]
|
||||
public class vInvectorStartup
|
||||
{
|
||||
static vInvectorStartup()
|
||||
{
|
||||
EditorApplication.update -= TriggerWelcomeScreen;
|
||||
EditorApplication.update += TriggerWelcomeScreen;
|
||||
}
|
||||
|
||||
private static void TriggerWelcomeScreen()
|
||||
{
|
||||
var showAtStartup = vEditorStartupPrefs.DisplayWelcomeScreen && EditorApplication.timeSinceStartup < 30f;
|
||||
|
||||
if (showAtStartup)
|
||||
{
|
||||
vInvectorWelcomeWindow.Open();
|
||||
}
|
||||
EditorApplication.update -= TriggerWelcomeScreen;
|
||||
}
|
||||
|
||||
private static void PlayModeChanged()
|
||||
{
|
||||
EditorApplication.update -= TriggerWelcomeScreen;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 41708f07abf46044399f2e556a162802
|
||||
timeCreated: 1570643086
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,358 @@
|
||||
using System;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Invector.vCharacterController
|
||||
{
|
||||
[InitializeOnLoad]
|
||||
public class vInvectorWelcomeWindow : EditorWindow
|
||||
{
|
||||
#region ToolBar Drawers
|
||||
/// <summary>
|
||||
/// ToolBar Class
|
||||
/// </summary>
|
||||
public class ToolBar
|
||||
{
|
||||
public string title;
|
||||
public UnityEngine.Events.UnityAction Draw;
|
||||
/// <summary>
|
||||
/// Create New Toolbar
|
||||
/// </summary>
|
||||
/// <param name="title">Title</param>
|
||||
/// <param name="onDraw">Method to draw when toolbar is selected</param>
|
||||
public ToolBar(string title, UnityEngine.Events.UnityAction onDraw)
|
||||
{
|
||||
this.title = title;
|
||||
this.Draw = onDraw;
|
||||
}
|
||||
public static implicit operator string(ToolBar tool)
|
||||
{
|
||||
return tool.title;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Index of selected <seealso cref="toolBars"/>
|
||||
/// </summary>
|
||||
public int toolBarIndex = 0;
|
||||
|
||||
/// <summary>
|
||||
/// List of Toolbars
|
||||
/// </summary>
|
||||
public ToolBar[] toolBars = new ToolBar[]
|
||||
{
|
||||
new ToolBar("First Run",FirstRunPageContent),
|
||||
new ToolBar("Getting Started",GettingStartedPageContent),
|
||||
#if INVECTOR_BASIC
|
||||
new ToolBar("Add-ons",AddonsPageContent),
|
||||
#endif
|
||||
new ToolBar("Forum | Discord",Forum)
|
||||
};
|
||||
#endregion
|
||||
|
||||
public const string _thirdPersonVersion = "2.6.4";
|
||||
public const string _fsmAIVersion = "1.2.0";
|
||||
|
||||
public const string _projectSettingsPath = "Assets/Invector-3rdPersonController/Basic Locomotion/Editor/Resources/vProjectSettings.unitypackage";
|
||||
public const string _mobilePackagePath = "Assets/Invector-3rdPersonController/Basic Locomotion/Editor/Resources/vMobileAddon.unitypackage";
|
||||
public const string _topDownPackagePath = "Assets/Invector-3rdPersonController/Basic Locomotion/Editor/Resources/vTopDownAddon.unitypackage";
|
||||
public const string _pointAndClickPackagePath = "Assets/Invector-3rdPersonController/Basic Locomotion/Editor/Resources/vPointClickAddon.unitypackage";
|
||||
public const string _platformPackagePath = "Assets/Invector-3rdPersonController/Basic Locomotion/Editor/Resources/v2DPlatformAddon.unitypackage";
|
||||
public const string _vMansionPath = "Assets/Invector-3rdPersonController/Basic Locomotion/Editor/Resources/vMansionAddon.unitypackage";
|
||||
|
||||
public static Texture2D invectorBanner = null;
|
||||
public static Texture2D mobileIcon = null;
|
||||
public static Texture2D topdownIcon = null;
|
||||
public static Texture2D pointAndClickIcon = null;
|
||||
public static Texture2D platformIcon = null;
|
||||
public static Texture2D vMansionIcon = null;
|
||||
public static Texture2D assetStoreIcon = null;
|
||||
public static Texture2D climbAddon = null;
|
||||
public static Texture2D swimmingAddon = null;
|
||||
public static Texture2D stealthKillAddon = null;
|
||||
public static Texture2D builderAddon = null;
|
||||
public static Texture2D ziplineAddon = null;
|
||||
public static Texture2D craftingAddon = null;
|
||||
public static Texture2D pushAddon = null;
|
||||
public static Texture2D coverAddon = null;
|
||||
|
||||
public static Vector2 scrollPosition;
|
||||
|
||||
GUISkin skin;
|
||||
private const int windowWidth = 600;
|
||||
private const int windowHeight = 500;
|
||||
|
||||
[MenuItem("Invector/Welcome Window", false, windowWidth)]
|
||||
public static void Open()
|
||||
{
|
||||
GetWindow<vInvectorWelcomeWindow>(true);
|
||||
}
|
||||
|
||||
#if INVECTOR_BASIC
|
||||
|
||||
[MenuItem("Invector/Add-Ons", false, windowWidth, priority = 2)]
|
||||
static void AddonsMenu()
|
||||
{
|
||||
GetWindow<vInvectorWelcomeWindow>(true).toolBarIndex = 2;
|
||||
}
|
||||
#endif
|
||||
public void OnEnable()
|
||||
{
|
||||
titleContent = new GUIContent("Welcome To Invector");
|
||||
maxSize = new Vector2(windowWidth, windowHeight);
|
||||
minSize = maxSize;
|
||||
InitStyle();
|
||||
}
|
||||
|
||||
void InitStyle()
|
||||
{
|
||||
if (!skin)
|
||||
{
|
||||
skin = Resources.Load("welcomeWindowSkin") as GUISkin;
|
||||
}
|
||||
|
||||
invectorBanner = (Texture2D)Resources.Load("invectorBanner", typeof(Texture2D));
|
||||
mobileIcon = (Texture2D)Resources.Load("mobileIcon", typeof(Texture2D));
|
||||
topdownIcon = (Texture2D)Resources.Load("topdownIcon", typeof(Texture2D));
|
||||
pointAndClickIcon = (Texture2D)Resources.Load("clickToMoveIcon", typeof(Texture2D));
|
||||
platformIcon = (Texture2D)Resources.Load("platformIcon", typeof(Texture2D));
|
||||
vMansionIcon = (Texture2D)Resources.Load("vMansionIcon", typeof(Texture2D));
|
||||
assetStoreIcon = (Texture2D)Resources.Load("Unity-Asset-Store", typeof(Texture2D));
|
||||
climbAddon = (Texture2D)Resources.Load("climbAddon", typeof(Texture2D));
|
||||
swimmingAddon = (Texture2D)Resources.Load("swimmingAddon", typeof(Texture2D));
|
||||
stealthKillAddon = (Texture2D)Resources.Load("stealthKillAddon", typeof(Texture2D));
|
||||
builderAddon = (Texture2D)Resources.Load("builderAddon", typeof(Texture2D));
|
||||
ziplineAddon = (Texture2D)Resources.Load("ziplineAddon", typeof(Texture2D));
|
||||
craftingAddon = (Texture2D)Resources.Load("craftingAddon", typeof(Texture2D));
|
||||
pushAddon = (Texture2D)Resources.Load("pushAddon", typeof(Texture2D));
|
||||
coverAddon = (Texture2D)Resources.Load("coverAddon", typeof(Texture2D));
|
||||
}
|
||||
|
||||
public void OnGUI()
|
||||
{
|
||||
GUI.skin = skin;
|
||||
|
||||
DrawHeader();
|
||||
DrawMenuButtons();
|
||||
DrawPageContent();
|
||||
DrawBottom();
|
||||
}
|
||||
|
||||
private void DrawHeader()
|
||||
{
|
||||
GUILayout.Label(invectorBanner, GUILayout.Height(110));
|
||||
}
|
||||
|
||||
private void DrawMenuButtons()
|
||||
{
|
||||
GUILayout.Space(-10);
|
||||
toolBarIndex = GUILayout.Toolbar(toolBarIndex, ToolbarNames());
|
||||
}
|
||||
|
||||
private string[] ToolbarNames()
|
||||
{
|
||||
string[] names = new string[toolBars.Length];
|
||||
for (int i = 0; i < toolBars.Length; i++)
|
||||
{
|
||||
names[i] = toolBars[i];
|
||||
}
|
||||
return names;
|
||||
}
|
||||
|
||||
private void DrawPageContent()
|
||||
{
|
||||
GUILayout.BeginArea(new Rect(4, 140, 592, 340));
|
||||
toolBars[toolBarIndex].Draw();
|
||||
GUILayout.EndArea();
|
||||
GUILayout.FlexibleSpace();
|
||||
}
|
||||
|
||||
private void DrawBottom()
|
||||
{
|
||||
GUILayout.BeginHorizontal("box");
|
||||
|
||||
vEditorStartupPrefs.DisplayWelcomeScreen = GUILayout.Toggle(vEditorStartupPrefs.DisplayWelcomeScreen, "Display this window at startup");
|
||||
|
||||
GUILayout.EndHorizontal();
|
||||
}
|
||||
|
||||
private static void ImportPackage(string package)
|
||||
{
|
||||
try
|
||||
{
|
||||
AssetDatabase.ImportPackage(package, true);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
Debug.LogError("Failed to import package: " + package);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
#region Static ToolBars
|
||||
|
||||
public static void FirstRunPageContent()
|
||||
{
|
||||
GUILayout.BeginVertical("window");
|
||||
|
||||
EditorGUILayout.HelpBox("This Template requires a custom ProjectSettings which includes: InputManager, Layers, Tags and a PhysicsManager." +
|
||||
" It's recommended to import the Template into a New Empty Project, using it as a base to build your game. \n\n * You can UNCHECK the InputManager when using only the FSM AI", MessageType.Warning, true);
|
||||
|
||||
if (GUILayout.Button(">>> Import Project Settings <<<"))
|
||||
{
|
||||
AssetDatabase.ImportPackage(_projectSettingsPath, true);
|
||||
}
|
||||
|
||||
GUILayout.Space(10);
|
||||
|
||||
#if INVECTOR_BASIC
|
||||
EditorGUILayout.HelpBox("Third Person Installed Version: " + _thirdPersonVersion, MessageType.Info);
|
||||
#endif
|
||||
#if INVECTOR_BASIC
|
||||
if (GUILayout.Button("Third Person Documentation"))
|
||||
{
|
||||
Application.OpenURL("https://www.invector.xyz/thirdpersondocumentation");
|
||||
}
|
||||
#endif
|
||||
|
||||
#if INVECTOR_AI_TEMPLATE
|
||||
EditorGUILayout.HelpBox("FSM AI Installed Version: " + _fsmAIVersion, MessageType.Info);
|
||||
#endif
|
||||
|
||||
#if INVECTOR_AI_TEMPLATE
|
||||
if (GUILayout.Button("FSM AI Documentation"))
|
||||
{
|
||||
Application.OpenURL("https://www.invector.xyz/aidocumentation");
|
||||
}
|
||||
#endif
|
||||
|
||||
GUILayout.Space(10);
|
||||
if (GUILayout.Button("Youtube Tutorials"))
|
||||
{
|
||||
Application.OpenURL("https://www.youtube.com/channel/UCSEoY03WFn7D0m1uMi6DxZQ/videos");
|
||||
}
|
||||
|
||||
|
||||
GUILayout.FlexibleSpace();
|
||||
GUILayout.EndVertical();
|
||||
}
|
||||
|
||||
public static void AddonsPageContent()
|
||||
{
|
||||
GUILayout.BeginVertical("window");
|
||||
scrollPosition = GUILayout.BeginScrollView(
|
||||
scrollPosition, GUILayout.Width(570), GUILayout.Height(316));
|
||||
|
||||
DrawNewAddon(mobileIcon, "Mobile Examples", "Simple mobile example, basic, melee and shooter scenes included", "Import Package", _mobilePackagePath, false);
|
||||
DrawNewAddon(topdownIcon, "Topdown Examples", "Topdown controller basic, melee and shooter scenes included", "Import Package", _topDownPackagePath, false);
|
||||
DrawNewAddon(pointAndClickIcon, "Point&Click Examples", "Similar to Diablo gameplay, basic and melee scenes included", "Import Package", _pointAndClickPackagePath, false);
|
||||
DrawNewAddon(platformIcon, "2.5D Examples", "2.5D with corner transition, basic, melee and shooter scenes included", "Import Package", _platformPackagePath, false);
|
||||
DrawNewAddon(vMansionIcon, "Mansion CameraMode Examples", "Cool example of how to use the CameraMode to create a CCTV or oldschool gameplay style", "Import Package", _vMansionPath, false);
|
||||
|
||||
DrawNewAddon(coverAddon, "Shooter Cover Add-on", "Advanced Cover mechanics to bring more Shooter action or Stealth approach for your game", "Go to AssetStore", "https://assetstore.unity.com/packages/tools/game-toolkits/invector-shooter-cover-add-on-204918", true);
|
||||
DrawNewAddon(pushAddon, "Push & Pull Add-on", "Push and Pull objects to create puzzles", "Go to AssetStore", "https://assetstore.unity.com/packages/tools/game-toolkits/invector-push-add-on-188670", true);
|
||||
DrawNewAddon(craftingAddon, "Crafting Add-on", "Expand Invector's Inventory System to create new items by combining two or more items into a new one.", "Go to AssetStore", "https://assetstore.unity.com/packages/templates/systems/invector-crafting-add-on-168799", true);
|
||||
DrawNewAddon(climbAddon, "FreeClimb Add-on", "Climb on any surface such as walls or cliffs.", "Go to AssetStore", "https://assetstore.unity.com/packages/tools/utilities/third-person-freeclimb-add-on-105187", true);
|
||||
DrawNewAddon(swimmingAddon, "Swimming Add-on", "Swim on the surface or dive into the water", "Go to AssetStore", "https://assetstore.unity.com/packages/tools/utilities/third-person-swimming-add-on-97418", true);
|
||||
DrawNewAddon(ziplineAddon, "Zipline Add-on", "Zipline through pre located ropes", "Go to AssetStore", "https://assetstore.unity.com/packages/tools/utilities/third-person-zipline-add-on-97410", true);
|
||||
DrawNewAddon(stealthKillAddon, "Stealth Kill Add-on (Free!)", "Example using the GenericAction feature, animations included.", "Go to AssetStore", "https://assetstore.unity.com/packages/templates/systems/invector-stealth-kill-add-on-135495", true);
|
||||
DrawNewAddon(builderAddon, "Builder Add-on", "Collect Items and Build them anywhere in your scene to create traps or interactables!", "Go to AssetStore", "https://assetstore.unity.com/packages/tools/utilities/third-person-builder-add-on-152689", true);
|
||||
|
||||
|
||||
GUILayout.EndScrollView();
|
||||
GUILayout.FlexibleSpace();
|
||||
GUILayout.EndVertical();
|
||||
}
|
||||
|
||||
private static void DrawNewAddon(Texture2D icon, string title, string description, string button, string path, bool useUrl)
|
||||
{
|
||||
GUILayout.BeginHorizontal("box");
|
||||
|
||||
GUILayout.Label(icon, GUI.skin.GetStyle("Icon"), GUILayout.Height(90), GUILayout.Width(90));
|
||||
|
||||
GUILayout.BeginVertical();
|
||||
GUILayout.Label(title, GUI.skin.GetStyle("Title"), GUILayout.Width(300));
|
||||
GUILayout.Label(description, GUILayout.Width(300));
|
||||
GUILayout.EndVertical();
|
||||
|
||||
if (GUILayout.Button(button))
|
||||
{
|
||||
if (useUrl)
|
||||
{
|
||||
Application.OpenURL(path);
|
||||
}
|
||||
else
|
||||
{
|
||||
AssetDatabase.ImportPackage(path, true);
|
||||
}
|
||||
}
|
||||
|
||||
GUILayout.EndHorizontal();
|
||||
}
|
||||
|
||||
public static void GettingStartedPageContent()
|
||||
{
|
||||
GUILayout.BeginVertical("window");
|
||||
|
||||
|
||||
GUILayout.BeginHorizontal("box");
|
||||
GUILayout.Label("<b>1</b>- First you need to Import our <b>ProjectSettings</b>, otherwise you will get errors about missing Inputs and Layers. Then create a new folder for your Project and put your files there, don't use the Invector Folder to avoid losing files when updating to a new version.");
|
||||
GUILayout.EndHorizontal();
|
||||
GUILayout.Space(6);
|
||||
|
||||
GUILayout.BeginHorizontal("box");
|
||||
GUILayout.Label("<b>2</b>- Never modify a default resource file (Animator, Prefabs, etc...) that comes with the template, instead" +
|
||||
" create a copy of the original file and place it inside your project folder.");
|
||||
GUILayout.EndHorizontal();
|
||||
GUILayout.Space(6);
|
||||
|
||||
GUILayout.BeginHorizontal("box");
|
||||
GUILayout.Label("<b>3</b>- When modifying the Invector scripts, make sure to comment the original source and create a #region for ex: 'MyCustomModification' " +
|
||||
"so it's easier to find and implement again once you update the template to a newer version.");
|
||||
GUILayout.EndHorizontal();
|
||||
GUILayout.Space(6);
|
||||
|
||||
if (GUILayout.Button("Guideline to Import/Update"))
|
||||
{
|
||||
Application.OpenURL("https://invector.proboards.com/thread/2896/guideline-import-update-invector-assets");
|
||||
}
|
||||
|
||||
|
||||
EditorGUILayout.HelpBox("- ALWAYS BACKUP your project before updating!", MessageType.Warning, true);
|
||||
EditorGUILayout.HelpBox("- To update your template you need to Delete the Invector folder, this way you won't get any conflicts between old files and newer files.", MessageType.Info, true);
|
||||
|
||||
GUILayout.FlexibleSpace();
|
||||
GUILayout.EndVertical();
|
||||
}
|
||||
|
||||
public static void Forum()
|
||||
{
|
||||
GUILayout.BeginVertical("window");
|
||||
|
||||
GUILayout.BeginVertical("box");
|
||||
EditorGUILayout.HelpBox("The Official Invector Forum is getting bigger every day, join the vCommunity too!\n\n- Get help from users \n- Community Add-ons created by users\n- Get feedback to your Project \n- Showcase your Game \n- Check the latests Integrations", MessageType.Info);
|
||||
if (GUILayout.Button("Open Forum"))
|
||||
{
|
||||
Application.OpenURL("http://invector.proboards.com/");
|
||||
}
|
||||
GUILayout.EndVertical();
|
||||
|
||||
GUILayout.Space(5);
|
||||
|
||||
GUILayout.BeginVertical("box");
|
||||
EditorGUILayout.HelpBox("Join the Official Invector Discord Channel to get help, talk with developers, share experiencies and more...", MessageType.Info);
|
||||
if (GUILayout.Button("Join Discord"))
|
||||
{
|
||||
Application.OpenURL("https://discord.gg/arWD8UPbgN");
|
||||
}
|
||||
GUILayout.EndVertical();
|
||||
|
||||
|
||||
GUILayout.FlexibleSpace();
|
||||
GUILayout.EndVertical();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5fc5f628a186dcc448c8511ddf750be4
|
||||
timeCreated: 1554144232
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,96 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
namespace Invector.vCharacterController
|
||||
{
|
||||
[CustomEditor(typeof(vThirdPersonController), true)]
|
||||
public class vThirdPersonControllerEditor : vEditorBase
|
||||
{
|
||||
public vThirdPersonController tp;
|
||||
public CapsuleCollider _capsuleCollider;
|
||||
public GUIStyle fontLabelStyle = new GUIStyle();
|
||||
|
||||
protected override void OnEnable()
|
||||
{
|
||||
base.OnEnable();
|
||||
tp = (vThirdPersonController)target;
|
||||
_capsuleCollider = tp.GetComponent<CapsuleCollider>();
|
||||
}
|
||||
|
||||
protected virtual void OnSceneGUI()
|
||||
{
|
||||
if (tp && tp.debugWindow)
|
||||
{
|
||||
if (!_capsuleCollider) return;
|
||||
|
||||
DrawGroundDetection();
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void DrawGroundDetection()
|
||||
{
|
||||
// TO DO NEW GROUND DETECTION DEBUG
|
||||
|
||||
|
||||
//var checkGroundCenter = tp.transform.position + Vector3.up * (_capsuleCollider.radius);
|
||||
//var pMin = checkGroundCenter + Vector3.down * (tp.groundMinDistance + _capsuleCollider.radius);
|
||||
//var pMax = checkGroundCenter + Vector3.down * (tp.groundMaxDistance + _capsuleCollider.radius);
|
||||
|
||||
//var pValid = pMin;
|
||||
//var colorMin = Color.yellow;
|
||||
//var colorMax = Color.yellow;
|
||||
|
||||
//if (tp.isGrounded)
|
||||
//{
|
||||
// pValid = pMax;
|
||||
// colorMax = Color.green;
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// pValid = pMin;
|
||||
// colorMin = Color.green;
|
||||
//}
|
||||
//Handles.color = colorMin;
|
||||
//Handles.DrawSolidDisc(pMin, tp.transform.up, _capsuleCollider.radius * .25f);
|
||||
//Handles.DrawWireDisc(pMin + Vector3.up * _capsuleCollider.radius, tp.transform.up, _capsuleCollider.radius * 1f);
|
||||
//Handles.color = colorMax;
|
||||
//if (tp.isGrounded)
|
||||
//{
|
||||
// Handles.DrawWireDisc(pMax + Vector3.up * _capsuleCollider.radius, tp.transform.up, _capsuleCollider.radius * 1f);
|
||||
//}
|
||||
//Handles.DrawSolidDisc(pMax, tp.transform.up, _capsuleCollider.radius * .25f);
|
||||
//Handles.color = Color.green;
|
||||
//Handles.DrawWireArc(pValid + Vector3.up * _capsuleCollider.radius, tp.transform.right, tp.transform.forward, 180, _capsuleCollider.radius * 1f);
|
||||
//Handles.DrawWireArc(pValid + Vector3.up * _capsuleCollider.radius, tp.transform.forward, tp.transform.right, -180, _capsuleCollider.radius * 1f);
|
||||
//Handles.color = Color.red * 0.5f;
|
||||
//if (Application.isPlaying)
|
||||
//{
|
||||
// if (tp.groundHit.collider)
|
||||
// {
|
||||
// Vector3 p = tp.transform.position;
|
||||
// p.y = tp.groundHit.point.y;
|
||||
// Handles.DrawSolidDisc(p, tp.groundHit.normal, _capsuleCollider.radius * 1f);
|
||||
// DrawLabel(p, "GroundHit");
|
||||
// }
|
||||
// else Handles.DrawSolidDisc(checkGroundCenter + Vector3.down * (tp.groundMaxDistance + _capsuleCollider.radius), tp.transform.up, _capsuleCollider.radius * 1f);
|
||||
//}
|
||||
|
||||
//Handles.color = Color.white;
|
||||
//DrawLabel(pMin, "GroundMin");
|
||||
//DrawLabel(pMax, "GroundMax");
|
||||
}
|
||||
|
||||
|
||||
|
||||
protected virtual void DrawLabel(Vector3 position, string label, int size = 25)
|
||||
{
|
||||
float zoom = Vector3.Distance(position, SceneView.currentDrawingSceneView.camera.transform.position);
|
||||
int fontSize = size;
|
||||
fontLabelStyle.fontSize = Mathf.FloorToInt(fontSize / zoom);
|
||||
fontLabelStyle.normal.textColor = Color.black;
|
||||
fontLabelStyle.alignment = TextAnchor.MiddleLeft;
|
||||
Handles.Label(position, label, fontLabelStyle);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 98c54e356287a1f4b8aa83f49ada1532
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user