public ETCDPad() { axisX = new ETCAxis("Horizontal"); axisY = new ETCAxis("Vertical"); _visible = true; _activated = true; dPadAxisCount = DPadAxis.Two_Axis; tmpAxis = Vector2.zero; showPSInspector = true; showSpriteInspector = false; showBehaviourInspector = false; showEventInspector = false; isOnDrag = false; isOnTouch = false; axisX.positivekey = KeyCode.RightArrow; axisX.negativeKey = KeyCode.LeftArrow; axisY.positivekey = KeyCode.UpArrow; axisY.negativeKey = KeyCode.DownArrow; enableKeySimulation = true; #if !UNITY_EDITOR enableKeySimulation = false; #endif }
public ETCJoystick() { joystickType = JoystickType.Static; allowJoystickOverTouchPad = false; radiusBase = RadiusBase.Width; axisX = new ETCAxis("Horizontal"); axisY = new ETCAxis("Vertical"); _visible = true; _activated = true; joystickArea = JoystickArea.FullScreen; isDynamicActif = false; isOnDrag = false; isOnTouch = false; axisX.unityAxis = "Horizontal"; axisY.unityAxis = "Vertical"; enableKeySimulation = true; isNoReturnThumb = false; showPSInspector = false; showAxesInspector = false; showEventInspector = false; showSpriteInspector = false; }
public ETCJoystick() { joystickType = JoystickType.Static; allowJoystickOverTouchPad = false; radiusBase = RadiusBase.Width; axisX = new ETCAxis("Horizontal"); axisY = new ETCAxis("Vertical"); _visible = true; _activated = true; joystickArea = JoystickArea.FullScreen; isDynamicActif = false; isOnDrag = false; isOnTouch = false; axisX.positivekey = KeyCode.RightArrow; axisX.negativeKey = KeyCode.LeftArrow; axisY.positivekey = KeyCode.UpArrow; axisY.negativeKey = KeyCode.DownArrow; enableKeySimulation = true; showPSInspector = true; showAxesInspector = false; showEventInspector = false; showSpriteInspector = false; }
private void TurnAndMove(ETCAxis X, ETCAxis Y, ETCJoystick j) { EditorGUI.indentLevel++; X.autoLinkTagPlayer = EditorGUILayout.ToggleLeft("Auto link on tag", X.autoLinkTagPlayer, GUILayout.Width(200)); if (X.autoLinkTagPlayer) { X.autoTag = EditorGUILayout.TagField("", X.autoTag); } if (!X.autoLinkTagPlayer) { X.directTransform = (Transform)EditorGUILayout.ObjectField("Direct action to", X.directTransform, typeof(Transform), true); } EditorGUILayout.Space(); if (j.tmMoveCurve == null) { j.InitTurnMoveCurve(); } j.tmMoveCurve = EditorGUILayout.CurveField("Move curve", j.tmMoveCurve); j.tmSpeed = EditorGUILayout.FloatField("Move speed", j.tmSpeed); j.tmAdditionnalRotation = EditorGUILayout.FloatField("Intial rotation", j.tmAdditionnalRotation); j.tmLockInJump = EditorGUILayout.Toggle("Lock in jump", j.tmLockInJump); X.gravity = EditorGUILayout.FloatField("Gravity", X.gravity); EditorGUI.indentLevel--; }
private void UnRegisterAxis(ETCAxis axis) { if (ETCInput.instance.axes.ContainsKey(axis.name)) { axes.Remove(axis.name); } }
public ETCButton() { //delete //joystickType = JoystickType.Static; //allowJoystickOverTouchPad = false; //joystickArea = JoystickArea.FullScreen; //isDynamicActif = false; axis = new ETCAxis("Button"); _visible = true; _activated = true; isOnTouch = false; enableKeySimulation = true; #if !UNITY_EDITOR enableKeySimulation = false; #endif axis.positivekey = KeyCode.Space; showPSInspector = true; showSpriteInspector = false; showBehaviourInspector = false; showEventInspector = false; }
private void RegisterAxis(ETCAxis axis){ if (ETCInput.instance.axes.ContainsKey( axis.name)){ Debug.LogWarning("ETCInput axis : " + axis.name + " already exists"); } else{ axes.Add( axis.name,axis); } }
public ETCButton() { axis = new ETCAxis("Button"); _visible = true; _activated = true; isOnTouch = false; enableKeySimulation = true; axis.unityAxis = "Jump"; showPSInspector = true; showSpriteInspector = false; showBehaviourInspector = false; showEventInspector = false; }
public ETCButton() { axis = new ETCAxis("Button"); _visible = true; _activated = true; isOnTouch = false; enableKeySimulation = true; #if !UNITY_EDITOR enableKeySimulation = false; #endif axis.positivekey = KeyCode.Space; showPSInspector = true; showSpriteInspector = false; showBehaviourInspector = false; showEventInspector = false; }
public ETCTouchPad() { axisX = new ETCAxis("Horizontal"); axisX.speed = 1; axisY = new ETCAxis("Vertical"); axisY.speed = 1; _visible = true; _activated = true; showPSInspector = true; showSpriteInspector = false; showBehaviourInspector = false; showEventInspector = false; tmpAxis = Vector2.zero; isOnDrag = false; isOnTouch = false; axisX.positivekey = KeyCode.RightArrow; axisX.negativeKey = KeyCode.LeftArrow; axisY.positivekey = KeyCode.UpArrow; axisY.negativeKey = KeyCode.DownArrow; enableKeySimulation = true; #if !UNITY_EDITOR enableKeySimulation = false; #endif isOut = false; axisX.axisState = ETCAxis.AxisState.None; useFixedUpdate = false; isDPI = false; }
public ETCTouchPad() { axisX = new ETCAxis("Horizontal"); axisX.speed = 1; axisY = new ETCAxis("Vertical"); axisY.speed = 1; _visible = true; _activated = true; showPSInspector = true; showSpriteInspector = false; showBehaviourInspector = false; showEventInspector = false; tmpAxis = Vector2.zero; isOnDrag = false; isOnTouch = false; axisX.unityAxis = "Horizontal"; axisY.unityAxis = "Vertical"; enableKeySimulation = true; #if !UNITY_EDITOR && !UNITY_STANDALONE_WIN enableKeySimulation = false; #endif isOut = false; axisX.axisState = ETCAxis.AxisState.None; useFixedUpdate = false; isDPI = false; }
public ETCDPad() { axisX = new ETCAxis("Horizontal"); axisY = new ETCAxis("Vertical"); _visible = true; _activated = true; dPadAxisCount = DPadAxis.Two_Axis; tmpAxis = Vector2.zero; showPSInspector = true; showSpriteInspector = false; showBehaviourInspector = false; showEventInspector = false; isOnDrag = false; isOnTouch = false; axisX.unityAxis = "Horizontal"; axisY.unityAxis = "Vertical"; enableKeySimulation = true; }
public static void AxisInspector(ETCAxis axis, string label, ETCBase.ControlType type, bool turnMove = false, string[] unityAxes = null) { EditorGUILayout.BeginHorizontal(); //GUI.color = color; axis.enable = ETCGuiTools.Toggle(label + " axis : ", axis.enable, true, 125, true); //GUI.color = Color.white; axis.name = EditorGUILayout.TextField("", axis.name, GUILayout.MinWidth(50)); EditorGUILayout.EndHorizontal(); if (axis.enable) { EditorGUI.indentLevel++; #region General //EditorGUILayout.LabelField( "General",EditorStyles.boldLabel); axis.showGeneralInspector = EditorGUILayout.Foldout(axis.showGeneralInspector, "General setting"); if (axis.showGeneralInspector) { ETCGuiTools.BeginGroup(20); { EditorGUI.indentLevel--; axis.actionOn = (ETCAxis.ActionOn)EditorGUILayout.EnumPopup("React on", axis.actionOn); EditorGUILayout.Space(); if (type == ETCBase.ControlType.Joystick) { axis.valueMethod = (ETCAxis.AxisValueMethod)EditorGUILayout.EnumPopup("Dead zone method", axis.valueMethod); switch (axis.valueMethod) { case ETCAxis.AxisValueMethod.Classical: axis.deadValue = EditorGUILayout.Slider("Dead length", axis.deadValue, 0f, 1f); break; case ETCAxis.AxisValueMethod.Curve: if (axis.curveValue == null) { axis.InitDeadCurve(); } axis.curveValue = EditorGUILayout.CurveField("Sensitivity curve", axis.curveValue); break; } } EditorGUILayout.Space(); axis.invertedAxis = ETCGuiTools.Toggle("Inverted axis", axis.invertedAxis, true); EditorGUILayout.Space(); #region Button & DPAD Value over the time if (type == ETCBase.ControlType.Button || type == ETCBase.ControlType.DPad) { axis.isValueOverTime = ETCGuiTools.Toggle("Value over the time", axis.isValueOverTime, true); if (axis.isValueOverTime) { //EditorGUI.indentLevel--; ETCGuiTools.BeginGroup(5); { axis.overTimeStep = EditorGUILayout.FloatField("Step", axis.overTimeStep); axis.maxOverTimeValue = EditorGUILayout.FloatField("Max value", axis.maxOverTimeValue); } ETCGuiTools.EndGroup(); //EditorGUI.indentLevel++; } } #endregion #region Joysick if (type == ETCBase.ControlType.Joystick) { axis.axisThreshold = EditorGUILayout.Slider("On/Off Threshold", axis.axisThreshold, 0f, 1f); } #endregion if (!turnMove) { string labelspeed = "Speed"; if (type == ETCBase.ControlType.TouchPad) { labelspeed = "Sensitivity"; } axis.speed = EditorGUILayout.FloatField(labelspeed, axis.speed); } EditorGUI.indentLevel++; } ETCGuiTools.EndGroup(); } #endregion if (!turnMove) { #region Direction Action axis.showDirectInspector = EditorGUILayout.Foldout(axis.showDirectInspector, "Direction ation (optional)"); if (axis.showDirectInspector) { ETCGuiTools.BeginGroup(20); { EditorGUI.indentLevel--; //EditorGUILayout.BeginHorizontal(); axis.autoLinkTagPlayer = EditorGUILayout.ToggleLeft("Auto link on tag", axis.autoLinkTagPlayer, GUILayout.Width(200)); if (axis.autoLinkTagPlayer) { axis.autoTag = EditorGUILayout.TagField("", axis.autoTag); } //EditorGUILayout.EndHorizontal(); if (!axis.autoLinkTagPlayer) { axis.directTransform = (Transform)EditorGUILayout.ObjectField("Direct action to", axis.directTransform, typeof(Transform), true); } axis.directAction = (ETCAxis.DirectAction)EditorGUILayout.EnumPopup("Action", axis.directAction); if (axis.directAction != ETCAxis.DirectAction.Jump) { axis.axisInfluenced = (ETCAxis.AxisInfluenced)EditorGUILayout.EnumPopup("Affected axis", axis.axisInfluenced); } else { EditorGUILayout.HelpBox("Required character controller", MessageType.Info); } if ((axis.directCharacterController || axis.autoLinkTagPlayer) && (axis.directAction == ETCAxis.DirectAction.Translate || axis.directAction == ETCAxis.DirectAction.TranslateLocal)) { axis.isLockinJump = EditorGUILayout.Toggle("Lock in jump", axis.isLockinJump); if (axis.autoLinkTagPlayer) { EditorGUILayout.HelpBox("Required character controller", MessageType.Info); } } EditorGUI.indentLevel++; } ETCGuiTools.EndGroup(); } #endregion #region smooth & inertia axis.showInertiaInspector = EditorGUILayout.Foldout(axis.showInertiaInspector, "Gravity-Inertia-smoothing..."); if (axis.showInertiaInspector) { ETCGuiTools.BeginGroup(20); { EditorGUI.indentLevel--; if (axis.directCharacterController != null || axis.autoLinkTagPlayer) { axis.gravity = EditorGUILayout.FloatField("Gravity", axis.gravity); } // Inertia axis.isEnertia = ETCGuiTools.Toggle("Enable inertia", axis.isEnertia, true); if (axis.isEnertia) { //EditorGUI.indentLevel--; ETCGuiTools.BeginGroup(5); { axis.inertia = EditorGUILayout.Slider("Inertia", axis.inertia, 1f, 500f); axis.inertiaThreshold = EditorGUILayout.FloatField("Threshold", axis.inertiaThreshold); } ETCGuiTools.EndGroup(); //EditorGUI.indentLevel++; } // AutoStab & clamp rotation if (axis.directAction == ETCAxis.DirectAction.RotateLocal) { //AutoStab axis.isAutoStab = ETCGuiTools.Toggle("Automatic stabilization", axis.isAutoStab, true); if (axis.isAutoStab) { //EditorGUI.indentLevel--; ETCGuiTools.BeginGroup(5); { axis.autoStabSpeed = EditorGUILayout.FloatField("Speed", axis.autoStabSpeed); axis.autoStabThreshold = EditorGUILayout.FloatField("Threshold ", axis.autoStabThreshold); } ETCGuiTools.EndGroup(); //EditorGUI.indentLevel++; } // clamp rotation axis.isClampRotation = ETCGuiTools.Toggle("Clamp rotation", axis.isClampRotation, true); if (axis.isClampRotation) { //EditorGUI.indentLevel--; ETCGuiTools.BeginGroup(5); { axis.maxAngle = EditorGUILayout.FloatField("Max angle", axis.maxAngle); axis.minAngle = EditorGUILayout.FloatField("Min angle", axis.minAngle); } ETCGuiTools.EndGroup(); //EditorGUI.indentLevel++; } } EditorGUI.indentLevel++; } ETCGuiTools.EndGroup(); } #endregion } #region Unity axes axis.showSimulatinInspector = EditorGUILayout.Foldout(axis.showSimulatinInspector, "Unity axes"); if (axis.showSimulatinInspector) { ETCGuiTools.BeginGroup(20); { EditorGUI.indentLevel--; int index = System.Array.IndexOf(unityAxes, axis.unityAxis); int tmpIndex = EditorGUILayout.Popup(index, unityAxes); if (tmpIndex != index) { axis.unityAxis = unityAxes[tmpIndex]; } EditorGUI.indentLevel++; } ETCGuiTools.EndGroup(); } #endregion EditorGUI.indentLevel--; } }
private void TurnAndMove(ETCAxis X, ETCAxis Y, ETCJoystick j) { EditorGUI.indentLevel++; X.autoLinkTagPlayer = EditorGUILayout.ToggleLeft("Auto link on tag",X.autoLinkTagPlayer, GUILayout.Width(200)); if (X.autoLinkTagPlayer){ X.autoTag = EditorGUILayout.TagField("",X.autoTag); } if (!X.autoLinkTagPlayer){ X.directTransform = (Transform)EditorGUILayout.ObjectField("Direct action to",X.directTransform,typeof(Transform),true); } EditorGUILayout.Space(); if (j.tmMoveCurve==null){ j.InitTurnMoveCurve(); } j.tmMoveCurve = EditorGUILayout.CurveField("Move curve",j.tmMoveCurve); j.tmSpeed = EditorGUILayout.FloatField("Move speed",j.tmSpeed); j.tmAdditionnalRotation = EditorGUILayout.FloatField("Intial rotation",j.tmAdditionnalRotation); j.tmLockInJump = EditorGUILayout.Toggle("Lock in jump",j.tmLockInJump); X.gravity = EditorGUILayout.FloatField("Gravity",X.gravity); EditorGUI.indentLevel--; }
private void RegisterAxis(ETCAxis axis) { if (ETCInput.instance.axes.ContainsKey( axis.name)){ Debug.LogWarning("ETCInput axis : " + axis.name + " already exists"); } else{ axes.Add( axis.name,axis); } }
public static void SetAxisDirectAction(string axisName, ETCAxis.DirectAction value) { if (ETCInput.instance.axes.TryGetValue( axisName, out axis)){ axis.directAction = value; } else{ Debug.LogWarning("ETCInput : " + axisName + " doesn't exist"); } }
public static void SetAxisAffectedAxis(string axisName, ETCAxis.AxisInfluenced value) { if (ETCInput.instance.axes.TryGetValue( axisName, out axis)){ axis.axisInfluenced = value; } else{ Debug.LogWarning("ETCInput : " + axisName + " doesn't exist"); } }
private void UnRegisterAxis(ETCAxis axis) { if (ETCInput.instance.axes.ContainsKey( axis.name)){ axes.Remove( axis.name); } }
public static void AxisInspector(ETCAxis axis, string label, ETCBase.ControlType type) { EditorGUILayout.BeginHorizontal(); //GUI.color = color; axis.enable = ETCGuiTools.Toggle(label + " axis : ",axis.enable,true,125,true); //GUI.color = Color.white; axis.name = EditorGUILayout.TextField("",axis.name,GUILayout.MinWidth(50)); EditorGUILayout.EndVertical(); if (axis.enable){ EditorGUI.indentLevel++; axis.invertedAxis = ETCGuiTools.Toggle("Inverted axis",axis.invertedAxis,true); if (type == ETCBase.ControlType.Joystick ){ axis.deadValue = EditorGUILayout.Slider("Dead lenght",axis.deadValue,0f,1f); } if (type == ETCBase.ControlType.Button || type == ETCBase.ControlType.DPad){ axis.isValueOverTime = ETCGuiTools.Toggle("Value over the time",axis.isValueOverTime,true); if (axis.isValueOverTime){ //EditorGUI.indentLevel--; ETCGuiTools.BeginGroup(5);{ axis.overTimeStep = EditorGUILayout.FloatField("Step",axis.overTimeStep); axis.maxOverTimeValue = EditorGUILayout.FloatField("Max value",axis.maxOverTimeValue); }ETCGuiTools.EndGroup(); //EditorGUI.indentLevel++; } } if (type == ETCBase.ControlType.Joystick ){ axis.axisThreshold = EditorGUILayout.Slider("On/Off Threshold",axis.axisThreshold,0f,1f); } string labelspeed = "Speed"; if (type== ETCBase.ControlType.TouchPad){ labelspeed ="Sensitivity"; } axis.speed = EditorGUILayout.FloatField(labelspeed,axis.speed); // Direct properties EditorGUILayout.Space(); axis.actionOn = (ETCAxis.ActionOn)EditorGUILayout.EnumPopup("Action on",axis.actionOn ); axis.directTransform = (Transform)EditorGUILayout.ObjectField("Direct action to",axis.directTransform,typeof(Transform),true); axis.directAction = (ETCAxis.DirectAction ) EditorGUILayout.EnumPopup( "Action",axis.directAction); axis.axisInfluenced = (ETCAxis.AxisInfluenced) EditorGUILayout.EnumPopup("Affected axis",axis.axisInfluenced); EditorGUILayout.Space(); if ( axis.directCharacterController!=null){ axis.gravity = EditorGUILayout.FloatField("Gravity",axis.gravity); } //if (type != ETCBase.ControlType.TouchPad){ // Inertia axis.isEnertia = ETCGuiTools.Toggle("Enable inertia", axis.isEnertia,true); if (axis.isEnertia){ EditorGUI.indentLevel--; ETCGuiTools.BeginGroup(20);{ axis.inertia = EditorGUILayout.Slider("Inertia",axis.inertia,1f,500f); axis.inertiaThreshold = EditorGUILayout.FloatField("Threshold",axis.inertiaThreshold); }ETCGuiTools.EndGroup(); EditorGUI.indentLevel++; } // AutoStab & clamp rotation if (axis.directAction == ETCAxis.DirectAction.RotateLocal ){ //AutoStab axis.isAutoStab = ETCGuiTools.Toggle("Automatic stabilization",axis.isAutoStab,true); if (axis.isAutoStab){ EditorGUI.indentLevel--; ETCGuiTools.BeginGroup(20);{ axis.autoStabSpeed = EditorGUILayout.FloatField("Speed",axis.autoStabSpeed); axis.autoStabThreshold = EditorGUILayout.FloatField("Threshold ", axis.autoStabThreshold); }ETCGuiTools.EndGroup(); EditorGUI.indentLevel++; } // clamp rotation axis.isClampRotation = ETCGuiTools.Toggle("Clamp rotation",axis.isClampRotation,true); if (axis.isClampRotation){ EditorGUI.indentLevel--; ETCGuiTools.BeginGroup(20);{ axis.maxAngle = EditorGUILayout.FloatField("Max angle",axis.maxAngle); axis.minAngle = EditorGUILayout.FloatField("Min angle",axis.minAngle); }ETCGuiTools.EndGroup(); EditorGUI.indentLevel++; } } //} EditorGUI.indentLevel--; } }
public static void AxisInspector(ETCAxis axis, string label, ETCBase.ControlType type) { EditorGUILayout.BeginHorizontal(); //GUI.color = color; axis.enable = ETCGuiTools.Toggle(label + " axis : ", axis.enable, true, 125, true); //GUI.color = Color.white; axis.name = EditorGUILayout.TextField("", axis.name, GUILayout.MinWidth(50)); EditorGUILayout.EndHorizontal(); if (axis.enable) { EditorGUI.indentLevel++; axis.invertedAxis = ETCGuiTools.Toggle("Inverted axis", axis.invertedAxis, true); if (type == ETCBase.ControlType.Joystick) { axis.deadValue = EditorGUILayout.Slider("Dead lenght", axis.deadValue, 0f, 1f); } if (type == ETCBase.ControlType.Button || type == ETCBase.ControlType.DPad) { axis.isValueOverTime = ETCGuiTools.Toggle("Value over the time", axis.isValueOverTime, true); if (axis.isValueOverTime) { //EditorGUI.indentLevel--; ETCGuiTools.BeginGroup(5); { axis.overTimeStep = EditorGUILayout.FloatField("Step", axis.overTimeStep); axis.maxOverTimeValue = EditorGUILayout.FloatField("Max value", axis.maxOverTimeValue); } ETCGuiTools.EndGroup(); //EditorGUI.indentLevel++; } } if (type == ETCBase.ControlType.Joystick) { axis.axisThreshold = EditorGUILayout.Slider("On/Off Threshold", axis.axisThreshold, 0f, 1f); } string labelspeed = "Speed"; if (type == ETCBase.ControlType.TouchPad) { labelspeed = "Sensitivity"; } axis.speed = EditorGUILayout.FloatField(labelspeed, axis.speed); // Direct properties EditorGUILayout.Space(); axis.actionOn = (ETCAxis.ActionOn)EditorGUILayout.EnumPopup("Action on", axis.actionOn); axis.directTransform = (Transform)EditorGUILayout.ObjectField("Direct action to", axis.directTransform, typeof(Transform), true); axis.directAction = (ETCAxis.DirectAction)EditorGUILayout.EnumPopup("Action", axis.directAction); axis.axisInfluenced = (ETCAxis.AxisInfluenced)EditorGUILayout.EnumPopup("Affected axis", axis.axisInfluenced); EditorGUILayout.Space(); if (axis.directCharacterController != null) { axis.gravity = EditorGUILayout.FloatField("Gravity", axis.gravity); } //if (type != ETCBase.ControlType.TouchPad){ // Inertia axis.isEnertia = ETCGuiTools.Toggle("Enable inertia", axis.isEnertia, true); if (axis.isEnertia) { EditorGUI.indentLevel--; ETCGuiTools.BeginGroup(20); { axis.inertia = EditorGUILayout.Slider("Inertia", axis.inertia, 1f, 500f); axis.inertiaThreshold = EditorGUILayout.FloatField("Threshold", axis.inertiaThreshold); } ETCGuiTools.EndGroup(); EditorGUI.indentLevel++; } // AutoStab & clamp rotation if (axis.directAction == ETCAxis.DirectAction.RotateLocal) { //AutoStab axis.isAutoStab = ETCGuiTools.Toggle("Automatic stabilization", axis.isAutoStab, true); if (axis.isAutoStab) { EditorGUI.indentLevel--; ETCGuiTools.BeginGroup(20); { axis.autoStabSpeed = EditorGUILayout.FloatField("Speed", axis.autoStabSpeed); axis.autoStabThreshold = EditorGUILayout.FloatField("Threshold ", axis.autoStabThreshold); } ETCGuiTools.EndGroup(); EditorGUI.indentLevel++; } // clamp rotation axis.isClampRotation = ETCGuiTools.Toggle("Clamp rotation", axis.isClampRotation, true); if (axis.isClampRotation) { EditorGUI.indentLevel--; ETCGuiTools.BeginGroup(20); { axis.maxAngle = EditorGUILayout.FloatField("Max angle", axis.maxAngle); axis.minAngle = EditorGUILayout.FloatField("Min angle", axis.minAngle); } ETCGuiTools.EndGroup(); EditorGUI.indentLevel++; } } //} EditorGUILayout.Space(); axis.positivekey = (UnityEngine.KeyCode)EditorGUILayout.EnumPopup("Positive key", axis.positivekey); axis.negativeKey = (UnityEngine.KeyCode)EditorGUILayout.EnumPopup("Negative key", axis.negativeKey); EditorGUI.indentLevel--; } }