Exemplo n.º 1
0
        public static Basis GetBasis(this ITurretLike turret)
        {
            Ensure.That(turret, nameof(turret)).IsNotNull();

            var basis = Basis.Identity.Rotated(Vector3.Up, turret.Yaw);
            var right = basis.Xform(Vector3.Right);

            return(basis.Rotated(right, turret.Pitch));
        }
Exemplo n.º 2
0
        public static Basis GetBasis([NotNull] this ITurretLike rotatable)
        {
            Ensure.Any.IsNotNull(rotatable, nameof(rotatable));

            var basis = Basis.Identity.Rotated(Vector3.Up, rotatable.Yaw);
            var right = basis.Xform(Vector3.Right);

            return(basis.Rotated(right, rotatable.Pitch));
        }
Exemplo n.º 3
0
        public static void Rotate(this ITurretLike turret, Vector2 rotation)
        {
            Ensure.That(turret, nameof(turret)).IsNotNull();

            turret.Rotation = rotation;
        }
Exemplo n.º 4
0
 public static void Reset([NotNull] this ITurretLike turret) => Rotate(turret, Vector2.Zero);
Exemplo n.º 5
0
        public static void Rotate([NotNull] this ITurretLike turret, Vector2 rotation)
        {
            Ensure.Any.IsNotNull(turret, nameof(turret));

            turret.Rotation = rotation;
        }