Ejemplo n.º 1
0
 public ScaleInputMapping(RyneCamera camera, EditAxis axis, float speed = 1.0f) : base(camera)
 {
     Speed = speed;
     AddInput(new MouseAxisInput {
         Axis = new Float2(1, 0), Action = new InputScalingAction(new Float3(1, 0, 0), Speed)
     });
     AddInput(new MouseAxisInput {
         Axis = new Float2(0, 1), Action = new InputScalingAction(new Float3(0, 1, 0), Speed)
     });
 }
Ejemplo n.º 2
0
        public TranslationInputMapping(RyneCamera camera, EditAxis axis, float speed = 1.0f) : base(camera)
        {
            Speed = speed;

            AddInput(new MouseAxisInput {
                Axis = new Float2(1, 0), Action = new InputMovementAction(new Float3(0.0f), Speed)
            });
            AddInput(new MouseAxisInput {
                Axis = new Float2(0, 1), Action = new InputMovementAction(new Float3(0.0f), Speed)
            });
            UpdateMapping(camera, axis);
        }
Ejemplo n.º 3
0
 protected ObjectManipulationMapping(RyneCamera camera)
 {
     // Always have the mouse trigger the start and end of the manipulation
     AddInput(new MouseInput
     {
         Key    = RyneMouse.Button0,
         Type   = InputType.Pressed,
         Action = new InputControllerAction(controller =>
         {
             if (controller is EditorGridController gridController)
             {
                 gridController.StartEdit();
             }
             controller.SetCaptureMouse(true);
         })
     });
Ejemplo n.º 4
0
        public Player()
        {
            Name = "Player";

            var renderSize = Global.Application.GetRenderSize();

            PlayerCamera = new RyneCamera(renderSize.X, renderSize.Y);

            PlayerController = new Controller();

            // Components
            AddComponent <TransformComponent>();
            AddComponent <PhysicsComponent>();
            AddComponent <CollisionComponent>();

            // This entity is only an in-game object, nothing to change in editor
            SetFlag(EntityFlag.EditorNotEditable, true);
        }
Ejemplo n.º 5
0
        public sealed override void UpdateMapping(RyneCamera camera, EditAxis axis)
        {
            Float3 xAxis, yAxis;

            if (axis == EditAxis.All)
            {
                xAxis = new Float3(1, 0, 0);
                yAxis = new Float3(0, 1, 0);
            }
            else
            {
                xAxis = AxisToFloat3(axis);
                yAxis = xAxis;
            }

            MouseAxisInputs[0] = new MouseAxisInput {
                Axis = new Float2(1, 0), Action = new InputScalingAction(xAxis, Speed)
            };
            MouseAxisInputs[1] = new MouseAxisInput {
                Axis = new Float2(0, 1), Action = new InputScalingAction(yAxis, Speed)
            };
        }
Ejemplo n.º 6
0
        public sealed override void UpdateMapping(RyneCamera camera, EditAxis axis)
        {
            Float3 xAxis, yAxis;

            if (axis == EditAxis.All)
            {
                // Set axes from plane tangents relative to camera
                Float3 planeNormal = (camera.Focus - new Float3(camera.GetPosition())).Normalize();
                xAxis = planeNormal.Cross(camera.Up).Normalize() * -1.0f;
                yAxis = xAxis.Cross(planeNormal).Normalize();
            }
            else
            {
                xAxis = AxisToFloat3(axis);
                yAxis = xAxis;
            }

            MouseAxisInputs[0] = new MouseAxisInput {
                Axis = new Float2(1, 0), Action = new InputMovementAction(xAxis, Speed, false)
            };
            MouseAxisInputs[1] = new MouseAxisInput {
                Axis = new Float2(0, 1), Action = new InputMovementAction(yAxis, Speed, false)
            };
        }