Ejemplo n.º 1
0
        protected override void OnUpdate()
        {
            Entities.ForEach((Entity e, ref FlyDirection direction, ref TouchpadInputCapture tic, ref InteractionThumbPosition itp, ref BaseInputCapture bic, ref ControllersInteractionType cit) =>
            {
                // If user just started to press/touch the thumbstick
                if (InteractionChecker.IsInteractingTouchpad(bic, cit, itp, tic, true, false))
                {
                    direction.FlightDirection = tic.ThumbPosition.y;

                    if (!EntityManager.HasComponent(e, typeof(IsFlying)))
                    {
                        PostUpdateCommands.AddComponent(e, new IsFlying());
                    }
                    if (EntityManager.HasComponent(e, typeof(IsDecelerating)))
                    {
                        PostUpdateCommands.RemoveComponent <IsDecelerating>(e);
                    }
                }
                else if (EntityManager.HasComponent(e, typeof(IsFlying)))
                {
                    PostUpdateCommands.RemoveComponent <IsFlying>(e);
                    PostUpdateCommands.AddComponent(e, new IsDecelerating());
                }
            });
        }
        protected override void OnUpdate()
        {
            if (!VRDF_Components.SetupVRIsReady)
            {
                return;
            }

            Entities.ForEach((ref NonLinearUserRotation nlur, ref ControllersInteractionType cit, ref BaseInputCapture bic, ref TouchpadInputCapture tic, ref InteractionThumbPosition itp) =>
            {
                if (!nlur.HasAlreadyRotated && InteractionChecker.IsInteractingTouchpad(bic, cit, itp, tic))
                {
                    VRDF_Components.RotateVRCameraAround(new float3(0.0f, tic.ThumbPosition.x, 0.0f), nlur.DegreesToRotate);
                    nlur.HasAlreadyRotated = true;
                }
                else if (nlur.HasAlreadyRotated && InteractionChecker.IsNotInteractingTouchpad(bic, cit, itp, tic))
                {
                    nlur.HasAlreadyRotated = false;
                }
            });
        }