public void UpdateFromSnapShot(FigureInformation figureInformation, double timeStamp) { _lastServerTimeStamp = timeStamp; _serverSendPosition = figureInformation.Position; _serverSendDirection = figureInformation.Direction; _serverSendWalkDirection = figureInformation.WalkDirection; Speed = figureInformation.Speed; IsAlive = figureInformation.IsAlive; IsVisible = figureInformation.IsVisible; }
/// <summary> /// Получение информации о фигуре по правилам /// </summary> /// <typeparam name="T">тип</typeparam> /// <param name="calculatedValue">фигура</param> /// <returns></returns> public static FigureInformation GetFigureInfo <T>(T calculatedValue) { var propertys = calculatedValue.GetType().GetProperties(); var information = new FigureInformation(); information.Corners = propertys .Where(x => x.CustomAttributes.Any(o => o.AttributeType.Equals(typeof(CornerAttribute)))) .Select(x => x.GetValue(calculatedValue, null) as double?) .ToArray(); return(information); }