/// <summary> /// This is how we hook keyboard/other input. /// </summary> /// <param name="input"></param> /// <param name="allowFull"></param> /// <returns></returns> public override bool UpdatePlayerActionInput(InputState input, bool allowFull) { // this is a simple, hard coded example to handle input from a player // we can probably add some kind of modifier key here for doing something else cool if (input.IsKeyReleased(Keys.OemPlus)) { bool canAutoTarget = false; bool canTargetSpace = false; bool isAutoTarget; bool isTargetBlocked; // find something to kill ITarget targetHere = this._world.Cursor.GetTargetHere(canAutoTarget, canTargetSpace, out isAutoTarget, out isTargetBlocked); if (null != targetHere) { // output some data to the debug log DebugLog.Write("Terminating target: {0}", targetHere.DisplayName); // kill it Damage.ApplyDamage(targetHere, targetHere.Health); } } return(base.UpdatePlayerActionInput(input, allowFull)); }
public void StopDrawingLine(InputAction.CallbackContext context) { Vector2Control mousePos = Mouse.current.position; endPos = cam.ScreenToWorldPoint(new Vector3(mousePos.x.ReadValue(), mousePos.y.ReadValue())); var dmg = new Damage(startPos, endPos, 5000f); dmg.ApplyDamage(new TileManager[] { }); }
public void Fire(Transform transform, WeaponFx fx, TileManager tileManager) { Quaternion dir = transform.rotation; Vector3 startPos = transform.position; Vector3 endPos = startPos + dir * Vector3.up * range; var dmg = new Damage(startPos, endPos, baseDamage); (Vector3 hitPos, Vector3 endHitPos) = dmg.ApplyDamage(new[] { tileManager }); fx.ApplyFX(startPos, endHitPos, hitPos); }
private void OnTriggerEnter2D(Collider2D collider) { if (collider.tag == "IgnoreLasers") { return; } if (damage == null) { return; } damage.ApplyDamage(collider.gameObject); LaserTrigger effect = GameManager.ObjectPooler.Get <LaserTrigger>(); effect.Initialize(transform.position); Disable(); }