private static void TestJoystickEvent(JoystickEvent e, ref XRControllerJoystick joystick, XRControllerSide side) { if (e != null && joystick.value.magnitude != 0) { e(side, joystick.value); } }
internal bool PerformJoystickEvent(Viewport viewport, JoystickInputEvent e) { var handled = OnJoystickEvent(viewport, e); if (!handled) { JoystickEvent?.Invoke(this, viewport, e, ref handled); } return(handled); }
public void Awake() { InnerTransform = transform.Find("InnerRegion"); Debug.Assert(InnerTransform != null, "InnerRegion child not found"); mPressEvent = new JoystickEvent(); mReleaseEvent = new JoystickEvent(); mValueChanged = new JoystickEvent(); FingerId = FINGER_NOT_VALID; ActiveDirection = JoystickDirection.ALL; MaxRadius = 100; }
private void OnAxis(string axe, float value) { JoystickEvent E = null; if (axisEvents.TryGetValue(axe, out E)) { if (E != null) { E(axe, value); } } }
public void UnregisterAxis(string axe, JoystickEvent kEvent, bool removeKey) { if (axisEvents.ContainsKey(axe)) { axisEvents[axe] -= kEvent; if (axisEvents[axe] == null) { axisEvents.Remove(axe); } } if (removeKey) { RemoveAxe(axe); } }
public void RegisterAxis(string axe, JoystickEvent kEvent) { if (axisEvents.ContainsKey(axe)) { axisEvents[axe] += kEvent; } else { if (!axis.Contains(axe)) { axis.Add(axe); } axisEvents.Add(axe, kEvent); } }
private void _joystick_movementEvent(JoystickEvent evt) { //Console.WriteLine("_joystick_movementEvent {0}", evt); if (_player == null) return; var transform = new System.Drawing.Drawing2D.Matrix(); transform.Rotate(evt.angle); var pts = new System.Drawing.PointF[] { new PointF(0, 64) }; transform.TransformPoints(pts); var pt2 = pts[0]; //Console.WriteLine("_joystick_movementEvent angle={0} pt2={1}", evt.angle, pt2); _player.updateRotationWithRelatedPoint(pt2); _joystickDebugSprite.x = _player.x + (int)pt2.X; _joystickDebugSprite.y = _player.y + (int)pt2.Y; }
public void Damage(float damage) { health = Mathf.Clamp(health - damage, 0, health); if (blood1 != null && blood2 != null) { blood1.Emit(); blood2.Emit(); } if (isPlayer) { target = goList[0]; } //target is what hit me.. if (target != null) { gameObject.SendMessage("PlayHitSound", target); //if(!SUAudioManager.Playhit(target,this.gameObject)) //{ // Debug.Log("Play hit failed for " + target.name + " hitting " + this.gameObject); //} } else { Debug.Log("No hit target for " + gameObject.name); } // if(!SUAudioManager.PlayEmitter( this.gameObject.GetHashCode(),SUAudioManager.soundevent.hit )) // { // // Debug.Log("PlayHit failed on " + this.gameObject.GetHashCode()); // } //Debug.Log("Playhit called on: " + gameObject.name); if (health == 0 && !dead) { //if we are the enemy send a message to the target telling it it killed us if (!isPlayer) { target.SendMessage("enimyisdead", gameObject); } dead = true; //animation.Stop(); //animation.Play(); animation.CrossFade("die"); if (isPlayer) { Debug.Log("stopping control and AI rig"); //no more move.. ThirdPersonController control = gameObject.GetComponent <ThirdPersonController>(); control.enabled = false; JoystickEvent joysc = gameObject.GetComponent <JoystickEvent>(); joysc.enabled = false; // no more let them attact.. //EntityRig myAIrig = target.GetComponent<EntityRig>(); //if(myAIrig != null)myAIrig.enabled = false; GameObject joy = GameObject.FindGameObjectWithTag("GameController"); joy.SetActive(false); } else { // Debug.Log ("died"); if (aiRig != null) { aiRig.AI.IsActive = false; } // if(dlgact != null)dlgact.CanAttack = false; //SD HERE randomize reward... bool drop = false; //how many points helps chance of getting reward int chance = Random.Range(0, 10); if (chance < 8) { drop = true; } if (drop) { //if getting reward pick strength, speed, or health //drop a potion.. int sel = Random.Range(1, 4); if (sel == 1) { if (powerup1 != null) { Instantiate(powerup1, new Vector3(transform.position.x, transform.position.y + .5f, transform.position.z), Quaternion.identity); } } if (sel == 2) { if (powerup2 != null) { Instantiate(powerup2, new Vector3(transform.position.x, transform.position.y + .5f, transform.position.z), Quaternion.identity); } } if (sel == 3) { if (powerup3 != null) { Instantiate(powerup3, new Vector3(transform.position.x, transform.position.y + .5f, transform.position.z), Quaternion.identity); } } } } // UDEA.GameKeys.Add("skelkills",1); animation.CrossFade("die"); StartCoroutine(WaitAndDestroy(4.0F)); } else { } }