예제 #1
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);
            }
        }
예제 #2
0
 protected RobotAnimation(string Name, Layer CurrentLayer, Vector2 Position, int Team, EquipmentLoadout Equipment, ISFXGenerator PlayerSFXGenerator)
     : this()
 {
     this.PlayerSFXGenerator = PlayerSFXGenerator.Copy();
     this.Name         = Name;
     this.CurrentLayer = CurrentLayer;
     this.Position     = Position;
     this.Team         = Team;
     this.Equipment    = Equipment;
 }