public override void _PhysicsProcess(float delta) { var direction = Vector2.Zero; direction.x = Input.GetActionStrength("ui_right") - Input.GetActionStrength("ui_left"); direction.y = Input.GetActionStrength("ui_down") - Input.GetActionStrength("ui_up"); if (leftJoy != Vector2.Zero) { direction = leftJoy; } direction = direction.Normalized(); if (direction != Vector2.Zero) { d = direction; Pivot.Rotation = (d.Angle()); } if (Input.IsActionJustPressed("c")) { int [] mask = { (int)CollisionLayerStatus.Layer1, (int)CollisionLayerStatus.Layer2, (int)CollisionLayerStatus.Layer3 }; BulletEventArgs args = new BulletEventArgs(mask, Facing.GlobalPosition, 50, d, 50, Vector2.Zero, 10); Bullet.Run(this, args); DamageEventArgs e = new DamageEventArgs(5, false); Damage.Run(this, e); // GD.Print("this : ", GlobalPosition); // GD.Print("camera : ", camera.GlobalPosition); } MoveAndCollide(direction); }
protected virtual void OnBulletRecycle(BulletEventArgs e) { var handler = BulletRecycle; if (handler != null) { handler(this, e); } }
void OnBulletRecycle(object sender, BulletEventArgs bulletEventArgs) { _bullets.Enqueue(bulletEventArgs.Bullet); }