private void CutscenePlayer_OnModifyScreenPosition()
        {
            if (_time > NextPoint.Time)
            {
                _current++;
                if (_current >= _points.Count - 1)
                {
                    _completed = true;
                    _current--;
                }
            }

            float between  = NextPoint.Time - CurrentPoint.Time;
            float progress = _time - CurrentPoint.Time;
            float div      = progress / between;

            if (div > 1f)
            {
                div = 1f;
            }
            float val = NextPoint.Easing.Ease(div);

            _hasCalculatedBefore = true;

            _nextData = CameraPointData.Lerp(CurrentPoint.Data.Method(), NextPoint.Data.Method(), val);

            Main.screenPosition = _nextData.Position - new Vector2(Main.screenWidth, Main.screenHeight) * 0.5f;
            // TODO: Magically make the camera rotate? manually modify the existing thing? idk
        }
Beispiel #2
0
        public IHttpActionResult Post([FromBody] AtPointModel model)
        {
            PushSignalR(model);

            using (var dbContext = new RTE.Data.DataContext())
            {
                var pointData =
                    new CameraPointData
                {
                    Json      = JsonConvert.SerializeObject(model),
                    TimeStamp = DateTime.Now
                };

                dbContext.CameraPointsData.Add(pointData);
                dbContext.SaveChanges();

                return(Ok(true));
            }
        }
 public static CameraPointData Lerp(CameraPointData d1, CameraPointData d2, float amount)
 {
     return(new CameraPointData(Vector2.Lerp(d1.Position, d2.Position, amount), MathHelper.Lerp(0f, 0f, amount), Vector2.Lerp(d1.Zoom, d2.Zoom, amount)));
 }                                                                                       // MathHelper.Lerp(d1.Rotation, d2.Rotation, amount)