예제 #1
0
        public Dictionary <string, string> DicStoredVariable;// Used for extra stuff

        private RobotAnimation()
            : base()
        {
            IsUpdated                  = true;
            Camera                     = new Rectangle(0, 0, Constants.Width, Constants.Height);
            InputManager               = new NullRobotInput();
            InputManagerHelper         = new NullRobotInputManager();
            PrimaryWeapons             = new WeaponHolder(0);
            IsInAir                    = false;
            CurrentLane                = 1350;
            CollisionBox               = new CollisionObject <RobotAnimation>();
            ListCollidingGroundPolygon = new List <WorldPolygon>();
            ListIgnoredGroundPolygon   = new List <WorldPolygon>();
            Effects                    = new EffectHolder();
            ListMagicSpell             = new List <MagicSpell>();
            ListMagicSpell.Add(new MagicSpell(null));
            DicStoredVariable = new Dictionary <string, string>();
        }
예제 #2
0
        /// <summary>
        /// Used for tests
        /// </summary>
        /// <param name="CurrentLayer"></param>
        /// <param name="Position"></param>
        /// <param name="Team"></param>
        /// <param name="ListWeapon"></param>
        public RobotAnimation(Layer CurrentLayer, Vector2 Position, int Team, List <WeaponBase> ListWeapon)
            : this()
        {
            this.CurrentLayer = CurrentLayer;
            this.Position     = Position;
            this.Team         = Team;

            if (ListWeapon != null)
            {
                PrimaryWeapons = new WeaponHolder(ListWeapon.Count);
                foreach (WeaponBase ActiveWeapon in ListWeapon)
                {
                    PrimaryWeapons.AddWeaponToStash(ActiveWeapon);
                }
            }

            if (ListWeapon.Count > 0)
            {
                ChangeWeapon(0);
            }
        }
예제 #3
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);
        }
예제 #4
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);
            }
        }