Beispiel #1
0
            public void Evaluate(GameTime gameTime, object Input, out bool IsCompleted, out List <object> Result)
            {
                RobotAnimation TargetRobot  = (RobotAnimation)ArrayReferences[0].ReferencedScript.GetContent();
                RobotAnimation CurrentRobot = Info.Owner;

                Vector2 Target = new Vector2(TargetRobot.Position.X - CurrentRobot.Position.X, TargetRobot.Position.Y - CurrentRobot.Position.Y);

                CurrentRobot.UpdateAllWeaponsAngle(Target);

                Result      = new List <object>();
                IsCompleted = true;
            }
Beispiel #2
0
        public void GetCollidingWorldPolygon(RobotAnimation ActiveRobot, out List <Tuple <PolygonCollisionResult, Polygon> > ListAllCollidingPolygon,
                                             out List <Tuple <PolygonCollisionResult, Polygon> > ListFloorCollidingPolygon, out List <Tuple <PolygonCollisionResult, Polygon> > ListCelingCollidingPolygon, out List <Tuple <PolygonCollisionResult, Polygon> > ListWallCollidingPolygon)
        {
            ListAllCollidingPolygon    = new List <Tuple <PolygonCollisionResult, Polygon> >();
            ListFloorCollidingPolygon  = new List <Tuple <PolygonCollisionResult, Polygon> >();
            ListCelingCollidingPolygon = new List <Tuple <PolygonCollisionResult, Polygon> >();
            ListWallCollidingPolygon   = new List <Tuple <PolygonCollisionResult, Polygon> >();

            foreach (WorldPolygon ActiveWorldPolygon in GetCollidingWorldObjects(ActiveRobot))
            {
                if (ActiveRobot.ListIgnoredGroundPolygon.Contains(ActiveWorldPolygon))
                {
                    continue;
                }

                foreach (Polygon ActivePlayerCollisionPolygon in ActiveRobot.Collision.ListCollisionPolygon)
                {
                    PolygonCollisionResult CollisionResultB;
                    PolygonCollisionResult CollisionResult = Polygon.PolygonCollisionSAT(ActivePlayerCollisionPolygon, ActiveWorldPolygon.Collision.ListCollisionPolygon[0], ActiveRobot.Speed, out CollisionResultB);

                    if (CollisionResult.Distance >= 0)
                    {
                        PolygonCollisionResult CollisionResult2 = Polygon.PolygonCollisionSAT(ActivePlayerCollisionPolygon, ActiveWorldPolygon.Collision.ListCollisionPolygon[0], Vector2.Zero, ActiveRobot.Speed);

                        ListAllCollidingPolygon.Add(new Tuple <PolygonCollisionResult, Polygon>(CollisionResult, ActiveWorldPolygon.Collision.ListCollisionPolygon[0]));

                        if (CollisionResult2.Distance != CollisionResult.Distance)
                        {
                            continue;
                        }
                        Vector2 GroundAxis = new Vector2(-CollisionResult.Axis.Y, CollisionResult.Axis.X);
                        double  FinalCollisionResultAngle = Math.Atan2(GroundAxis.X, GroundAxis.Y);

                        //Ground detection
                        if (FinalCollisionResultAngle >= FightingZone.GroundMinAngle && FinalCollisionResultAngle <= FightingZone.GroundMaxAngle)
                        {
                            ListFloorCollidingPolygon.Add(new Tuple <PolygonCollisionResult, Polygon>(CollisionResult, ActiveWorldPolygon.Collision.ListCollisionPolygon[0]));
                        }
                        //Ceiling
                        else if (FinalCollisionResultAngle <= -FightingZone.GroundMinAngle && FinalCollisionResultAngle >= -FightingZone.GroundMaxAngle)
                        {
                            ListCelingCollidingPolygon.Add(new Tuple <PolygonCollisionResult, Polygon>(CollisionResult, ActiveWorldPolygon.Collision.ListCollisionPolygon[0]));
                        }
                        //Wall
                        else
                        {
                            ListWallCollidingPolygon.Add(new Tuple <PolygonCollisionResult, Polygon>(CollisionResult, ActiveWorldPolygon.Collision.ListCollisionPolygon[0]));
                        }
                    }
                }
            }
        }
            public void Evaluate(GameTime gameTime, object Input, out bool IsCompleted, out List <object> Result)
            {
                double         TargetAngle  = (double)ArrayReferences[0].ReferencedScript.GetContent();
                RobotAnimation CurrentRobot = Info.Owner;

                float FinalAngle = MathHelper.ToRadians((float)TargetAngle);

                CurrentRobot.Weapons.ActivePrimaryWeapons[_WeaponIndex].WeaponAngle = FinalAngle;
                CurrentRobot.UpdatePrimaryWeaponAngle(FinalAngle, _WeaponIndex);

                Result      = new List <object>();
                IsCompleted = true;
            }
Beispiel #4
0
            public void Evaluate(GameTime gameTime, object Input, out bool IsCompleted, out List <object> Result)
            {
                RobotAnimation CurrentRobot = Info.Owner;

                CurrentRobot.ActiveAttackStance = "Walking";

                if (_WeaponIndex == -1)
                {
                    CurrentRobot.InitiateAttack(gameTime, AttackInputs.LightPress);
                }
                else
                {
                    CurrentRobot.PrimaryWeapons.ActiveWeapons[_WeaponIndex].InitiateAttack(gameTime, AttackInputs.LightPress, CurrentRobot.CurrentMovementInput, CurrentRobot.ActiveMovementStance, false, CurrentRobot);
                }

                Result      = new List <object>();
                IsCompleted = true;
            }
        protected override string DoExecuteEffect()
        {
            RobotAnimation ActiveRobot = Params.LocalContext.Target;
            float          SpeedX      = ActiveRobot.Speed.X;
            float          SpeedY      = ActiveRobot.Speed.Y;

            if (Params.LocalContext.Target.DicStoredVariable.ContainsKey("SpeedX"))
            {
                SpeedX = float.Parse(Params.LocalContext.Target.DicStoredVariable["SpeedX"]);
            }
            if (Params.LocalContext.Target.DicStoredVariable.ContainsKey("SpeedY"))
            {
                SpeedY = float.Parse(Params.LocalContext.Target.DicStoredVariable["SpeedY"]);
            }

            if (_InverseDirection == InverseDirections.Horizontal)
            {
                SpeedX = -SpeedX;
            }
            else if (_InverseDirection == InverseDirections.Vertical)
            {
                SpeedY = -SpeedY;
            }
            else if (_InverseDirection == InverseDirections.Both)
            {
                SpeedX = -SpeedX;
                SpeedY = -SpeedY;
            }
            ActiveRobot.Speed.X = SpeedX;
            ActiveRobot.Speed.Y = SpeedY;

            if (Params.LocalContext.Target.DicStoredVariable.ContainsKey("SpeedX"))
            {
                Params.LocalContext.Target.DicStoredVariable["SpeedX"] = SpeedX.ToString();
            }
            if (Params.LocalContext.Target.DicStoredVariable.ContainsKey("SpeedY"))
            {
                Params.LocalContext.Target.DicStoredVariable["SpeedY"] = SpeedY.ToString();
            }

            return(null);
        }
Beispiel #6
0
        public GunNozzleTimeline(BinaryReader BR, RobotAnimation Owner)
            : base(BR, TimelineType)
        {
            Origin     = new Point(Width / 2, Height / 2);
            this.Owner = Owner;

            _SpawnFrame           = BR.ReadInt32();
            _DeathFrame           = BR.ReadInt32();
            _ShootSecondaryWeapon = BR.ReadBoolean();

            int DicAnimationSpriteKeyFrameCount = BR.ReadInt32();

            for (int E = 0; E < DicAnimationSpriteKeyFrameCount; E++)
            {
                int Key = BR.ReadInt32();

                VisibleAnimationObjectKeyFrame NewAnimatedBitmapKeyFrame = new VisibleAnimationObjectKeyFrame(BR);

                DicAnimationKeyFrame.Add(Key, NewAnimatedBitmapKeyFrame);
            }
        }
Beispiel #7
0
        public RobotInput GetRobotInput(GameplayTypes GameplayType, RobotAnimation Owner, Rectangle CameraBounds)
        {
            switch (GameplayType)
            {
            case GameplayTypes.MouseAndKeyboard:
                return(new KeyboardAndMouseRobotInput(Owner, CameraBounds));

            case GameplayTypes.Controller1:
                return(new ControllerRobotInput(Owner, CameraBounds, PlayerIndex.One));

            case GameplayTypes.Controller2:
                return(new ControllerRobotInput(Owner, CameraBounds, PlayerIndex.Two));

            case GameplayTypes.Controller3:
                return(new ControllerRobotInput(Owner, CameraBounds, PlayerIndex.Three));

            case GameplayTypes.Controller4:
                return(new ControllerRobotInput(Owner, CameraBounds, PlayerIndex.Four));
            }

            return(new NullRobotInput());
        }
        public EquipmentLoadout(PlayerInventory Equipment, RobotAnimation Owner)
        {
            if (Equipment.EquipedArmor != null && Equipment.EquipedArmor.Name == "Armor 1")
            {
                EquipedArmor = new Armor1(Owner);
            }
            else
            {
                EquipedArmor = new DefaultArmor(Owner);
            }

            EquipedBooster = new JumpJetpack(Owner.PlayerSFXGenerator, Owner);

            ArrayEquipment    = new UsableEquipment[6];
            ArrayEquipment[0] = new EmptyEquipment(Owner);
            ArrayEquipment[1] = new EmptyEquipment(Owner);
            ArrayEquipment[2] = EquipedArmor;
            ArrayEquipment[3] = new EmptyEquipment(Owner);
            ArrayEquipment[4] = EquipedBooster;
            //ArrayEquipment[5] = new LongJumpShoes(Owner);
            //ArrayEquipment[5] = new WallJumpShoes(Owner);
            ArrayEquipment[5] = new RegularShoes(Owner);
        }
Beispiel #9
0
        protected override void DoLoad(BinaryReader BR, ContentManager Content)
        {
            _Team      = BR.ReadInt32();
            _AIPath    = BR.ReadString();
            _RobotPath = 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(_RobotPath))
            {
                return;
            }

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

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

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

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

            Owner.SpawnRobot(NewRobot);
        }
        public override void OnKill(RobotAnimation KillerPlayer, RobotAnimation KilledPlayer)
        {
            KillerPlayer.Kill++;
            KilledPlayer.Death++;

            if (DicPointsPerTeam.ContainsKey(KillerPlayer.Team))
            {
                DicPointsPerTeam[KillerPlayer.Team] += 1;
            }
            else
            {
                DicPointsPerTeam.Add(KillerPlayer.Team, 1);
            }

            if (Room.RoomSubtype == "Deathmatch")
            {
                if (Room.MaxKill > 0)
                {
                    if (Room.UseTeams)
                    {
                        bool MaxPointReached = DicPointsPerTeam[KillerPlayer.Team] >= Room.MaxKill;
                        if (MaxPointReached)
                        {
                            EndGame();
                        }
                    }
                    else
                    {
                        if (KillerPlayer.Kill >= Room.MaxKill)
                        {
                            EndGame();
                        }
                    }
                }
            }
        }
Beispiel #11
0
 public void SetRobotContext(Layer ActiveLayer, RobotAnimation ActiveRobotAnimation)
 {
     this.ActiveLayer = ActiveLayer;
     Target           = ActiveRobotAnimation;
 }
Beispiel #12
0
        public override void UpdateWeaponAngle(float Angle, string ActiveMovementStance, VisibleTimeline WeaponSlotTimeline, RobotAnimation Owner)
        {
            if (CurrentAnimation == null)
            {
                return;
            }

            VisibleTimeline    WeaponTimeline           = CurrentAnimation.AnimationOrigin;
            ComboRotationTypes ActiveComboRotationTypes = ComboRotationTypes.RotateAroundWeaponSlot;

            if (WeaponSlotTimeline != null)
            {
                float TranslationX = WeaponTimeline.Position.X;
                float TranslationY = WeaponTimeline.Position.Y;

                if (ActiveComboRotationTypes == ComboRotationTypes.RotateAroundWeaponSlot)
                {
                    CurrentAnimation.TransformationMatrix =
                        Matrix.CreateTranslation(-TranslationX, -TranslationY, 0)
                        * Matrix.CreateRotationZ(Angle)
                        * Matrix.CreateTranslation(WeaponSlotTimeline.Position.X,
                                                   WeaponSlotTimeline.Position.Y, 0);
                }
                else if (ActiveComboRotationTypes == ComboRotationTypes.RotateAroundRobot)
                {
                    Vector2 WeaponOffset = WeaponSlotTimeline.Position - Owner.AnimationOrigin.Position;
                    float   ExtraAngle   = (float)Math.Atan2(WeaponOffset.Y, WeaponOffset.X);
                    float   WeaponLength = WeaponOffset.Length();

                    double LenghtDirX = Math.Cos(Angle + ExtraAngle) * WeaponLength;
                    double LenghtDirY = Math.Sin(Angle + ExtraAngle) * WeaponLength;

                    Vector2 RealGunNozzlePosition = Owner.AnimationOrigin.Position
                                                    + new Vector2((float)(LenghtDirX), (float)(LenghtDirY));

                    CurrentAnimation.TransformationMatrix =
                        Matrix.CreateTranslation(-TranslationX, -TranslationY, 0)
                        * Matrix.CreateRotationZ(Angle)
                        * Matrix.CreateTranslation(RealGunNozzlePosition.X,
                                                   RealGunNozzlePosition.Y, 0);
                }
                else
                {
                    CurrentAnimation.TransformationMatrix =
                        Matrix.CreateTranslation(-TranslationX, -TranslationY, 0)
                        * Matrix.CreateRotationZ(Angle)
                        * Matrix.CreateTranslation(WeaponSlotTimeline.Position.X,
                                                   WeaponSlotTimeline.Position.Y, 0);
                }
            }
            else
            {
                CurrentAnimation.TransformationMatrix =
                    Matrix.CreateScale(0f);
            }
        }
Beispiel #13
0
        protected override string DoExecuteEffect()
        {
            string         MinHeight;
            RobotAnimation ActiveRobot = Params.LocalContext.Target;

            if (ActiveRobot.Speed.Y < ActiveRobot.GravityMax)
            {
                if (Params.LocalContext.Target.DicStoredVariable.TryGetValue("MinHeight", out MinHeight))
                {
                    float RealMinHeight = float.Parse(MinHeight);
                    float CurrentHeight = Params.LocalContext.Target.Position.Y;

                    if (CurrentHeight < RealMinHeight + 50)
                    {
                        if (ActiveRobot.Speed.Y < 0 && ActiveRobot.Speed.Y + ActiveRobot.Gravity > 0)
                        {
                            if (Params.LocalContext.Target.DicStoredVariable.ContainsKey("SpeedY"))
                            {
                                float ExpectedSpeedY = float.Parse(Params.LocalContext.Target.DicStoredVariable["SpeedY"]);
                                Params.LocalContext.Target.DicStoredVariable["SpeedY"] = (-ExpectedSpeedY).ToString();
                            }
                        }

                        ActiveRobot.Speed.Y += ActiveRobot.Gravity;
                    }
                    else
                    {
                        if (Params.LocalContext.Target.DicStoredVariable.ContainsKey("SpeedX"))
                        {
                            float ExpectedSpeedX = float.Parse(Params.LocalContext.Target.DicStoredVariable["SpeedX"]);

                            if (ActiveRobot.Speed.X < ExpectedSpeedX)
                            {
                                ActiveRobot.Speed.X += 0.05f;

                                if (ActiveRobot.Speed.X >= ExpectedSpeedX)
                                {
                                    ActiveRobot.Speed.X = ExpectedSpeedX;
                                }
                            }
                            else if (ActiveRobot.Speed.X > ExpectedSpeedX)
                            {
                                ActiveRobot.Speed.X -= 0.05f;

                                if (ActiveRobot.Speed.X <= ExpectedSpeedX)
                                {
                                    ActiveRobot.Speed.X = ExpectedSpeedX;
                                }
                            }
                        }
                        if (Params.LocalContext.Target.DicStoredVariable.ContainsKey("SpeedY"))
                        {
                            float ExpectedSpeedY = float.Parse(Params.LocalContext.Target.DicStoredVariable["SpeedY"]);

                            if (ActiveRobot.Speed.Y < ExpectedSpeedY)
                            {
                                ActiveRobot.Speed.Y += 0.05f;

                                if (ActiveRobot.Speed.Y >= ExpectedSpeedY)
                                {
                                    ActiveRobot.Speed.Y = ExpectedSpeedY;
                                }
                            }
                            else if (ActiveRobot.Speed.Y > ExpectedSpeedY)
                            {
                                ActiveRobot.Speed.Y -= 0.05f;

                                if (ActiveRobot.Speed.Y <= ExpectedSpeedY)
                                {
                                    ActiveRobot.Speed.Y = ExpectedSpeedY;
                                }
                            }
                        }
                    }
                }
            }

            return(null);
        }
Beispiel #14
0
        private void CreateExplosion(Vector2 ExplosionCenter, AttackBox ActiveAttackBox)
        {
            foreach (KeyValuePair <uint, RobotAnimation> ActiveRobotPair in DicRobot)
            {
                RobotAnimation TargetRobot = ActiveRobotPair.Value;

                bool IsSelf = TargetRobot == ActiveAttackBox.Owner;

                if (TargetRobot.HP <= 0 || (TargetRobot.Team == ActiveAttackBox.Owner.Team && !IsSelf))
                {
                    continue;
                }

                float DistanceFromCenter = Vector2.Distance(ExplosionCenter, TargetRobot.Position);

                if (DistanceFromCenter <= ActiveAttackBox.ExplosionAttributes.ExplosionRadius)
                {
                    float DistanceRatio = DistanceFromCenter / ActiveAttackBox.ExplosionAttributes.ExplosionRadius;
                    float ExplosionDiff = ActiveAttackBox.ExplosionAttributes.ExplosionDamageAtCenter - ActiveAttackBox.ExplosionAttributes.ExplosionDamageAtEdge;

                    float FinalDamage = ActiveAttackBox.ExplosionAttributes.ExplosionDamageAtCenter + ExplosionDiff * DistanceRatio;
                    if (IsSelf)
                    {
                        FinalDamage *= ActiveAttackBox.ExplosionAttributes.ExplosionDamageToSelfMultiplier;
                    }

                    if (Owner.IsOfflineOrServer || Owner.IsServer)
                    {
                        TargetRobot.HP -= (int)FinalDamage;

                        if (TargetRobot.HasKnockback)
                        {
                            float   WindDiff   = ActiveAttackBox.ExplosionAttributes.ExplosionWindPowerAtCenter - ActiveAttackBox.ExplosionAttributes.ExplosionWindPowerAtEdge;
                            Vector2 WindVector = Vector2.Normalize(TargetRobot.Position - ExplosionCenter);
                            Vector2 FinalWind  = WindVector * (ActiveAttackBox.ExplosionAttributes.ExplosionWindPowerAtCenter + WindDiff * DistanceRatio);

                            if (IsSelf)
                            {
                                FinalWind *= ActiveAttackBox.ExplosionAttributes.ExplosionWindPowerToSelfMultiplier;
                            }

                            TargetRobot.Speed += FinalWind;
                        }

                        OnDamageRobot(ActiveAttackBox.Owner, TargetRobot, (int)FinalDamage, TargetRobot.Position, Owner.IsMainCharacter(TargetRobot.ID));
                    }
                }
            }

            if (!Owner.IsServer && ActiveAttackBox.ExplosionAttributes.ExplosionAnimation.Path != string.Empty)
            {
                if (ActiveAttackBox.ExplosionAttributes.sndExplosion != null)
                {
                    PlayerSFXGenerator.PrepareExplosionSound(ActiveAttackBox.ExplosionAttributes.sndExplosion, ExplosionCenter);
                }

                SimpleAnimation NewExplosion = ActiveAttackBox.ExplosionAttributes.ExplosionAnimation.Copy();
                NewExplosion.IsLooped = false;
                NewExplosion.Position = new Vector2(ExplosionCenter.X, ExplosionCenter.Y - NewExplosion.PositionRectangle.Height / 2);
                ListImages.Add(NewExplosion);
            }
        }
Beispiel #15
0
 public DefaultArmor(RobotAnimation Owner)
     : base(Owner, 0)
 {
 }
Beispiel #16
0
 public void ChangeRobotLayer(RobotAnimation RobotToChange, int NewLayerIndex)
 {
     DicRobot.Remove(RobotToChange.ID);
     Owner.ChangeRobotLayer(RobotToChange, NewLayerIndex);
 }
Beispiel #17
0
        public void UpdateAttackCollisionWithRobot(GameTime gameTime, AttackBox ActiveAttackBox, RobotAnimation TargetRobot)
        {
            if (TargetRobot.HP <= 0 || TargetRobot.Team == ActiveAttackBox.Owner.Team)
            {
                return;
            }

            if (!ActiveAttackBox.ListAttackedRobots.Contains(TargetRobot))
            {
                PolygonCollisionResult FinalCollisionResult = new PolygonCollisionResult(Vector2.Zero, -1);
                Polygon FinalCollisionPolygon = null;

                foreach (CollisionPolygon EnemyCollision in TargetRobot.ListCollisionPolygon)
                {
                    foreach (Polygon CollisionPolygon in ActiveAttackBox.ListCollisionPolygon)
                    {
                        PolygonCollisionResult CollisionResult = Polygon.PolygonCollisionSAT(CollisionPolygon, EnemyCollision.ActivePolygon, ActiveAttackBox.Speed);

                        if (FinalCollisionResult.Distance < 0 || (CollisionResult.Distance >= 0 && CollisionResult.Distance > FinalCollisionResult.Distance))
                        {
                            FinalCollisionResult  = CollisionResult;
                            FinalCollisionPolygon = EnemyCollision.ActivePolygon;
                        }
                    }
                }

                if (FinalCollisionResult.Distance >= 0)
                {
                    if (TargetRobot.RobotAI != null)
                    {
                        TargetRobot.RobotAI.Update(gameTime, "On Hit");
                    }

                    Vector2 CollisionPoint;
                    ActiveAttackBox.OnCollision(FinalCollisionResult, FinalCollisionPolygon, out CollisionPoint);

                    if (ActiveAttackBox.ExplosionAttributes.ExplosionRadius > 0)
                    {
                        CreateExplosion(CollisionPoint, ActiveAttackBox);
                    }

                    ActiveAttackBox.ListAttackedRobots.Add(TargetRobot);

                    if (TargetRobot.HasKnockback)
                    {
                        TargetRobot.Speed.X = Math.Sign(ActiveAttackBox.Speed.X) * 3;
                        TargetRobot.Speed.Y = Math.Sign(ActiveAttackBox.Speed.Y) * 3;
                    }

                    if (Owner.IsOfflineOrServer || Owner.IsServer)
                    {
                        int FinalDamage = (int)ActiveAttackBox.Damage;

                        TargetRobot.HP -= FinalDamage;

                        OnDamageRobot(ActiveAttackBox.Owner, TargetRobot, FinalDamage, FinalCollisionPolygon.Center, Owner.IsMainCharacter(TargetRobot.ID));
                    }
                }
            }
        }
Beispiel #18
0
 public override void OnPartialAnimationLoopEnd(PartialAnimation ActivePartialAnimation, string ActiveMovementStance, RobotAnimation Owner)
 {
     if (IsReloading)
     {
         if (CanBeReloaded())
         {
             if (CurrentAnimation.AnimationPath == ReloadAnimationName)
             {
                 IsReloading = false;
                 Owner.ActivatePartialWeapon(this, GetAnimationName(ActiveMovementStance));
             }
             else
             {
                 InitiateFollowingAttack(true, ActiveMovementStance, Owner);
             }
         }
         else
         {
             IsReloading = false;
         }
     }
     else if (CurrentAnimation == ActivePartialAnimation)
     {
         CurrentAnimation = null;
         InitiateFollowingAttack(true, ActiveMovementStance, Owner);
         if (CurrentAnimation == null)
         {
             Owner.ActivatePartialWeapon(this, GetAnimationName(ActiveMovementStance));
         }
     }
 }
Beispiel #19
0
 public void RemoveRobot(RobotAnimation RobotToRemove)
 {
     ListRobotToRemove.Add(RobotToRemove.ID);
 }
Beispiel #20
0
 public MeleeBox(float Damage, RobotAnimation Owner, double Lifetime, bool FollowOwner)
     : base(Damage, new ExplosionOptions(), Owner, Lifetime, FollowOwner)
 {
 }
 /// <summary>
 /// Called by reflection
 /// </summary>
 public CollisionBoxTimeline(RobotAnimation Owner)
     : this()
 {
     this.Owner = Owner;
     Origin     = new Point(Width / 2, Height / 2);
 }
 public abstract void OnKill(RobotAnimation KillerPlayer, RobotAnimation KilledPlayer);
Beispiel #23
0
        public override void InitiateFollowingAttack(bool IsPartialAnimation, string ActiveMovementStance, RobotAnimation Owner)
        {
            if (!CanBeUsed)
            {
                Owner.Reload();
                return;
            }

            bool CanUseNextCombo = false;

            if (IsShooting || IsReloading)
            {
                if (AnimationType == AnimationTypes.PartialAnimation == IsPartialAnimation)
                {
                    CanUseNextCombo = true;
                }
                else
                {
                    if ((AnimationType == AnimationTypes.PartialAnimation) == IsPartialAnimation)
                    {
                        CanUseNextCombo = true;
                    }
                }

                if (CanUseNextCombo && IsReloading)
                {
                    if (AnimationType == AnimationTypes.PartialAnimation)
                    {
                        Owner.RemovePartialAnimation(HoldingAnimationName);
                        Owner.RemovePartialAnimation(ShootingAnimationName);
                        Owner.ActivatePartialWeapon(this, ReloadAnimationName);
                        CurrentAnimation.ActiveKeyFrame++;
                    }
                    else
                    {
                        Owner.LockAnimation = true;
                        Owner.ActivatePartialWeapon(this, ReloadAnimationName);
                    }
                }
                else if (CanUseNextCombo && IsShootingNext)
                {
                    if (AnimationType == AnimationTypes.PartialAnimation)
                    {
                        Owner.RemovePartialAnimation(HoldingAnimationName);
                        Owner.RemovePartialAnimation(ShootingAnimationName);
                        Owner.ActivatePartialWeapon(this, ShootingAnimationName);
                        CurrentAnimation.ActiveKeyFrame++;
                    }
                    else
                    {
                        Owner.LockAnimation = true;
                        Owner.ActivatePartialWeapon(this, ShootingAnimationName);
                    }
                }
            }

            _IsShooting    = IsShootingNext;
            IsShootingNext = false;
        }
Beispiel #24
0
        public override bool InitiateAttack(GameTime gameTime, AttackInputs AttackInput, MovementInputs CurrentMovementInput, string ActiveMovementStance, bool ForceCombo, RobotAnimation Owner)
        {
            if (!IsShootingNext)
            {
                if (_IsShooting)
                {
                    IsShootingNext = CurrentAnimation.ActiveKeyFrame >= CurrentAnimation.LoopEnd - 1;

                    if (InstantActivation)
                    {
                        InitiateFollowingAttack(AnimationType == AnimationTypes.PartialAnimation, ActiveMovementStance, Owner);
                        return(true);
                    }
                }
                //First use of a combo, use it immediatly.
                else
                {
                    IsShootingNext = true;
                    _IsShooting    = true;

                    InitiateFollowingAttack(AnimationType == AnimationTypes.PartialAnimation, ActiveMovementStance, Owner);
                    return(true);
                }
            }

            return(false);
        }
 public EmptyEquipment(RobotAnimation Owner)
     : base(Owner)
 {
 }
        public ProjectileBox(float Damage, Weapon.ExplosionOptions ExplosionAttributes, RobotAnimation Owner,
                             Vector2 Position, Vector2 Size, float Angle, ProjectileInfo ActiveProjectileInfo)
            : base(Damage, ExplosionAttributes, Owner, false)
        {
            this.ActiveProjectileInfo = ActiveProjectileInfo;
            this.Position             = Position;
            this.Angle             = Angle;
            this.AffectedByGravity = ActiveProjectileInfo.AffectedByGravity;

            this.Speed = new Vector2((float)Math.Cos(Angle) * ActiveProjectileInfo.ProjectileSpeed, (float)Math.Sin(Angle) * ActiveProjectileInfo.ProjectileSpeed);

            ProjectileAnimation          = ActiveProjectileInfo.ProjectileAnimation.Copy();
            ProjectileAnimation.Position = Position;

            if (ActiveProjectileInfo.TrailAnimation != null)
            {
                TrailAnimation          = ActiveProjectileInfo.TrailAnimation.Copy();
                TrailAnimation.Position = Position;
            }

            Owner.SetAttackContext(this, Owner, Angle, Position);

            float MinX = Position.X - Size.X / 2f;
            float MinY = Position.Y - Size.Y / 2f;
            float MaxX = MinX + Size.X;
            float MaxY = MinY + Size.Y;


            Polygon NewPolygon = new Polygon();

            NewPolygon.ArrayVertex    = new Vector2[4];
            NewPolygon.ArrayVertex[0] = new Vector2(MinX, MinY);
            NewPolygon.ArrayVertex[1] = new Vector2(MaxX, MaxY);
            NewPolygon.ArrayVertex[2] = new Vector2(MaxX, MaxY);
            NewPolygon.ArrayVertex[3] = new Vector2(MinX, MinY);

            NewPolygon.ComputePerpendicularAxis();
            NewPolygon.ComputerCenter();

            ListCollisionPolygon = new List <Polygon>(1)
            {
                NewPolygon
            };
        }
Beispiel #27
0
 public TripleThunderAIInfo(RobotAnimation Owner, Layer OwnerLayer, FightingZone OwnerMap)
 {
     this.Owner      = Owner;
     this.OwnerLayer = OwnerLayer;
     this.OwnerMap   = OwnerMap;
 }
Beispiel #28
0
 public void SetRobotContext(RobotAnimation ActiveRobotAnimation)
 {
     Owner.GlobalRobotContext.SetRobotContext(this, ActiveRobotAnimation);
 }
 public override void OnKill(RobotAnimation KillerPlayer, RobotAnimation KilledPlayer)
 {
     KillerPlayer.Kill++;
     KilledPlayer.Death++;
 }
Beispiel #30
0
 public void SetRobotContext(RobotAnimation ActiveRobotAnimation, Weapon ActiveWeapon, float Angle, Vector2 Position)
 {
     Owner.GlobalRobotContext.SetRobotContext(this, ActiveRobotAnimation, ActiveWeapon, Angle, Position);
 }