Exemplo n.º 1
0
        public void ChangeWeapon(int WeaponIndex)
        {
            if (WeaponIndex == -1)//Unequip weapon
            {
                foreach (WeaponBase ActiveWeapon in PrimaryWeapons.ActiveWeapons)
                {
                    RemovePartialAnimation(ActiveWeapon.GetAnimationName(ActiveMovementStance));
                }

                PrimaryWeapons.RemoveAllActiveWeapons();
                PrimaryWeapons.UseWeapon(CurrentStanceAnimations);
            }
            else
            {
                string WeaponName = PrimaryWeapons.GetWeaponName(WeaponIndex);
                PrimaryWeapons.RemoveAllActiveWeapons();
                PrimaryWeapons.UseWeapon(WeaponName);
                WeaponBase WeaponToUse = PrimaryWeapons.GetWeapon(WeaponName);

                WeaponToUse.CurrentAnimation = null;
                WeaponToUse.ResetAnimation(ActiveMovementStance);
                WeaponToUse.InitiateFollowingAttack(true, ActiveMovementStance, this);

                if (WeaponToUse.CurrentAnimation == null)
                {
                    ActivatePartialWeapon(WeaponToUse, WeaponToUse.GetAnimationName(ActiveMovementStance));
                }
            }
        }
Exemplo n.º 2
0
        public Vehicle(string Name, Layer CurrentLayer, Vector2 Position, int Team, PlayerInventory Equipment, ISFXGenerator PlayerSFXGenerator, List <WeaponBase> ListExtraWeapon)
            : base(Name, CurrentLayer, Position, Team, new EquipmentLoadout(), PlayerSFXGenerator)
        {
            ListUser = new List <RobotAnimation>();

            FileStream   FS = new FileStream("Content/Units/Triple Thunder/Vehicles/" + Name + ".peuv", FileMode.Open, FileAccess.Read);
            BinaryReader BR = new BinaryReader(FS, Encoding.UTF8);

            BR.BaseStream.Seek(0, SeekOrigin.Begin);

            MaxHP        = BR.ReadInt32();
            MaxEN        = BR.ReadInt32();
            Accel        = BR.ReadSingle();
            MaxWalkSpeed = BR.ReadSingle();
            JumpSpeed    = BR.ReadSingle();
            byte ControlType = BR.ReadByte();
            byte CaptureType = BR.ReadByte();

            HasKnockback = BR.ReadBoolean();
            IsDynamic    = BR.ReadBoolean();

            int ListExtraAnimationCount = BR.ReadInt32();

            ListStanceAnimation = new List <WeaponBase>(ListExtraAnimationCount);
            for (int W = 0; W < ListExtraAnimationCount; ++W)
            {
                string ExtraAnimationPath = BR.ReadString();
                if (!string.IsNullOrEmpty(ExtraAnimationPath))
                {
                    ListStanceAnimation.Add(WeaponBase.CreateFromFile(Name, ExtraAnimationPath, true, CurrentLayer.DicRequirement, CurrentLayer.DicEffect, CurrentLayer.DicAutomaticSkillTarget));
                }
            }

            CurrentStanceAnimations = StandingAnimations;

            int ListWeaponCount = BR.ReadInt32();

            PrimaryWeapons   = new WeaponHolder(ListWeaponCount);
            SecondaryWeapons = new WeaponHolder(0);
            for (int W = 0; W < ListWeaponCount; ++W)
            {
                string WeaponName = BR.ReadString();
                PrimaryWeapons.AddWeaponToStash(WeaponBase.CreateFromFile(Name, WeaponName, false, CurrentLayer.DicRequirement, CurrentLayer.DicEffect, CurrentLayer.DicAutomaticSkillTarget));
            }

            if (ListExtraWeapon != null)
            {
                foreach (ComboWeapon ActiveWeapon in ListExtraWeapon)
                {
                    PrimaryWeapons.AddWeaponToStash(ActiveWeapon);
                    PrimaryWeapons.UseWeapon(ActiveWeapon);
                }
            }

            FS.Close();
            BR.Close();

            Load();

            SetAnimation(StandingAnimations.GetDefaultAnimationName());
            CurrentMovementInput = MovementInputs.None;
            ActiveMovementStance = "None";
            Update(new GameTime());
            SetIdle();

            if (!PrimaryWeapons.HasActiveWeapons)
            {
                if (PrimaryWeapons.HasWeapons)
                {
                    ChangeWeapon(0);
                }
                else
                {
                    ChangeWeapon(-1);
                }
            }

            UpdateSkills(BaseSkillRequirement.OnCreatedRequirementName);
        }
Exemplo n.º 3
0
        public RobotAnimation(string Name, Layer CurrentLayer, Vector2 Position, int Team, PlayerInventory Equipment, ISFXGenerator PlayerSFXGenerator, List <WeaponBase> ListExtraWeapon)
            : this()
        {
            this.PlayerSFXGenerator = PlayerSFXGenerator.Copy();
            this.Name         = Name;
            this.CurrentLayer = CurrentLayer;
            this.Position     = Position;
            this.Team         = Team;
            this.Equipment    = new EquipmentLoadout(Equipment, this);

            FileStream   FS = new FileStream("Content/Units/Triple Thunder/" + Name + ".peu", FileMode.Open, FileAccess.Read);
            BinaryReader BR = new BinaryReader(FS, Encoding.UTF8);

            BR.BaseStream.Seek(0, SeekOrigin.Begin);

            MaxHP        = BR.ReadInt32();
            MaxEN        = BR.ReadInt32();
            Accel        = BR.ReadSingle();
            MaxWalkSpeed = BR.ReadSingle();
            JumpSpeed    = BR.ReadSingle();
            HasKnockback = BR.ReadBoolean();
            IsDynamic    = BR.ReadBoolean();

            Dictionary <string, BaseSkillRequirement>     DicRequirement          = null;
            Dictionary <string, BaseEffect>               DicEffect               = null;
            Dictionary <string, AutomaticSkillTargetType> DicAutomaticSkillTarget = null;

            if (CurrentLayer != null)
            {
                DicRequirement          = CurrentLayer.DicRequirement;
                DicEffect               = CurrentLayer.DicEffect;
                DicAutomaticSkillTarget = CurrentLayer.DicAutomaticSkillTarget;
            }

            ListStanceAnimation = new List <WeaponBase>(4);

            if (File.Exists("Content/Triple Thunder/Weapons/" + Name + "/Default" + ".ttw"))
            {
                ListStanceAnimation.Add(WeaponBase.CreateFromFile(Name, Name + "/Default", true, DicRequirement, DicEffect, DicAutomaticSkillTarget));
            }

            if (File.Exists("Content/Triple Thunder/Weapons/" + Name + "/Crouch" + ".ttw"))
            {
                ListStanceAnimation.Add(WeaponBase.CreateFromFile(Name, Name + "/Crouch", true, DicRequirement, DicEffect, DicAutomaticSkillTarget));
            }

            if (File.Exists("Content/Triple Thunder/Weapons/" + Name + "/Roll" + ".ttw"))
            {
                ListStanceAnimation.Add(WeaponBase.CreateFromFile(Name, Name + "/Roll", true, DicRequirement, DicEffect, DicAutomaticSkillTarget));
            }

            if (File.Exists("Content/Triple Thunder/Weapons/" + Name + "/Prone" + ".ttw"))
            {
                ListStanceAnimation.Add(WeaponBase.CreateFromFile(Name, Name + "/Prone", true, DicRequirement, DicEffect, DicAutomaticSkillTarget));
            }

            CurrentStanceAnimations = StandingAnimations;

            int ListWeaponCount = BR.ReadInt32();

            PrimaryWeapons   = new WeaponHolder(ListWeaponCount);
            SecondaryWeapons = new WeaponHolder(1);
            for (int W = 0; W < ListWeaponCount; ++W)
            {
                string     WeaponName = BR.ReadString();
                WeaponBase NewWeapon;
                string     WeaponPath = Name + "/Weapons/" + WeaponName;
                bool       IsGrenade  = false;
                if (!File.Exists("Content/Triple Thunder/Weapons/" + WeaponPath + ".ttw"))
                {
                    WeaponPath = Name + "/Grenades/" + WeaponName;
                    IsGrenade  = true;
                }

                if (CurrentLayer == null)
                {
                    NewWeapon = WeaponBase.CreateFromFile(Name, WeaponPath, false, null, null, null);
                }
                else
                {
                    NewWeapon = WeaponBase.CreateFromFile(Name, WeaponPath, false, CurrentLayer.DicRequirement, CurrentLayer.DicEffect, CurrentLayer.DicAutomaticSkillTarget);
                }

                NewWeapon.WeaponName = WeaponName;
                if (IsGrenade)
                {
                    SecondaryWeapons.AddWeaponToStash(NewWeapon);
                }
                else
                {
                    PrimaryWeapons.AddWeaponToStash(NewWeapon);
                }
            }

            if (ListExtraWeapon != null)
            {
                foreach (WeaponBase ActiveWeapon in ListExtraWeapon)
                {
                    ActiveWeapon.IsExtra = true;
                    PrimaryWeapons.AddWeaponToStash(ActiveWeapon);
                    PrimaryWeapons.UseWeapon(ActiveWeapon);
                }
            }

            Sounds = new UnitSounds(BR);

            FS.Close();
            BR.Close();

            Load();

            if (!PrimaryWeapons.HasActiveWeapons)
            {
                if (PrimaryWeapons.HasWeapons)
                {
                    ChangeWeapon(0);
                }
                else
                {
                    ChangeWeapon(-1);
                }
            }

            if (CurrentLayer != null)
            {
                UpdateSkills(BaseSkillRequirement.OnCreatedRequirementName);
            }
        }