public new static GameObject GetTargetGameObject(InputEvent.InputType inputType, GameObject gameObject) { HumanoidControl humanoid = gameObject.GetComponent <HumanoidControl>(); if (humanoid == null) { return(gameObject); } switch ((ControllerInput.InputType)inputType) { case ControllerInput.InputType.None: return(null); case ControllerInput.InputType.Head: return(humanoid.headTarget.gameObject); case ControllerInput.InputType.LeftHand: return(humanoid.leftHandTarget.gameObject); case ControllerInput.InputType.RightHand: return(humanoid.rightHandTarget.gameObject); case ControllerInput.InputType.Humanoid: return(humanoid.gameObject); default: return(gameObject); } }
public static void SetInputFunction(SerializedProperty inputProp, ref InputEvent input, GameObject gameObject, GetTargetGameObjectF GetGameObject = null, SetInputTypeF SetInputType = null) { if (GetGameObject == null) { GetGameObject = GetTargetGameObject; } if (SetInputType == null) { SetInputType = InputTypePopup; } SerializedProperty targetGameObjectProp = inputProp.FindPropertyRelative("targetGameObject"); SerializedProperty typeProp = inputProp.FindPropertyRelative("type"); if (input.targetGameObject == null) { input.type = 0; } InputEvent.InputType inputType = (InputEvent.InputType)input.type; if (!(inputType == InputEvent.InputType.GameObject && input.targetGameObject != null)) { InputEvent.InputType newType = SetInputType(inputType); if (newType != inputType) { input.methodIndex = 0; input.methodName = ""; input.animatorParameterIndex = 0; } switch (newType) { case InputEvent.InputType.None: break; #if PLAYMAKER case InputEvent.InputType.Playmaker: #endif case InputEvent.InputType.Animator: case InputEvent.InputType.GameObject: input.targetGameObject = gameObject; break; default: input.targetGameObject = GetGameObject(newType, gameObject); newType = InputEvent.InputType.GameObject; break; } input.type = (int)newType; } SetInput(inputProp, ref input); typeProp.intValue = input.type; targetGameObjectProp.objectReferenceValue = input.targetGameObject; }
public static InputEvent.InputType InputTypePopup(InputEvent.InputType inputType, string[] values) { values[0] = " "; InputEvent.InputType newType; if (inputType == 0) { newType = (InputEvent.InputType)EditorGUILayout.Popup((int)inputType, values); } else { newType = (InputEvent.InputType)EditorGUILayout.Popup((int)inputType, values, GUILayout.Width(150)); } return(newType); }
public new static GameObject GetTargetGameObject(InputEvent.InputType inputType, GameObject gameObject) { HandTarget handTarget = gameObject.GetComponent <HandTarget>(); if (handTarget == null) { return(gameObject); } switch ((HandInput.InputType)inputType) { case HandInput.InputType.None: return(null); case HandInput.InputType.Hand: return(handTarget.gameObject); case HandInput.InputType.Humanoid: return(handTarget.humanoid.gameObject); default: return(gameObject); } }
private new static InputEvent.InputType InputTypePopup(InputEvent.InputType inputType) { string[] values = System.Enum.GetNames(typeof(ControllerInput.InputType)); return(InputTypePopup(inputType, values)); }
public static InputEvent.InputType InputTypePopup(InputEvent.InputType inputType) { string[] values = System.Enum.GetNames(inputType.GetType()); return(InputTypePopup(inputType, values)); }
public static GameObject GetTargetGameObject(InputEvent.InputType inputType, GameObject gameObject) { return(gameObject); }
private bool CheckFlag(byte value, InputEvent.InputType t) { return((value & (byte)t) == (byte)t); }