Exemplo n.º 1
0
        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);
            }
        }
Exemplo n.º 2
0
 public Combo()
 {
     ListNextCombo     = new List <Combo>();
     ListInputChoice   = new List <InputChoice>();
     ComboName         = "";
     AnimationName     = "";
     AnimationType     = AnimationTypes.FullAnimation;
     CurrentInputIndex = 0;
     ComboRotationType = ComboRotationTypes.None;
 }
Exemplo n.º 3
0
        public Combo(string Path)
        {
            FileStream   FS = new FileStream("Content/Triple Thunder/Combos/" + Path + ".ttc", FileMode.Open, FileAccess.Read);
            BinaryReader BR = new BinaryReader(FS, Encoding.UTF8);

            ComboName         = Path;
            AnimationName     = BR.ReadString();
            AnimationType     = (AnimationTypes)BR.ReadInt32();
            ComboRotationType = (ComboRotationTypes)BR.ReadByte();
            InstantActivation = BR.ReadBoolean();

            int ListNextComboCount = BR.ReadInt32();

            ListNextCombo = new List <Combo>(ListNextComboCount);
            ListStart     = new List <int>(ListNextComboCount);
            ListEnd       = new List <int>(ListNextComboCount);

            for (int C = 0; C < ListNextComboCount; C++)
            {
                string NextComboName = BR.ReadString();
                int    Start         = BR.ReadInt32();
                int    End           = BR.ReadInt32();
                Combo  NextCombo;

                if (NextComboName != ComboName)
                {
                    NextCombo = new Combo(NextComboName);
                }
                else
                {
                    NextCombo = this;
                }

                ListStart.Add(Start);
                ListEnd.Add(End);
                NextCombo.Owner = Owner;

                int ListInputChoiceCount = BR.ReadInt32();
                NextCombo.ListInputChoice = new List <InputChoice>(ListInputChoiceCount);
                for (int I = 0; I < ListInputChoiceCount; I++)
                {
                    InputChoice NewInputChoice = new InputChoice();
                    NewInputChoice.AttackInput    = (AttackInputs)BR.ReadByte();
                    NewInputChoice.MovementInput  = (MovementInputs)BR.ReadByte();
                    NewInputChoice.NextInputDelay = BR.ReadInt32();
                    NextCombo.ListInputChoice.Add(NewInputChoice);
                }

                ListNextCombo.Add(NextCombo);
            }

            BR.Close();
            FS.Close();
        }
Exemplo n.º 4
0
 public SimpleWeapon(BinaryReader BR, string OwnerName, string WeaponPath, bool IsCharacterAnimation, Dictionary <string, BaseSkillRequirement> DicRequirement,
                     Dictionary <string, BaseEffect> DicEffects, Dictionary <string, AutomaticSkillTargetType> DicAutomaticSkillTarget)
     : base(BR, OwnerName, WeaponPath, DicRequirement, DicEffects, DicAutomaticSkillTarget)
 {
     if (IsCharacterAnimation)
     {
         AnimationType = AnimationTypes.FullAnimation;
     }
     else
     {
         AnimationType         = AnimationTypes.PartialAnimation;
         ComboRotationType     = ComboRotationTypes.RotateAroundWeaponSlot;
         HoldingAnimationName  = "Triple Thunder/" + WeaponPath + "/Holding";
         ShootingAnimationName = "Triple Thunder/" + WeaponPath + "/Shooting";
         ReloadAnimationName   = "Triple Thunder/" + WeaponPath + "/Reloading";
     }
 }