예제 #1
0
    public void ShootProjectile(EntityUid uid, Vector2 direction, EntityUid?user = null)
    {
        var physics = EnsureComp <PhysicsComponent>(uid);

        physics.BodyStatus     = BodyStatus.InAir;
        physics.LinearVelocity = direction.Normalized * 20f;

        if (user != null)
        {
            var projectile = EnsureComp <ProjectileComponent>(uid);
            Projectiles.SetShooter(projectile, user.Value);
        }

        Transform(uid).WorldRotation = direction.ToWorldAngle();
    }