public override void UpdateWeaponAngle(float Angle, string ActiveMovementStance, VisibleTimeline WeaponSlotTimeline, RobotAnimation Owner) { if (CurrentAnimation == null) { return; } VisibleTimeline WeaponTimeline = CurrentAnimation.AnimationOrigin; ComboRotationTypes ActiveComboRotationTypes = ComboRotationTypes.RotateAroundWeaponSlot; if (WeaponSlotTimeline != null) { float TranslationX = WeaponTimeline.Position.X; float TranslationY = WeaponTimeline.Position.Y; if (ActiveComboRotationTypes == ComboRotationTypes.RotateAroundWeaponSlot) { CurrentAnimation.TransformationMatrix = Matrix.CreateTranslation(-TranslationX, -TranslationY, 0) * Matrix.CreateRotationZ(Angle) * Matrix.CreateTranslation(WeaponSlotTimeline.Position.X, WeaponSlotTimeline.Position.Y, 0); } else if (ActiveComboRotationTypes == ComboRotationTypes.RotateAroundRobot) { Vector2 WeaponOffset = WeaponSlotTimeline.Position - Owner.AnimationOrigin.Position; float ExtraAngle = (float)Math.Atan2(WeaponOffset.Y, WeaponOffset.X); float WeaponLength = WeaponOffset.Length(); double LenghtDirX = Math.Cos(Angle + ExtraAngle) * WeaponLength; double LenghtDirY = Math.Sin(Angle + ExtraAngle) * WeaponLength; Vector2 RealGunNozzlePosition = Owner.AnimationOrigin.Position + new Vector2((float)(LenghtDirX), (float)(LenghtDirY)); CurrentAnimation.TransformationMatrix = Matrix.CreateTranslation(-TranslationX, -TranslationY, 0) * Matrix.CreateRotationZ(Angle) * Matrix.CreateTranslation(RealGunNozzlePosition.X, RealGunNozzlePosition.Y, 0); } else { CurrentAnimation.TransformationMatrix = Matrix.CreateTranslation(-TranslationX, -TranslationY, 0) * Matrix.CreateRotationZ(Angle) * Matrix.CreateTranslation(WeaponSlotTimeline.Position.X, WeaponSlotTimeline.Position.Y, 0); } } else { CurrentAnimation.TransformationMatrix = Matrix.CreateScale(0f); } }
public abstract void UpdateWeaponAngle(float Angle, string ActiveMovementStance, VisibleTimeline WeaponSlotTimeline, RobotAnimation Owner);