public override void Update(int Index)
        {
            if (string.IsNullOrEmpty(_RobotPath))
            {
                return;
            }

            Layer Owner = Map.ListLayer[_LayerIndex];

            List <WeaponBase> ListExtraWeapon = new List <WeaponBase>();

            for (int W = 0; W < _ListWeapons.Count; ++W)
            {
                ListExtraWeapon.Add(WeaponBase.CreateFromFile(_RobotPath, _ListWeapons[W], true, Owner.DicRequirement, Owner.DicEffect, Owner.DicAutomaticSkillTarget));
            }

            RobotAnimation NewRobot = new RobotAnimation(_RobotPath, Owner, _Position, _Team, new PlayerInventory(), Owner.PlayerSFXGenerator, ListExtraWeapon);

            if (!string.IsNullOrEmpty(AIPath))
            {
                NewRobot.RobotAI = new TripleThunderScripAIContainer(new TripleThunderAIInfo(NewRobot, Owner, Map));
                NewRobot.RobotAI.Load(AIPath);
            }

            Owner.ListRobotToAdd.Add(NewRobot);
        }
        protected override string DoExecuteEffect()
        {
            if (string.IsNullOrEmpty(_RobotPath))
            {
                return(null);
            }

            Layer Owner = Params.LocalContext.ActiveLayer;

            List <WeaponBase> ListExtraWeapon = new List <WeaponBase>();

            for (int W = 0; W < _ListWeapons.Count; ++W)
            {
                ListExtraWeapon.Add(WeaponBase.CreateFromFile(_RobotPath, _ListWeapons[W], true, Owner.DicRequirement, Owner.DicEffect, Owner.DicAutomaticSkillTarget));
            }

            //TODO: Create the robot on load to avoid loading assets when this effect is called.
            RobotAnimation NewRobot = new RobotAnimation(_RobotPath, Owner, Params.LocalContext.Target.Position + _Offset, _Team, new PlayerInventory(), Owner.PlayerSFXGenerator, ListExtraWeapon);

            if (!string.IsNullOrEmpty(AIPath))
            {
                NewRobot.RobotAI = new TripleThunderScripAIContainer(new TripleThunderAIInfo(NewRobot, Owner, Params.LocalContext.Map));
                NewRobot.RobotAI.Load(AIPath);
            }

            Owner.ListRobotToAdd.Add(NewRobot);

            return(null);
        }
Example #3
0
        public WeaponBase CreateWeapon(string WeaponName)
        {
            WeaponBase NewWeapon = WeaponBase.CreateFromFile(Name, WeaponName, true, CurrentLayer.DicRequirement, CurrentLayer.DicEffect, CurrentLayer.DicAutomaticSkillTarget);

            NewWeapon.Load(Content);
            return(NewWeapon);
        }
Example #4
0
        public void ChangeMap(Rectangle CameraBounds)
        {
            for (int W = 0; W < ListStanceAnimation.Count; ++W)
            {
                ListStanceAnimation[W] = WeaponBase.CreateFromFile(Name, ListStanceAnimation[W].WeaponPath, false, CurrentLayer.DicRequirement, CurrentLayer.DicEffect, CurrentLayer.DicAutomaticSkillTarget);
            }

            PrimaryWeapons.ChangeMap(CurrentLayer.DicRequirement, CurrentLayer.DicEffect, CurrentLayer.DicAutomaticSkillTarget);
            SecondaryWeapons.ChangeMap(CurrentLayer.DicRequirement, CurrentLayer.DicEffect, CurrentLayer.DicAutomaticSkillTarget);
            InputManager.ResetCameraBounds(CameraBounds);
            Load();
        }
        public override RobotAnimation SpawnPlayer(Player NewPlayer, Layer Owner, ISFXGenerator PlayerSFXGenerator, Rectangle CameraBounds)
        {
            List <WeaponBase> ListExtraWeapon = new List <WeaponBase>();

            for (int W = 0; W < _ListWeapons.Count; ++W)
            {
                ListExtraWeapon.Add(WeaponBase.CreateFromFile(_VehiclePath, _ListWeapons[W], true, Owner.DicRequirement, Owner.DicEffect, Owner.DicAutomaticSkillTarget));
            }

            Vehicle NewVehicle = new Vehicle(_VehiclePath, Owner, SpawnLocation, Team, new PlayerInventory(), Owner.PlayerSFXGenerator, ListExtraWeapon);

            NewVehicle.InputManagerHelper = new VehicleInputManager();

            NewVehicle.UpdateControls(NewPlayer.GameplayType, CameraBounds);

            return(NewVehicle);
        }
Example #6
0
        public void ChangeMap(Dictionary <string, BaseSkillRequirement> DicRequirement, Dictionary <string, BaseEffect> DicEffect, Dictionary <string, AutomaticSkillTargetType> DicAutomaticSkillTarget)
        {
            List <string> ListWeaponName = new List <string>(DicWeaponByName.Keys);

            for (int W = 0; W < ListWeaponName.Count; ++W)
            {
                DicWeaponByName[ListWeaponName[W]] = WeaponBase.CreateFromFile(DicWeaponByName[ListWeaponName[W]].OwnerName, ListWeaponName[W], true, DicRequirement, DicEffect, DicAutomaticSkillTarget);
            }
            for (int W = 0; W < ListActiveWeapon.Count; ++W)
            {
                ListActiveWeapon[W] = DicWeaponByName[ListActiveWeapon[W].WeaponPath];
            }
            for (int W = 0; W < ListHolsteredWeapon.Count; ++W)
            {
                ListHolsteredWeapon[W] = DicWeaponByName[ListHolsteredWeapon[W].WeaponPath];
            }
        }
Example #7
0
        protected override void DoLoad(BinaryReader BR, ContentManager Content)
        {
            _Team        = BR.ReadInt32();
            _AIPath      = BR.ReadString();
            _VehiclePath = BR.ReadString();

            int ListWeaponsCount = BR.ReadInt32();

            _ListWeapons = new List <string>(ListWeaponsCount);
            for (int W = 0; W < ListWeaponsCount; ++W)
            {
                _ListWeapons.Add(BR.ReadString());
            }

            if (string.IsNullOrEmpty(_VehiclePath))
            {
                return;
            }

            List <WeaponBase> ListExtraWeapon = new List <WeaponBase>();

            for (int W = 0; W < _ListWeapons.Count; ++W)
            {
                ListExtraWeapon.Add(WeaponBase.CreateFromFile(_VehiclePath, _ListWeapons[W], true, Owner.DicRequirement, Owner.DicEffect, Owner.DicAutomaticSkillTarget));
            }

            Vehicle NewVehicle = new Vehicle(_VehiclePath, Owner, _Position, _Team, new PlayerInventory(), Owner.PlayerSFXGenerator, ListExtraWeapon);

            HasEnded = true;
            if (!string.IsNullOrEmpty(AIPath))
            {
                NewVehicle.RobotAI = new TripleThunderScripAIContainer(new TripleThunderAIInfo(NewVehicle, Owner, Map));
                NewVehicle.RobotAI.Load(AIPath);
            }

            Owner.SpawnVehicle(NewVehicle);
        }
Example #8
0
        public void EquipWeapon(string WeaponToEquipName)
        {
            WeaponBase NewWeapon;
            string     WeaponPath = Name + "/Weapons/" + WeaponToEquipName;

            if (!File.Exists("Content/Triple Thunder/Weapons/" + WeaponPath + ".ttw"))
            {
                WeaponPath = Name + "/Grenades/" + WeaponToEquipName;
            }

            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 = WeaponToEquipName;
            NewWeapon.Load(Content);
            PrimaryWeapons.AddWeaponToStash(NewWeapon);

            ChangeWeapon(0);

            WeaponBase WeaponToUse = PrimaryWeapons.GetWeapon(WeaponPath);

            WeaponToUse.CurrentAnimation = null;
            WeaponToUse.ResetAnimation(ActiveMovementStance);

            WeaponToUse.InitiateFollowingAttack(true, ActiveMovementStance, this);

            if (WeaponToUse.CurrentAnimation == null)
            {
                ActivatePartialWeapon(WeaponToUse, WeaponToUse.GetAnimationName(ActiveMovementStance));
            }
        }
Example #9
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);
        }
Example #10
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);
            }
        }