public void Reset() { Metrics = new PlayerMovementMetrics(); prevRight = head.right; prevForward = head.forward; prevUp = head.up; }
public static PlayerMovementMetrics Sum <T>(IEnumerable <T> collection, Func <T, PlayerMovementMetrics> selector) { if (collection.Count() < 1) { return(new PlayerMovementMetrics()); } PlayerMovementMetrics result = null; for (int i = 0; i < collection.Count(); i++) { result += selector(collection.ElementAt(i)); } return(result); }
public static PlayerMovementMetrics operator +(PlayerMovementMetrics a, PlayerMovementMetrics b) { PlayerMovementMetrics c = new PlayerMovementMetrics(); if (a == null) { return(b); } if (b == null) { return(a); } c.horizontalMov = a.horizontalMov + b.horizontalMov; c.verticalMov = a.verticalMov + b.verticalMov; c.totalYaw = a.totalYaw + b.totalYaw; c.totalPitch = a.totalPitch + b.totalPitch; c.totalRoll = a.totalRoll + b.totalRoll; return(c); }