// Update is called once per frame void Update() { if (_easyJoystick != null) { RecieveInput(); if (_stunBehaviour.GetStunedValue() == false) { MovePlayer(); UpdateCharAnimations(); } // TODO Barulho dos passos //UpdateMoveStatus(); //SoundManager.Instance.UpdateRunningAudio(GetSpeedToUseOnMoveCheck()); } else { if (GameObject.Find("ScreenJoystick").GetComponentInChildren <EasyJoystick>() != null) { _easyJoystick = GameObject.Find("ScreenJoystick").GetComponentInChildren <EasyJoystick>(); } } #if UNITY_EDITOR if (Input.GetKeyDown(KeyCode.Space)) { Fire(); } #endif }
internal void Start() { try { if (m_JoyStick != null) { m_JoyStickObj = UnityEngine.GameObject.Instantiate(m_JoyStick) as UnityEngine.GameObject; if (m_JoyStickObj != null) { m_JoyStickObj.transform.position = UnityEngine.Vector3.zero; EasyJoystick joyStickScript = m_JoyStickObj.GetComponentInChildren <EasyJoystick>(); if (joyStickScript != null) { joyStickScript.JoystickPositionOffset = new UnityEngine.Vector2( m_JoyStickPosPercent.x * Screen.width, m_JoyStickPosPercent.y * Screen.height); } JoyStickEnable = true; JoyStickEnable = false; } } } catch (System.Exception ex) { ArkCrossEngine.LogicSystem.LogErrorFromGfx("Exception {0}\n{1}", ex.Message, ex.StackTrace); } }
void OnEnable() { paddingStyle1 = new GUIStyle(); paddingStyle1.padding = new RectOffset(15, 0, 0, 0); EasyJoystick t = (EasyJoystick)target; if (t.areaTexture == null) { t.areaTexture = (Texture)Resources.Load("RadialJoy_Area"); EditorUtility.SetDirty(t); } if (t.touchTexture == null) { t.touchTexture = (Texture)Resources.Load("RadialJoy_Touch"); EditorUtility.SetDirty(t); } if (t.deadTexture == null) { t.deadTexture = (Texture)Resources.Load("RadialJoy_Dead"); EditorUtility.SetDirty(t); } t.showDebugRadius = true; }
// Use this for initialization void Start() { UIBag = GameObject.Find("bag"); UIBar = GameObject.Find("bars"); UIDrawBar = Camera.main.GetComponent <draw_bar> (); UILeftJoy = GameObject.Find("MovingJoystick").GetComponent <EasyJoystick> (); UIRightJoy = GameObject.Find("AttackJoystick").GetComponent <EasyJoystick> (); Invoke("HideBag", 0.01f); }
void OnJoyStickBegin(MovingJoystick move) { if (_avatarObj == null) { return; } TouchRect = EasyJoystick.GetTouchRect(); _bTouchMouse = true; }
void Start() { _keyState.Clear(); _easyTouch = GetComponentInChildren <EasyTouch>(); _joystick = GetComponentInChildren <EasyJoystick>(); _easyButton = GetComponentInChildren <EasyButton>(); UpdateInput(); }
void Start() { m_Joystick = this.GetComponentInChildren <EasyJoystick>(); m_Button = this.GetComponentInChildren <EasyButton>(); if (m_Joystick == null || m_Button == null) { this.LogError("Start() m_Joystick == null || m_Button == null!"); } }
public static void SetActive(bool active) { if (null != m_JoyStickObj) { EasyJoystick ej = m_JoyStickObj.GetComponentInChildren <EasyJoystick>(); if (null != ej) { ej.isActivated = active; } } }
private static void HideJoyStick() { if (m_JoyStickObj != null) { EasyJoystick ej = m_JoyStickObj.GetComponentInChildren <EasyJoystick>(); if (null != ej) { ej.CreateEvent(EasyJoystick.MessageName.On_JoystickMoveEnd); } m_JoyStickObj.SetActive(false); } }
private static void ShowJoyStick() { if (m_JoyStickObj != null) { m_JoyStickObj.SetActive(true); EasyJoystick ej = m_JoyStickObj.GetComponentInChildren <EasyJoystick>(); if (null != ej) { ej.JoystickTouch = UnityEngine.Vector2.zero; } } }
// Use this for initialization void Start () { inputType = GameManager.Instance.inputType; if(inputType == InputType.WASDInput) { } else if(inputType == InputType.TouchInput) { joystick = GameManager.Instance.joystick; } cameraTransform = PlayerCamera.Instance.childTransform; }
void Start() { if (!dynamicJoystick) { joystickCenter = joystickPosition; virtualJoystick = true; instance = this; } else { virtualJoystick = false; } }
// Use this for initialization void Start() { inputType = GameManager.inputType; if (inputType == InputType.WASDInput) { } else if (inputType == InputType.TouchInput) { joystick = GameObject.FindGameObjectWithTag("GameController").GetComponent <EasyJoystick>(); } }
// Token: 0x0600059D RID: 1437 RVA: 0x00029260 File Offset: 0x00027660 private void CreateEvent(EasyJoystick.MessageName message) { MovingJoystick movingJoystick = new MovingJoystick(); movingJoystick.joystickName = base.gameObject.name; movingJoystick.joystickAxis = this.joystickAxis; movingJoystick.joystickValue = this.joystickValue; if (!this.useBroadcast) { if (message != EasyJoystick.MessageName.On_JoystickMove) { if (message == EasyJoystick.MessageName.On_JoystickMoveEnd) { if (EasyJoystick.On_JoystickMoveEnd != null) { EasyJoystick.On_JoystickMoveEnd(movingJoystick); } } } else if (EasyJoystick.On_JoystickMove != null) { EasyJoystick.On_JoystickMove(movingJoystick); } } else { EasyJoystick.Broadcast broadcast = this.messageMode; if (broadcast != EasyJoystick.Broadcast.BroadcastMessage) { if (broadcast != EasyJoystick.Broadcast.SendMessage) { if (broadcast == EasyJoystick.Broadcast.SendMessageUpwards) { this.ReceiverObjectGame.SendMessageUpwards(message.ToString(), movingJoystick, SendMessageOptions.DontRequireReceiver); } } else { this.ReceiverObjectGame.SendMessage(message.ToString(), movingJoystick, SendMessageOptions.DontRequireReceiver); } } else { this.ReceiverObjectGame.BroadcastMessage(message.ToString(), movingJoystick, SendMessageOptions.DontRequireReceiver); } } }
static int get_joystick(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); MovingJoystick obj = (MovingJoystick)o; EasyJoystick ret = obj.joystick; ToLua.Push(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index joystick on a nil value")); } }
static int set_joystick(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); MovingJoystick obj = (MovingJoystick)o; EasyJoystick arg0 = (EasyJoystick)ToLua.CheckObject <EasyJoystick>(L, 2); obj.joystick = arg0; return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index joystick on a nil value")); } }
void OnEnable(){ EasyJoystick t = (EasyJoystick)target; if (t.areaTexture==null){ t.areaTexture = (Texture)Resources.Load("RadialJoy_Area"); EditorUtility.SetDirty(t); } if (t.touchTexture==null){ t.touchTexture = (Texture)Resources.Load("RadialJoy_Touch"); EditorUtility.SetDirty(t); } if (t.deadTexture==null){ t.deadTexture = (Texture)Resources.Load("RadialJoy_Dead"); EditorUtility.SetDirty(t); } t.selected = true; }
void Awake() { DontDestroyOnLoad(gameObject); joystick = GameObject.FindGameObjectWithTag("GameController").GetComponent<EasyJoystick>(); #if UNITY_EDITOR || UNITY_WEBPLAYER inputType = InputType.WASDInput; Debug.LogWarning("wasd"); joystick.gameObject.SetActive(false); #endif #if UNITY_IPHONE inputType = InputType.TouchInput; Debug.Log("wtf"); #endif #if UNITY_ANDROID && !UNITY_EDITOR inputType = InputType.WASDInput; #endif }
void Awake() { DontDestroyOnLoad(gameObject); joystick = GameObject.FindGameObjectWithTag("GameController").GetComponent <EasyJoystick>(); #if UNITY_EDITOR || UNITY_WEBPLAYER inputType = InputType.WASDInput; Debug.LogWarning("wasd"); joystick.gameObject.SetActive(false); #endif #if UNITY_IPHONE inputType = InputType.TouchInput; Debug.Log("wtf"); #endif #if UNITY_ANDROID && !UNITY_EDITOR inputType = InputType.WASDInput; #endif }
// Use this for initialization void Start() { m_SkillMovement = gameObject.GetComponent <SkillMovement>(); if (m_SkillTipPrefab != null) { m_SkillTipObj = Instantiate(m_SkillTipPrefab, Vector3.zero, Quaternion.identity) as GameObject; m_SkillTipObj.SetActive(false); } else { Debug.Log("---sn: can't create skill notice obj!!"); } CollectSkillScrip(m_Skills); m_ShooterSkillController = new ShooterControlHandler(this, m_Skills); m_ShooterSkillController.Init(); /// TouchManager.OnGestureEvent += OnGestureEvent; GameObject tUiRoot = GameObject.FindGameObjectWithTag("UI"); if (tUiRoot != null) { m_UIRoot = tUiRoot.GetComponent <DFMUiRoot>(); } if (m_JoyStick != null) { m_JoyStickObj = GameObject.Instantiate(m_JoyStick) as GameObject; if (m_JoyStickObj != null) { m_JoyStickObj.transform.position = Vector3.zero; EasyJoystick joyStickScript = m_JoyStickObj.GetComponentInChildren <EasyJoystick>(); if (joyStickScript != null) { joyStickScript.JoystickPositionOffset = new Vector2( m_JoyStickPosPercent.x * Screen.width, m_JoyStickPosPercent.y * Screen.height); } } } //ShowChangWeaponButton(); HideJoyStick(); }
internal void Start() { if (m_JoyStick != null) { m_JoyStickObj = GameObject.Instantiate(m_JoyStick) as GameObject; if (m_JoyStickObj != null) { m_JoyStickObj.transform.position = Vector3.zero; EasyJoystick joyStickScript = m_JoyStickObj.GetComponentInChildren <EasyJoystick>(); if (joyStickScript != null) { joyStickScript.JoystickPositionOffset = new Vector2( m_JoyStickPosPercent.x * Screen.width, m_JoyStickPosPercent.y * Screen.height); } JoyStickEnable = true; JoyStickEnable = false; } } }
void DoIt() { GameObject go = Fsm.GetOwnerDefaultTarget(gameObject); if (go != null) { EasyJoystick joystick = go.GetComponent <EasyJoystick>(); if (joystick != null) { EasyJoystick.On_JoystickMove += On_JoystickMove; EasyJoystick.On_JoystickMoveEnd += On_JoystickMoveEnd; } else { Finish(); } } else { Finish(); } }
void OnEnable() { EasyJoystick t = target as EasyJoystick; if (t.areaTexture == null) { t.areaTexture = (UnityEngine.Texture)Resources.Load("RadialJoy_Area"); EditorUtility.SetDirty(t); } if (t.touchTexture == null) { t.touchTexture = (UnityEngine.Texture)Resources.Load("RadialJoy_Touch"); EditorUtility.SetDirty(t); } if (t.deadTexture == null) { t.deadTexture = (UnityEngine.Texture)Resources.Load("RadialJoy_Dead"); EditorUtility.SetDirty(t); } t.showDebugRadius = true; }
void Awake() { Environment.SetEnvironmentVariable("MONO_REFLECTION_SERIALIZER", "yes"); GameIsPaused = true; GameHasStarted = false; if(Instance != null && Instance != this) { GameObject.DestroyImmediate(this.gameObject); return; } else { DontDestroyOnLoad(this); } //joystick = GameObject.FindGameObjectWithTag("GameController").GetComponent<EasyJoystick>(); #if UNITY_IPHONE || UNITY_EDITOR || UNITY_STANDALONE inputType = InputType.TouchInput; characterJoyStick = Instantiate(Resources.Load("Managers/_CharacterJoystick")) as GameObject; joystick = characterJoyStick.GetComponent<EasyJoystick>(); joystick.showDebugRadius = false; joystick.enable = false; characterJoyStick.GetComponent<EasyTouch>().nGUICameras[0] = GUIManager.Instance.uiCamera; #endif #if UNITY_WEBPLAYER inputType = InputType.WASDInput; //Debug.LogWarning("wasd"); //joystick.gameObject.SetActive(false); #endif #if UNITY_ANDROID && !UNITY_EDITOR inputType = InputType.WASDInput; #endif }
/// <summary> /// Recebendo o tipo de entrada do usuario /// </summary> private void RecieveInput() { switch (_inputType) { case InputMode.Standard: _horizontalStandard = Input.GetAxis("Horizontal"); _verticalStandard = Input.GetAxis("Vertical"); break; case InputMode.CrossPlatform: if (_easyJoystick == null) { if (_showDebugMessages) { Debug.Log("Searching for EasyJoystick script"); } _easyJoystick = GameObject.Find("ScreenJoystick").GetComponentInChildren <EasyJoystick>(); } else { if (_showDebugMessages) { Debug.Log("Getting input values"); } _horizontalCrossPlatform = _easyJoystick.MoveInput().x; _verticalCrossPlatform = _easyJoystick.MoveInput().z; } break; default: if (_showDebugMessages) { Debug.LogError("Input Type Unkown: " + _inputType); } break; } }
void Start() { joyStick = GameObject.Find("JoyStick").GetComponent<EasyJoystick>(); }
public override void OnInspectorGUI() { EasyJoystick t = (EasyJoystick)target; // Joystick Properties HTGUILayout.FoldOut(ref t.showProperties, "Joystick properties", false); if (t.showProperties) { EditorGUILayout.BeginVertical(paddingStyle1); t.name = EditorGUILayout.TextField("Joystick name", t.name); if (t.enable) { GUI.backgroundColor = Color.green; } else { GUI.backgroundColor = Color.red; } t.enable = EditorGUILayout.Toggle("Enable joystick", t.enable); if (t.isActivated) { GUI.backgroundColor = Color.green; } else { GUI.backgroundColor = Color.red; } t.isActivated = EditorGUILayout.Toggle("Activated", t.isActivated); if (t.visible) { GUI.backgroundColor = Color.green; } else { GUI.backgroundColor = Color.red; } t.visible = EditorGUILayout.Toggle("Visible", t.visible); if (t.showDebugRadius) { GUI.backgroundColor = Color.green; } else { GUI.backgroundColor = Color.red; } t.showDebugRadius = EditorGUILayout.Toggle("Show debug area", t.showDebugRadius); GUI.backgroundColor = Color.white; HTGUILayout.DrawSeparatorLine(paddingStyle1.padding.left); EditorGUILayout.Separator(); if (t.useFixedUpdate) { GUI.backgroundColor = Color.green; } else { GUI.backgroundColor = Color.red; } t.useFixedUpdate = EditorGUILayout.Toggle("Use fixed update", t.useFixedUpdate); if (t.isUseGuiLayout) { GUI.backgroundColor = Color.green; } else { GUI.backgroundColor = Color.red; } t.isUseGuiLayout = EditorGUILayout.Toggle("Use GUI Layout", t.isUseGuiLayout); GUI.backgroundColor = Color.white; if (!t.isUseGuiLayout) { EditorGUILayout.HelpBox("This lets you skip the GUI layout phase (Increase GUI performance). It can only be used if you do not use GUI.Window and GUILayout inside of this OnGUI call.", MessageType.Warning); } EditorGUILayout.EndVertical(); } HTGUILayout.FoldOut(ref t.showPosition, "Joystick position & size", false); if (t.showPosition) { // Dynamic joystick if (t.DynamicJoystick) { GUI.backgroundColor = Color.green; } else { GUI.backgroundColor = Color.red; } t.DynamicJoystick = EditorGUILayout.Toggle("Dynamic joystick", t.DynamicJoystick); GUI.backgroundColor = Color.white; if (t.DynamicJoystick) { GUI.backgroundColor = Color.cyan; t.area = (EasyJoystick.DynamicArea)EditorGUILayout.EnumPopup("Free area", t.area); GUI.backgroundColor = Color.white; } else { GUI.backgroundColor = Color.cyan; t.JoyAnchor = (EasyJoystick.JoystickAnchor)EditorGUILayout.EnumPopup("Anchor", t.JoyAnchor); GUI.backgroundColor = Color.white; t.JoystickPositionOffset = EditorGUILayout.Vector2Field("Offset", t.JoystickPositionOffset); } HTGUILayout.DrawSeparatorLine(paddingStyle1.padding.left); EditorGUILayout.Separator(); t.ZoneRadius = EditorGUILayout.FloatField("Area radius", t.ZoneRadius); t.TouchSize = EditorGUILayout.FloatField("Touch radius", t.TouchSize); if (t.RestrictArea) { GUI.backgroundColor = Color.green; } else { GUI.backgroundColor = Color.red; } t.RestrictArea = EditorGUILayout.Toggle(" Restrict to area", t.RestrictArea); if (t.resetFingerExit) { GUI.backgroundColor = Color.green; } else { GUI.backgroundColor = Color.red; } t.resetFingerExit = EditorGUILayout.Toggle(" Reset finger exit", t.resetFingerExit); GUI.backgroundColor = Color.white; t.deadZone = EditorGUILayout.FloatField("Dead zone radius", t.deadZone); } // Joystick axes properties HTGUILayout.FoldOut(ref t.showInteraction, "Joystick axes properties & events", false); if (t.showInteraction) { EditorGUILayout.BeginVertical(paddingStyle1); // Interaction GUI.backgroundColor = Color.cyan; t.Interaction = (EasyJoystick.InteractionType)EditorGUILayout.EnumPopup("Interaction type", t.Interaction); GUI.backgroundColor = Color.white; if (t.Interaction == EasyJoystick.InteractionType.EventNotification || t.Interaction == EasyJoystick.InteractionType.DirectAndEvent) { if (t.useBroadcast) { GUI.backgroundColor = Color.green; } else { GUI.backgroundColor = Color.red; } t.useBroadcast = EditorGUILayout.Toggle("Broadcast messages", t.useBroadcast); GUI.backgroundColor = Color.white; if (t.useBroadcast) { t.receiverGameObject = (GameObject)EditorGUILayout.ObjectField(" Receiver gameobject", t.receiverGameObject, typeof(GameObject), true); GUI.backgroundColor = Color.cyan; t.messageMode = (EasyJoystick.Broadcast)EditorGUILayout.EnumPopup(" Sending mode", t.messageMode); GUI.backgroundColor = Color.white; } } HTGUILayout.DrawSeparatorLine(paddingStyle1.padding.left); // X axis GUI.color = new Color(255f / 255f, 69f / 255f, 40f / 255f); t.enableXaxis = EditorGUILayout.BeginToggleGroup("Enable X axis", t.enableXaxis); GUI.color = Color.white; if (t.enableXaxis) { EditorGUILayout.BeginVertical(paddingStyle1); t.speed.x = EditorGUILayout.FloatField("Speed", t.speed.x); if (t.inverseXAxis) { GUI.backgroundColor = Color.green; } else { GUI.backgroundColor = Color.red; } t.inverseXAxis = EditorGUILayout.Toggle("Inverse axis", t.inverseXAxis); GUI.backgroundColor = Color.white; EditorGUILayout.Separator(); if (t.Interaction == EasyJoystick.InteractionType.Direct || t.Interaction == EasyJoystick.InteractionType.DirectAndEvent) { t.XAxisTransform = (Transform)EditorGUILayout.ObjectField("Joystick X to", t.XAxisTransform, typeof(Transform), true); if (t.XAxisTransform != null) { // characterCollider if (t.XAxisTransform.GetComponent <CharacterController>() && (t.XTI == EasyJoystick.PropertiesInfluenced.Translate || t.XTI == EasyJoystick.PropertiesInfluenced.TranslateLocal)) { EditorGUILayout.HelpBox("CharacterController detected", MessageType.Info); t.xAxisGravity = EditorGUILayout.FloatField("Gravity", t.xAxisGravity); } else { t.xAxisGravity = 0; } GUI.backgroundColor = Color.cyan; t.XTI = (EasyJoystick.PropertiesInfluenced)EditorGUILayout.EnumPopup("Influenced", t.XTI); GUI.backgroundColor = Color.white; switch (t.xAI) { case EasyJoystick.AxisInfluenced.X: GUI.color = new Color(255f / 255f, 69f / 255f, 40f / 255f); break; case EasyJoystick.AxisInfluenced.Y: GUI.color = Color.green; break; case EasyJoystick.AxisInfluenced.Z: GUI.color = new Color(63f / 255f, 131f / 255f, 245f / 255f); break; } GUI.backgroundColor = Color.cyan; t.xAI = (EasyJoystick.AxisInfluenced)EditorGUILayout.EnumPopup("Axis influenced", t.xAI); GUI.backgroundColor = Color.white; GUI.color = Color.white; EditorGUILayout.Separator(); if (t.XTI == EasyJoystick.PropertiesInfluenced.RotateLocal) { // auto stab if (t.enableXAutoStab) { GUI.backgroundColor = Color.green; } else { GUI.backgroundColor = Color.red; } t.enableXAutoStab = EditorGUILayout.Toggle("AutoStab", t.enableXAutoStab); GUI.backgroundColor = Color.white; if (t.enableXAutoStab) { EditorGUILayout.BeginVertical(paddingStyle1); t.ThresholdX = EditorGUILayout.FloatField("Threshold ", t.ThresholdX); t.StabSpeedX = EditorGUILayout.FloatField("Speed", t.StabSpeedX); EditorGUILayout.EndVertical(); } EditorGUILayout.Separator(); // Clamp if (t.enableXClamp) { GUI.backgroundColor = Color.green; } else { GUI.backgroundColor = Color.red; } t.enableXClamp = EditorGUILayout.Toggle("Clamp rotation", t.enableXClamp); GUI.backgroundColor = Color.white; if (t.enableXClamp) { EditorGUILayout.BeginVertical(paddingStyle1); t.clampXMax = EditorGUILayout.FloatField("Max angle value", t.clampXMax); t.clampXMin = EditorGUILayout.FloatField("Min angle value", t.clampXMin); EditorGUILayout.EndVertical(); } } } } EditorGUILayout.EndVertical(); } EditorGUILayout.EndToggleGroup(); HTGUILayout.DrawSeparatorLine(paddingStyle1.padding.left); // Y axis GUI.color = Color.green; t.enableYaxis = EditorGUILayout.BeginToggleGroup("Enable Y axis", t.enableYaxis); GUI.color = Color.white; if (t.enableYaxis) { EditorGUILayout.BeginVertical(paddingStyle1); t.speed.y = EditorGUILayout.FloatField("Speed", t.speed.y); if (t.inverseYAxis) { GUI.backgroundColor = Color.green; } else { GUI.backgroundColor = Color.red; } t.inverseYAxis = EditorGUILayout.Toggle("Inverse axis", t.inverseYAxis); GUI.backgroundColor = Color.white; EditorGUILayout.Separator(); if (t.Interaction == EasyJoystick.InteractionType.Direct || t.Interaction == EasyJoystick.InteractionType.DirectAndEvent) { t.YAxisTransform = (Transform)EditorGUILayout.ObjectField("Joystick Y to", t.YAxisTransform, typeof(Transform), true); if (t.YAxisTransform != null) { // characterCollider if (t.YAxisTransform.GetComponent <CharacterController>() && (t.YTI == EasyJoystick.PropertiesInfluenced.Translate || t.YTI == EasyJoystick.PropertiesInfluenced.TranslateLocal)) { EditorGUILayout.HelpBox("CharacterController detected", MessageType.Info); t.yAxisGravity = EditorGUILayout.FloatField("Gravity", t.yAxisGravity); } else { t.yAxisGravity = 0; } GUI.backgroundColor = Color.cyan; t.YTI = (EasyJoystick.PropertiesInfluenced)EditorGUILayout.EnumPopup("Influenced", t.YTI); GUI.backgroundColor = Color.white; switch (t.yAI) { case EasyJoystick.AxisInfluenced.X: GUI.color = new Color(255f / 255f, 69f / 255f, 40f / 255f); break; case EasyJoystick.AxisInfluenced.Y: GUI.color = Color.green; break; case EasyJoystick.AxisInfluenced.Z: GUI.color = new Color(63f / 255f, 131f / 255f, 245f / 255f); break; } GUI.backgroundColor = Color.cyan; t.yAI = (EasyJoystick.AxisInfluenced)EditorGUILayout.EnumPopup("Axis influenced", t.yAI); GUI.backgroundColor = Color.white; GUI.color = Color.white; EditorGUILayout.Separator(); if (t.YTI == EasyJoystick.PropertiesInfluenced.RotateLocal) { // auto stab if (t.enableYAutoStab) { GUI.backgroundColor = Color.green; } else { GUI.backgroundColor = Color.red; } t.enableYAutoStab = EditorGUILayout.Toggle("AutoStab", t.enableYAutoStab); GUI.backgroundColor = Color.white; if (t.enableYAutoStab) { EditorGUILayout.BeginVertical(paddingStyle1); t.ThresholdY = EditorGUILayout.FloatField("Threshold ", t.ThresholdY); t.StabSpeedY = EditorGUILayout.FloatField("Speed", t.StabSpeedY); EditorGUILayout.EndVertical(); } EditorGUILayout.Separator(); // Clamp if (t.enableYClamp) { GUI.backgroundColor = Color.green; } else { GUI.backgroundColor = Color.red; } t.enableYClamp = EditorGUILayout.Toggle("Clamp rotation", t.enableYClamp); GUI.backgroundColor = Color.white; if (t.enableYClamp) { EditorGUILayout.BeginVertical(paddingStyle1); t.clampYMax = EditorGUILayout.FloatField("Max angle value", t.clampYMax); t.clampYMin = EditorGUILayout.FloatField("Min angle value", t.clampYMin); EditorGUILayout.EndVertical(); } } } } EditorGUILayout.EndVertical(); } EditorGUILayout.EndToggleGroup(); HTGUILayout.DrawSeparatorLine(paddingStyle1.padding.left); EditorGUILayout.Separator(); // Smoothing return if (t.enableSmoothing) { GUI.backgroundColor = Color.green; } else { GUI.backgroundColor = Color.red; } t.enableSmoothing = EditorGUILayout.BeginToggleGroup("Smoothing return", t.enableSmoothing); GUI.backgroundColor = Color.white; if (t.enableSmoothing) { EditorGUILayout.BeginVertical(paddingStyle1); t.Smoothing = EditorGUILayout.Vector2Field("Smoothing", t.Smoothing); EditorGUILayout.EndVertical(); } EditorGUILayout.EndToggleGroup(); if (t.enableInertia) { GUI.backgroundColor = Color.green; } else { GUI.backgroundColor = Color.red; } t.enableInertia = EditorGUILayout.BeginToggleGroup("Enable inertia", t.enableInertia); GUI.backgroundColor = Color.white; if (t.enableInertia) { EditorGUILayout.BeginVertical(paddingStyle1); t.Inertia = EditorGUILayout.Vector2Field("Inertia", t.Inertia); EditorGUILayout.EndVertical(); } EditorGUILayout.EndToggleGroup(); EditorGUILayout.EndVertical(); } // Joystick Texture HTGUILayout.FoldOut(ref t.showAppearance, "Joystick textures", false); if (t.showAppearance) { EditorGUILayout.BeginVertical(paddingStyle1); t.guiDepth = EditorGUILayout.IntField("Gui depth", t.guiDepth); EditorGUILayout.Separator(); if (t.showZone) { GUI.backgroundColor = Color.green; } else { GUI.backgroundColor = Color.red; } t.showZone = EditorGUILayout.Toggle("Show area", t.showZone); GUI.backgroundColor = Color.white; if (t.showZone) { t.areaColor = EditorGUILayout.ColorField("Color", t.areaColor); t.areaTexture = (Texture)EditorGUILayout.ObjectField("Area texture", t.areaTexture, typeof(Texture), true); } EditorGUILayout.Separator(); if (t.showTouch) { GUI.backgroundColor = Color.green; } else { GUI.backgroundColor = Color.red; } t.showTouch = EditorGUILayout.Toggle("Show touch", t.showTouch); GUI.backgroundColor = Color.white; if (t.showTouch) { t.touchColor = EditorGUILayout.ColorField("Color", t.touchColor); t.touchTexture = (Texture)EditorGUILayout.ObjectField("Area texture", t.touchTexture, typeof(Texture), true); } EditorGUILayout.Separator(); if (t.showDeadZone) { GUI.backgroundColor = Color.green; } else { GUI.backgroundColor = Color.red; } t.showDeadZone = EditorGUILayout.Toggle("Show dead", t.showDeadZone); GUI.backgroundColor = Color.white; if (t.showDeadZone) { t.deadTexture = (Texture)EditorGUILayout.ObjectField("Dead zone texture", t.deadTexture, typeof(Texture), true); } EditorGUILayout.EndVertical(); } // Refresh if (GUI.changed) { EditorUtility.SetDirty(t); } }
void OnDisable() { EasyJoystick t = (EasyJoystick)target; t.selected = false; }
public void SetEZControl(EasyJoystick joystick) { sz = joystick; playerControlled = true; }
void OnDisable() { EasyJoystick t = (EasyJoystick)target; t.showDebugRadius = false; }
public override void OnInspectorGUI() { EasyJoystick t = (EasyJoystick)target; t.showProperties = HTEditorToolKit.DrawTitleFoldOut(t.showProperties, "Joystick properties"); if (t.showProperties) { t.enable = EditorGUILayout.Toggle("Enable joystick", t.enable); t.useFixedUpdate = EditorGUILayout.Toggle("Use fixed update", t.useFixedUpdate); HTEditorToolKit.DrawSeparatorLine(); EditorGUILayout.Separator(); t.zoneRadius = EditorGUILayout.FloatField("Area radius", t.zoneRadius); t.TouchSize = EditorGUILayout.FloatField("Touch radius", t.TouchSize); t.RestrictArea = EditorGUILayout.Toggle("Restrict to area", t.RestrictArea); t.deadZone = EditorGUILayout.FloatField("Dead zone radius", t.deadZone); EditorGUILayout.Separator(); // Dynamic joystick t.DynamicJoystick = EditorGUILayout.Toggle("Dynamic joystick", t.DynamicJoystick); if (t.DynamicJoystick) { t.area = (EasyJoystick.DynamicArea)EditorGUILayout.EnumPopup("Free area", t.area); } else { t.joystickPosition = EditorGUILayout.Vector2Field("Joystick position", t.joystickPosition); } HTEditorToolKit.DrawSeparatorLine(); // Smoothing return t.enableSmoothing = EditorGUILayout.Toggle("Smoothing return", t.enableSmoothing); if (t.enableSmoothing) { t.Smoothing = EditorGUILayout.Vector2Field("Smoothing", t.Smoothing); } HTEditorToolKit.DrawSeparatorLine(); // Inertie t.enableInertia = EditorGUILayout.Toggle("Enable inertia", t.enableInertia); if (t.enableInertia) { t.Inertia = EditorGUILayout.Vector2Field("Inertia", t.Inertia); } //EditorGUILayout.Separator(); } // Interaction t.showInteraction = HTEditorToolKit.DrawTitleFoldOut(t.showInteraction, "Interaction"); if (t.showInteraction) { // Joystick speed t.interaction = (EasyJoystick.InteractionType)EditorGUILayout.EnumPopup("Interaction type", t.interaction); if (t.interaction == EasyJoystick.InteractionType.EventNotification || t.interaction == EasyJoystick.InteractionType.DirectAndEvent) { t.useBroadcast = EditorGUILayout.Toggle("Broadcast messages", t.useBroadcast); if (t.useBroadcast) { t.ReceiverObjectGame = (GameObject)EditorGUILayout.ObjectField("Receiver objet", t.ReceiverObjectGame, typeof(GameObject), true); t.messageMode = (EasyJoystick.Broadcast)EditorGUILayout.EnumPopup("Sending mode", t.messageMode); } } HTEditorToolKit.DrawSeparatorLine(); // x Axis EditorGUILayout.Separator(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.PrefixLabel("X axis speed"); t.speed.x = EditorGUILayout.FloatField(t.speed.x); t.inverseXAxis = EditorGUILayout.Toggle(t.inverseXAxis); EditorGUILayout.LabelField("inverse axis"); EditorGUILayout.EndHorizontal(); // y Axis EditorGUILayout.BeginHorizontal(); EditorGUILayout.PrefixLabel("Y axis speed"); t.speed.y = EditorGUILayout.FloatField(t.speed.y); t.inverseYAxis = EditorGUILayout.Toggle(t.inverseYAxis); EditorGUILayout.LabelField("inverse axis"); EditorGUILayout.EndHorizontal(); HTEditorToolKit.DrawSeparatorLine(); EditorGUILayout.Separator(); // Interaction direct if (t.interaction == EasyJoystick.InteractionType.Direct || t.interaction == EasyJoystick.InteractionType.DirectAndEvent) { t.XAxisTransform = (Transform)EditorGUILayout.ObjectField("Joystick X to", t.XAxisTransform, typeof(Transform), true); if (t.XAxisTransform != null) { // characterCollider if (t.XAxisTransform.GetComponent <CharacterController>() && (t.xTI == EasyJoystick.PropertiesInfluenced.Translate || t.xTI == EasyJoystick.PropertiesInfluenced.TranslateLocal)) { EditorGUILayout.HelpBox("CharacterController detected", MessageType.Info); t.xAxisGravity = EditorGUILayout.FloatField("Gravity", t.xAxisGravity); } else { t.xAxisGravity = 0; } t.xTI = (EasyJoystick.PropertiesInfluenced)EditorGUILayout.EnumPopup("Influenced", t.xTI); t.xAI = (EasyJoystick.AxisInfluenced)EditorGUILayout.EnumPopup("Axis influenced", t.xAI); } EditorGUILayout.Separator(); HTEditorToolKit.DrawSeparatorLine(); EditorGUILayout.Separator(); t.YAxisTransform = (Transform)EditorGUILayout.ObjectField("Joystick Y to", t.YAxisTransform, typeof(Transform), true); if (t.YAxisTransform != null) { // characterCollider if (t.YAxisTransform.GetComponent <CharacterController>() && (t.yTI == EasyJoystick.PropertiesInfluenced.Translate || t.yTI == EasyJoystick.PropertiesInfluenced.TranslateLocal)) { EditorGUILayout.HelpBox("CharacterController detected", MessageType.Info); t.yAxisGravity = EditorGUILayout.FloatField("Gravity", t.yAxisGravity); } else { t.yAxisGravity = 0; } t.yTI = (EasyJoystick.PropertiesInfluenced)EditorGUILayout.EnumPopup("Influenced", t.yTI); t.yAI = (EasyJoystick.AxisInfluenced)EditorGUILayout.EnumPopup("Axis influenced", t.yAI); } } } // Joystick Appearance t.showAppearance = HTEditorToolKit.DrawTitleFoldOut(t.showAppearance, "Joystick Appearance"); if (t.showAppearance) { t.showZone = EditorGUILayout.Toggle("Show area", t.showZone); if (t.showZone) { t.areaTexture = (Texture)EditorGUILayout.ObjectField("Area texture", t.areaTexture, typeof(Texture), true); } t.showTouch = EditorGUILayout.Toggle("Show touch", t.showTouch); if (t.showTouch) { t.touchTexture = (Texture)EditorGUILayout.ObjectField("Area texture", t.touchTexture, typeof(Texture), true); } t.showDeadZone = EditorGUILayout.Toggle("Show touch", t.showDeadZone); if (t.showDeadZone) { t.deadTexture = (Texture)EditorGUILayout.ObjectField("Dead zone texture", t.deadTexture, typeof(Texture), true); } } // Refresh if (GUI.changed) { EditorUtility.SetDirty(t); } }
void OnDisable() { EasyJoystick t = target as EasyJoystick; t.showDebugRadius = false; }
// Use this for initialization void Start() { inputType = GameManager.inputType; if(inputType == InputType.WASDInput) { } else if(inputType == InputType.TouchInput) { joystick = GameObject.FindGameObjectWithTag("GameController").GetComponent<EasyJoystick>(); } }
private void Start() { this.joystick = GameObject.Find("Move_Turn_Joystick").GetComponent<EasyJoystick>(); }
void Start() { joystick = GameObject.Find("Move_Turn_Joystick").GetComponent <EasyJoystick>(); }
public override void OnInspectorGUI() { EasyJoystick t = (EasyJoystick)target; t.showProperties = HTEditorToolKit.DrawTitleFoldOut(t.showProperties, "Joystick properties"); if (t.showProperties) { t.enable = EditorGUILayout.Toggle("Enable joystick", t.enable); t.useFixedUpdate = EditorGUILayout.Toggle("Use fixed update", t.useFixedUpdate); HTEditorToolKit.DrawSeparatorLine(); EditorGUILayout.Separator(); t.zoneRadius = EditorGUILayout.FloatField("Area radius", t.zoneRadius); t.TouchSize = EditorGUILayout.FloatField("Touch radius", t.TouchSize); t.RestrictArea = EditorGUILayout.Toggle("Restrict to area", t.RestrictArea); t.deadZone = EditorGUILayout.FloatField("Dead zone radius", t.deadZone); EditorGUILayout.Separator(); // Dynamic joystick t.DynamicJoystick = EditorGUILayout.Toggle("Dynamic joystick", t.DynamicJoystick); if (t.DynamicJoystick) { t.area = (EasyJoystick.DynamicArea)EditorGUILayout.EnumPopup("Free area", t.area); } else { t.joystickPosition = EditorGUILayout.Vector2Field("Joystick position", t.joystickPosition); } HTEditorToolKit.DrawSeparatorLine(); // Smoothing return t.enableSmoothing = EditorGUILayout.Toggle("Smoothing return", t.enableSmoothing); if (t.enableSmoothing) { t.Smoothing = EditorGUILayout.Vector2Field("Smoothing", t.Smoothing); } HTEditorToolKit.DrawSeparatorLine(); // Inertie t.enableInertia = EditorGUILayout.Toggle("Enable inertia", t.enableInertia); if (t.enableInertia) { t.Inertia = EditorGUILayout.Vector2Field("Inertia", t.Inertia); } //EditorGUILayout.Separator(); } // Interaction t.showInteraction = HTEditorToolKit.DrawTitleFoldOut(t.showInteraction, "Interaction"); if (t.showInteraction) { // Joystick speed t.interaction = (EasyJoystick.InteractionType)EditorGUILayout.EnumPopup("Interaction type", t.interaction); HTEditorToolKit.DrawSeparatorLine(); // x Axis EditorGUILayout.Separator(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.PrefixLabel("X axis speed"); t.speed.x = EditorGUILayout.FloatField(t.speed.x); EditorGUILayout.EndHorizontal(); // y Axis EditorGUILayout.BeginHorizontal(); EditorGUILayout.PrefixLabel("Y axis speed"); t.speed.y = EditorGUILayout.FloatField(t.speed.y); EditorGUILayout.EndHorizontal(); HTEditorToolKit.DrawSeparatorLine(); EditorGUILayout.Separator(); } // Joystick Appearance t.showAppearance = HTEditorToolKit.DrawTitleFoldOut(t.showAppearance, "Joystick Appearance"); if (t.showAppearance) { t.showZone = EditorGUILayout.Toggle("Show area", t.showZone); if (t.showZone) { t.areaTexture = (Texture)EditorGUILayout.ObjectField("Area texture", t.areaTexture, typeof(Texture), true); } t.showTouch = EditorGUILayout.Toggle("Show touch", t.showTouch); if (t.showTouch) { t.touchTexture = (Texture)EditorGUILayout.ObjectField("Area texture", t.touchTexture, typeof(Texture), true); } t.showDeadZone = EditorGUILayout.Toggle("Show touch", t.showDeadZone); if (t.showDeadZone) { t.deadTexture = (Texture)EditorGUILayout.ObjectField("Dead zone texture", t.deadTexture, typeof(Texture), true); } } // Refresh if (GUI.changed) { EditorUtility.SetDirty(t); } }