Ejemplo n.º 1
0
 protected override void Update(float dt)
 {
     for (TrackingRenderNode trackingRenderNode = this.nodeList.Head; trackingRenderNode != null; trackingRenderNode = trackingRenderNode.Next)
     {
         TrackingComponent trackingComp = trackingRenderNode.TrackingComp;
         TrackingGameObjectViewComponent trackingView = trackingRenderNode.TrackingView;
         if (trackingView.Speed != 0f)
         {
             float target = MathUtils.MinAngle(trackingView.Yaw, trackingComp.Yaw);
             trackingView.Yaw = Mathf.SmoothDampAngle(trackingView.Yaw, target, ref trackingView.YawVelocity, trackingComp.MaxVelocity / trackingView.Speed);
             if (trackingView.YawVelocity != 0f)
             {
                 trackingView.Yaw = MathUtils.WrapAngle(trackingView.Yaw);
             }
             trackingView.YawRotate(trackingView.Yaw);
             if (trackingComp.TrackPitch)
             {
                 float target2 = MathUtils.MinAngle(trackingView.Pitch, trackingComp.Pitch);
                 trackingView.Pitch = Mathf.SmoothDampAngle(trackingView.Pitch, target2, ref trackingView.PitchVelocity, trackingComp.MaxVelocity / trackingView.Speed);
                 if (trackingView.PitchVelocity != 0f)
                 {
                     trackingView.Pitch = MathUtils.WrapAngle(trackingView.Pitch);
                 }
                 trackingView.PitchRotate(trackingView.Pitch);
             }
         }
     }
 }
Ejemplo n.º 2
0
        public void SetSpeed(float speed)
        {
            NodeList <EntityRenderNode> nodeList = Service.Get <EntityController>().GetNodeList <EntityRenderNode>();

            for (EntityRenderNode entityRenderNode = nodeList.Head; entityRenderNode != null; entityRenderNode = entityRenderNode.Next)
            {
                this.UpdateAnimationSpeed(entityRenderNode.View, speed);
            }
            NodeList <TrackingRenderNode> nodeList2 = Service.Get <EntityController>().GetNodeList <TrackingRenderNode>();

            for (TrackingRenderNode trackingRenderNode = nodeList2.Head; trackingRenderNode != null; trackingRenderNode = trackingRenderNode.Next)
            {
                trackingRenderNode.TrackingView.Speed = speed;
            }
        }