/// <summary> /// Merges the force of the given knockback into this knockback. Typically though, you can also just have both knockbacks active simultaneously and achieve the same effect. /// </summary> public void Merge(Knockback knockback) { var newX = (Speed * Cos(Angle)) + (knockback.Speed * Cos(knockback.Angle)); var newY = (Speed * Sin(Angle)) + (knockback.Speed * Sin(knockback.Angle)); Angle = Atan2(newY, newX); Speed = SquareRoot((newX * newX) + (newY * newY)); }
/// <summary> /// Adds the given knockback to the system. This will also initialise or alter some values according to the knockbacks' properties. /// </summary> public static void Add(Knockback knockback) { periodicTrigger.Add(knockback); }