Esempio n. 1
0
        public override void Load()
        {
            DicTimeline.Clear();
            foreach (KeyValuePair <string, Timeline> Timeline in LoadTimelines(typeof(CoreTimeline)))
            {
                if (Timeline.Value is AnimationOriginTimeline)
                {
                    continue;
                }

                DicTimeline.Add(Timeline.Key, Timeline.Value);
            }
            foreach (KeyValuePair <string, Timeline> Timeline in LoadTimelines(typeof(TripleThunderTimeline), this))
            {
                DicTimeline.Add(Timeline.Key, Timeline.Value);
            }

            base.Load();

            if (Content != null)
            {
                PrimaryWeapons.Load(Content);
                SecondaryWeapons.Load(Content);

                for (int W = 0; W < ListStanceAnimation.Count; ++W)
                {
                    if (ListStanceAnimation[W].ActiveProjectileInfo != null && ListStanceAnimation[W].ActiveProjectileInfo.ProjectileAnimation.Path != string.Empty)
                    {
                        ListStanceAnimation[W].ActiveProjectileInfo.ProjectileAnimation.Load(Content, "Animations/Sprites/");
                        ListStanceAnimation[W].NozzleFlashAnimation.Load(Content, "Animations/Sprites/");
                    }
                    if (ListStanceAnimation[W].ActiveProjectileInfo != null && ListStanceAnimation[W].ActiveProjectileInfo.TrailAnimation != null &&
                        ListStanceAnimation[W].ActiveProjectileInfo.TrailAnimation.Path != string.Empty)
                    {
                        ListStanceAnimation[W].ActiveProjectileInfo.TrailAnimation.Load(Content, "Animations/Sprites/");
                    }
                    if (ListStanceAnimation[W].ExplosionAttributes.ExplosionAnimation.Path != string.Empty)
                    {
                        ListStanceAnimation[W].ExplosionAttributes.ExplosionAnimation.Load(Content, "Animations/Sprites/");
                    }
                }
            }

            SetAnimation(StandingAnimations.GetDefaultAnimationName());
            CurrentMovementInput = MovementInputs.None;
            ActiveMovementStance = "None";
            Update(new GameTime());
            SetIdle();
        }
Esempio 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);
        }