Exemplo n.º 1
0
 public override void InstructionsFromServer(byte byInstructionID, params float[] afParams)
 {
     if (byInstructionID == 0)
     {
         this.bInFastMode = true;
         this.SetFastMode(true);
         return;
     }
     if (byInstructionID == 1)
     {
         this.bInFastMode = false;
         this.SetFastMode(false);
         return;
     }
     if (byInstructionID == 2)
     {
         this.Kill(new Vector2(afParams[0], afParams[1]));
         this.bRunClientUpdate = true;
         return;
     }
     if (byInstructionID == 3)
     {
         this.xOwner.xCollisionComponent.ActivateGroup(CollisionComponent.ColliderGroup.All);
         this.bNonColliding = false;
         return;
     }
     if (byInstructionID == 4)
     {
         this.enCurrentAction = BrawlerBotAI.BrawlerBotAction.JumpDownRush;
     }
 }
Exemplo n.º 2
0
 public void UpdateJumpDown()
 {
     this.v2RandMoveDir = this.v2TravelDirBeforeJump;
     if (this.v2RandMoveDir != Vector2.Zero && this.xOwner.xRenderComponent.GetCurrentAnimation().bIsMoveCancellable)
     {
         this.xOwner.xTransform.v2Pos += this.xOwner.xBaseStats.fMovementSpeed * this.v2RandMoveDir;
     }
     Random knark = Program.GetTheGame().randomInLogic;
     if (this.enCurrentAction == BrawlerBotAI.BrawlerBotAction.JumpDownRush)
     {
         byte byDir = Utility.ConvertV2DirectionToClosestByteDirection(this.v2RandMoveDir);
         this.fYBeforeJump = this.xOwner.xTransform.v2Pos.Y;
         this.fTravelBeforeJump -= this.xOwner.xBaseStats.fMovementSpeed;
         if (this.fTravelBeforeJump <= this.xOwner.xBaseStats.fMovementSpeed * 12f && this.xOwner.xRenderComponent.iActiveAnimation < 28)
         {
             this.xOwner.xRenderComponent.SwitchAnimation((ushort)(28 + byDir), Animation.CancelOptions.IgnoreIfPlaying);
         }
         if (this.fTravelBeforeJump <= 0f)
         {
             if (this.xOwner.xRenderComponent.iActiveAnimation < 28)
             {
                 this.xOwner.xRenderComponent.SwitchAnimation((ushort)(28 + byDir), Animation.CancelOptions.IgnoreIfPlaying);
             }
             this.enCurrentAction = BrawlerBotAI.BrawlerBotAction.JumpDownJAMP;
             return;
         }
     }
     else if (this.enCurrentAction == BrawlerBotAI.BrawlerBotAction.JumpDownJAMP)
     {
         this.iJumpProgress++;
         if (this.iJumpProgress == 1)
         {
             Program.game.xRenderMaster.RegisterBelowSorted(this.xShadowRC);
             this.xShadowRC.xTransform.v2Pos.Y = this.fJumpTargetY;
             this.xShadowRC.xTransform.v2Pos.X = this.xOwner.xTransform.v2Pos.X;
             this.xShadowRC.fAlpha = 0f;
         }
         this.xShadowRC.xTransform.v2Pos.X = this.xOwner.xTransform.v2Pos.X;
         if (this.iJumpProgress < 1)
         {
             return;
         }
         if (this.iJumpProgress < 16)
         {
             AnimatedRenderComponent expr_22B_cp_0 = this.xOwner.xRenderComponent;
             expr_22B_cp_0.v2OffsetRenderPos.Y = expr_22B_cp_0.v2OffsetRenderPos.Y - (float)(15 - (this.iJumpProgress - 1)) / 6f;
             return;
         }
         if (this.iJumpProgress < 31)
         {
             AnimatedRenderComponent expr_264_cp_0 = this.xOwner.xRenderComponent;
             expr_264_cp_0.v2OffsetRenderPos.Y = expr_264_cp_0.v2OffsetRenderPos.Y + (float)(this.iJumpProgress - 16) / 6f;
             return;
         }
         this.xOwner.xRenderComponent.v2OffsetRenderPos.Y = 0f;
         TransformComponent expr_2AB_cp_0 = this.xOwner.xTransform;
         expr_2AB_cp_0.v2Pos.Y = expr_2AB_cp_0.v2Pos.Y + 4f;
         this.xShadowRC.fAlpha = 0.2f + 0.6f * (this.xOwner.xTransform.v2Pos.Y - this.fYBeforeJump) / (this.fJumpTargetY - this.fYBeforeJump);
         if (this.xShadowRC.fAlpha > 0.65f)
         {
             this.xShadowRC.fAlpha = 0.65f;
         }
         if (this.xOwner.xTransform.v2Pos.Y >= this.fJumpTargetY)
         {
             Program.game.xRenderMaster.UnregisterRenderComponenent(this.xShadowRC);
             this.xOwner.xTransform.v2Pos.Y = this.fJumpTargetY;
             if (this.iJumpProgress < 50)
             {
                 this.xOwner.xRenderComponent.fVirtualHeight += this.fJumpDownHeight;
             }
             this.xOwner.xCollisionComponent.ChangeColliderLayer(this.ibitCollisionLayerAtLanding);
             this.xOwner.xCollisionComponent.ActivateGroup(CollisionComponent.ColliderGroup.All);
             this.iJumpProgress = 0;
             this.enCurrentAction = BrawlerBotAI.BrawlerBotAction.Chillin;
             this.xOwner.xRenderComponent.SwitchAnimation((ushort)(36 + this.xOwner.byAnimationDirection), Animation.CancelOptions.IgnoreIfPlaying);
             this.v2RandMoveDir = Vector2.Zero;
             this.iNextHardUpdate = 40;
             this.bNonColliding = false;
             for (int i = 0; i < 8; i++)
             {
                 float fRotDir = 0.7853982f * (float)i + (float)knark.NextDouble() * 0.7853982f;
                 Vector2 v2Dir = Utility.RadiansToVector2(fRotDir);
                 float fModO = (float)knark.NextDouble();
                 _Effect_MovingAnimated eff = Program.GetTheGame()._EffectMaster_AddEffect(new _Effect_MovingAnimated(this.xOwner.xTransform.v2Pos, SortedAnimated.SortedAnimatedEffects.Particle_DustCloudSmall01, v2Dir * (1f + (float)Program.GetTheGame().randomInVisual.NextDouble() * 0.75f), 30 + (int)(5f * fModO), 10, 0.9f)) as _Effect_MovingAnimated;
                 eff.xRenderComponent.fVirtualHeight += this.xOwner.xRenderComponent.fVirtualHeight;
                 (eff.xRenderComponent as AnimatedRenderComponent).fAnimationTimeWarp = 1.3f;
                 eff.fRotationMod = (float)knark.NextDouble() * 0.5f - 0.25f;
             }
             for (int j = 0; j < 8; j++)
             {
                 float fRotDir2 = 0.7853982f * (float)j + (float)knark.NextDouble() * 0.7853982f;
                 Vector2 v2Dir2 = Utility.RadiansToVector2(fRotDir2);
                 float fModO2 = (float)knark.NextDouble();
                 _Effect_MovingAnimated eff2 = Program.GetTheGame()._EffectMaster_AddEffect(new _Effect_MovingAnimated(this.xOwner.xTransform.v2Pos, SortedAnimated.SortedAnimatedEffects.Particle_DustCloudSmall02, v2Dir2 * (1f + (float)Program.GetTheGame().randomInVisual.NextDouble() * 0.75f), 30 + (int)(5f * fModO2), 10, 0.9f)) as _Effect_MovingAnimated;
                 eff2.xRenderComponent.fVirtualHeight += this.xOwner.xRenderComponent.fVirtualHeight;
                 (eff2.xRenderComponent as AnimatedRenderComponent).fAnimationTimeWarp = 1.3f;
                 eff2.fRotationMod = (float)knark.NextDouble() * 0.5f - 0.25f;
             }
             if (Program.GetTheGame().xNetworkInfo.enCurrentRole != NetworkHelperInterface.NetworkRole.Client)
             {
                 base.SendClientInstruction(3, new float[0]);
             }
         }
     }
 }
Exemplo n.º 3
0
 public void SetJumpInfo(float fTravelBeforeJump, Vector2 v2TravelDirBeforeJump, float fJumpDownHeight, int ibitCollisionLayerAtLanding, Rectangle recDetectPlayers)
 {
     this.fTravelBeforeJump = fTravelBeforeJump;
     this.v2TravelDirBeforeJump = v2TravelDirBeforeJump;
     this.ibitCollisionLayerAtLanding = ibitCollisionLayerAtLanding;
     this.recDetectPlayers = recDetectPlayers;
     this.fJumpDownHeight = -fJumpDownHeight;
     this.fJumpTargetY = this.xOwner.xTransform.v2ServerPos.Y + fJumpDownHeight;
     this.bNonColliding = true;
     this.xOwner.xCollisionComponent.DeactivateGroup(CollisionComponent.ColliderGroup.All);
     this.enCurrentAction = BrawlerBotAI.BrawlerBotAction.JumpDownWait;
 }
Exemplo n.º 4
0
 public override void OnUpdate()
 {
     if (this.enCurrentAction == BrawlerBotAI.BrawlerBotAction.JumpDownWait)
     {
         this.bInited = true;
         this.iNextHardUpdate = 30;
         this.xOwner.xTransform.v2ServerPos = this.xOwner.xTransform.v2Pos;
         List<WorldActor> lxMos = Program.game._Enemy_GetTargetList(this, true);
         foreach (WorldActor x in lxMos)
         {
             if (this.recDetectPlayers.Contains(Utility.Vector2ToPoint(x.xTransform.v2Pos)))
             {
                 this.enCurrentAction = BrawlerBotAI.BrawlerBotAction.JumpDownRush;
                 base.SendClientInstruction(4, new float[0]);
                 break;
             }
         }
         return;
     }
     if (this.enCurrentAction == BrawlerBotAI.BrawlerBotAction.JumpDownRush || this.enCurrentAction == BrawlerBotAI.BrawlerBotAction.JumpDownJAMP)
     {
         this.UpdateJumpDown();
         return;
     }
     Random knark = Program.GetTheGame().randomInLogic;
     if (!this.bInited)
     {
         if (this.xOwner.xRenderComponent.iActiveAnimation >= 40)
         {
             return;
         }
         if (Program.GetTheGame().randomInLogic.Next(2) == 0)
         {
             this.xOwner.xRenderComponent.SwitchAnimation(1, Animation.CancelOptions.UseAnimationDefault);
         }
         else
         {
             this.xOwner.xRenderComponent.SwitchAnimation(3, Animation.CancelOptions.UseAnimationDefault);
         }
         this.bInited = true;
         this.iNextHardUpdate = 50;
     }
     if (this.iSuperSlowDownProgress > 0)
     {
         this.iSuperSlowDownProgress--;
         this.xOwner.xBaseStats.fMovementSpeed = 1.5f * ((float)this.iSuperSlowDownProgress / 24f);
         if (this.iSuperSlowDownProgress == 0)
         {
             this.SetFastMode(false);
         }
     }
     if (this.bGonnaDie)
     {
         this.MoveInDeath();
         return;
     }
     if (this.v2RandMoveDir != Vector2.Zero && this.xOwner.xRenderComponent.GetCurrentAnimation().bIsMoveCancellable)
     {
         this.xOwner.xTransform.v2Pos += this.xOwner.xBaseStats.fMovementSpeed * this.v2RandMoveDir;
     }
     this.iCounter++;
     this.iNextHardUpdate--;
     if (Utility.IsWithinRange((int)this.xOwner.xRenderComponent.iActiveAnimation, 40000, 40003))
     {
         return;
     }
     if (this.bInFastMode && !Utility.IsWithinRange((int)this.xOwner.xRenderComponent.iActiveAnimation, 20, 23))
     {
         this.SetFastMode(false);
     }
     if (this.enCurrentAction == BrawlerBotAI.BrawlerBotAction.NormalAttack)
     {
         if (!Utility.IsWithinRange((int)this.xOwner.xRenderComponent.iActiveAnimation, 4, 7))
         {
             this.enCurrentAction = BrawlerBotAI.BrawlerBotAction.Chillin;
             this.xPlayerLockedOnto = null;
         }
     }
     else if (this.enCurrentAction == BrawlerBotAI.BrawlerBotAction.TakingDamage)
     {
         if (this.iNextHardUpdate <= 0)
         {
             this.enCurrentAction = BrawlerBotAI.BrawlerBotAction.Chillin;
         }
     }
     else
     {
         if (this.iNextHardUpdate <= 0 && this.enCurrentAction != BrawlerBotAI.BrawlerBotAction.Dashing)
         {
             if (knark.Next(20) == 1)
             {
                 this.iNextHardUpdate = 45;
                 this.v2RandMoveDir = new Vector2(-1f + (float)knark.NextDouble() * 2f, -1f + (float)knark.NextDouble() * 2f);
                 this.v2RandMoveDir.Normalize();
                 this.xOwner.xRenderComponent.SwitchAnimation((ushort)Utility.ConvertV2DirectionToClosestByteDirection(this.v2RandMoveDir), Animation.CancelOptions.UseAnimationDefault);
             }
             else
             {
                 this.iNextHardUpdate = 10;
                 this.v2RandMoveDir = Vector2.Zero;
                 this.xOwner.xRenderComponent.SwitchAnimation((ushort)this.xOwner.xRenderComponent.GetCurrentAnimation().byAnimationDirection, Animation.CancelOptions.UseAnimationDefault);
             }
             Program.GetTheGame();
             Rectangle arg_381_0 = Program.GetTheGame().xLevelMaster.xCurrentLevel.recCurrentBounds;
             float fDistance;
             base.FindTarget(EnemyBehaviour.TargetSearchParameters.Farthest, this.fAggroDistance * 2f, out fDistance);
             bool bDashing = true;
             if (fDistance < 120f || knark.Next(4) < 3)
             {
                 this.xPlayerLockedOnto = base.FindTarget(EnemyBehaviour.TargetSearchParameters.Closest, this.fAggroDistance, out fDistance);
                 bDashing = false;
             }
             if (this.xPlayerLockedOnto != null)
             {
                 Vector2 v2Dir = Vector2.Zero;
                 if (this.byEngageDir != 4)
                 {
                     v2Dir = Vector2.Normalize(this.xPlayerLockedOnto.xTransform.v2Pos - this.xOwner.xTransform.v2Pos);
                     if ((this.byEngageDir == 0 && v2Dir.Y < 0f) || (this.byEngageDir == 1 && v2Dir.X > 0f) || (this.byEngageDir == 2 && v2Dir.Y > 0f) || (this.byEngageDir == 3 && v2Dir.X < 0f))
                     {
                         this.byEngageDir = 4;
                     }
                 }
                 if (this.byEngageDir == 4)
                 {
                     int iDirSelect = knark.Next(2);
                     v2Dir = Vector2.Normalize(this.xPlayerLockedOnto.xTransform.v2Pos - this.xOwner.xTransform.v2Pos);
                     byte byMossan = this.OtherBrawlerBotAttackDirection(this.xPlayerLockedOnto);
                     if ((iDirSelect == 0 && byMossan != 3 && byMossan != 1) || byMossan == 0 || byMossan == 2)
                     {
                         if (v2Dir.X < 0f || byMossan == 3)
                         {
                             this.byEngageDir = 1;
                         }
                         else
                         {
                             this.byEngageDir = 3;
                         }
                     }
                     else if (v2Dir.Y < 0f || byMossan == 0)
                     {
                         this.byEngageDir = 2;
                     }
                     else
                     {
                         this.byEngageDir = 0;
                     }
                 }
                 this.iNextHardUpdate = 30;
                 if (bDashing)
                 {
                     this.enCurrentAction = BrawlerBotAI.BrawlerBotAction.Dashing;
                     this.xOwner.xRenderComponent.SwitchAnimation((ushort)(this.xOwner.byAnimationDirection + 16), Animation.CancelOptions.IgnoreIfPlaying);
                 }
                 else
                 {
                     this.enCurrentAction = BrawlerBotAI.BrawlerBotAction.Walkin;
                 }
             }
         }
         if (this.xPlayerLockedOnto != null)
         {
             bool bDidAttack = false;
             float fDistance2 = Vector2.Distance(this.xOwner.xTransform.v2Pos, this.xPlayerLockedOnto.xTransform.v2Pos);
             if (this.enCurrentAction != BrawlerBotAI.BrawlerBotAction.Dashing && fDistance2 <= this.fMinAttackDistance)
             {
                 if (MathHelper.Distance(this.xOwner.xTransform.v2Pos.X, this.xPlayerLockedOnto.xTransform.v2Pos.X) < 9f)
                 {
                     if (this.xOwner.xTransform.v2Pos.Y < this.xPlayerLockedOnto.xTransform.v2Pos.Y)
                     {
                         Program.GetTheGame()._Enemy_EnterAttackAnimation(this.xOwner, 6);
                     }
                     else
                     {
                         Program.GetTheGame()._Enemy_EnterAttackAnimation(this.xOwner, 4);
                     }
                     bDidAttack = true;
                 }
                 else if (MathHelper.Distance(this.xOwner.xTransform.v2Pos.Y, this.xPlayerLockedOnto.xTransform.v2Pos.Y) < 9f)
                 {
                     if (this.xOwner.xTransform.v2Pos.X < this.xPlayerLockedOnto.xTransform.v2Pos.X)
                     {
                         Program.GetTheGame()._Enemy_EnterAttackAnimation(this.xOwner, 5);
                     }
                     else
                     {
                         Program.GetTheGame()._Enemy_EnterAttackAnimation(this.xOwner, 7);
                     }
                     bDidAttack = true;
                 }
                 if (bDidAttack)
                 {
                     this.v2RandMoveDir = Vector2.Zero;
                     this.iNextHardUpdate = 150 - Program.GetTheGame()._Enemy_GetDifficultyModifier() * 18;
                     this.enCurrentAction = BrawlerBotAI.BrawlerBotAction.NormalAttack;
                 }
             }
             if (!bDidAttack)
             {
                 bool bPathFound = true;
                 if (this.iCounter % 20 == 0)
                 {
                     if (Program.game._CollisionMaster_RayCastVsStatic(this.xOwner.xTransform.v2Pos, this.xPlayerLockedOnto.xTransform.v2Pos, 3f, 3, Utility.CreateIntMask(new int[]
                     {
                         30
                     })))
                     {
                         this.lxPath = Program.game.xLevelMaster.xPathFinding.FindPath(this.xOwner.xTransform.v2Pos, this.xPlayerLockedOnto.xTransform.v2Pos);
                         if (this.lxPath == null)
                         {
                             bPathFound = false;
                         }
                     }
                     else
                     {
                         this.lxPath = null;
                     }
                 }
                 if (this.lxPath == null)
                 {
                     this.v2RandMoveDir = Vector2.Normalize(this.xPlayerLockedOnto.xTransform.v2Pos + Utility.AnimationDirectionToVector2((int)this.byEngageDir) * 30f - this.xOwner.xTransform.v2Pos);
                 }
                 else
                 {
                     this.v2RandMoveDir = Vector2.Lerp(this.v2RandMoveDir, Vector2.Normalize(this.lxPath[0].v2Position - this.xOwner.xTransform.v2Pos), 0.1f);
                     if (Vector2.Distance(this.lxPath[0].v2Position, this.xOwner.xTransform.v2Pos) <= this.xOwner.xBaseStats.fMovementSpeed)
                     {
                         this.lxPath.RemoveAt(0);
                         if (this.lxPath.Count == 0)
                         {
                             this.lxPath = null;
                         }
                     }
                 }
                 byte byAnimDir = Utility.ConvertV2DirectionToClosestByteDirection(this.v2RandMoveDir);
                 if (this.enCurrentAction != BrawlerBotAI.BrawlerBotAction.Dashing)
                 {
                     this.xOwner.xRenderComponent.SwitchAnimation((ushort)byAnimDir, Animation.CancelOptions.IgnoreIfPlaying);
                 }
                 else
                 {
                     if ((fDistance2 < 50f || fDistance2 > 400f || !bPathFound) && !Utility.IsWithinRange((int)this.xOwner.xRenderComponent.iActiveAnimation, 24, 27))
                     {
                         this.xOwner.xRenderComponent.SwitchAnimation((ushort)(24 + this.xOwner.byAnimationDirection), Animation.CancelOptions.IgnoreIfPlaying);
                         this.enCurrentAction = BrawlerBotAI.BrawlerBotAction.Chillin;
                         this.iNextHardUpdate = 60;
                         this.xPlayerLockedOnto = null;
                         return;
                     }
                     if (Utility.IsWithinRange((int)this.xOwner.xRenderComponent.iActiveAnimation, 16, 19))
                     {
                         if (byAnimDir != this.xOwner.byAnimationDirection)
                         {
                             float fTicks = this.xOwner.xRenderComponent.fPassedTicks;
                             this.xOwner.xRenderComponent.SwitchAnimation((ushort)(byAnimDir + 16), Animation.CancelOptions.IgnoreIfPlaying);
                             this.xOwner.xRenderComponent.fPassedTicks = fTicks;
                         }
                     }
                     else if (Utility.IsWithinRange((int)this.xOwner.xRenderComponent.iActiveAnimation, 20, 23))
                     {
                         if (!this.bInFastMode)
                         {
                             this.SetFastMode(true);
                         }
                         if (this.iCounter % 6 == 0)
                         {
                             Program.GetTheGame()._EffectMaster_AddEffect(new VFX_GenericGhostImage(this.xOwner.xTransform.v2Pos, this.xOwner.xRenderComponent));
                         }
                         if (byAnimDir != this.xOwner.byAnimationDirection)
                         {
                             float fTicks2 = this.xOwner.xRenderComponent.fPassedTicks;
                             this.xOwner.xRenderComponent.SwitchAnimation((ushort)(byAnimDir + 20), Animation.CancelOptions.IgnoreIfPlaying);
                             this.xOwner.xRenderComponent.fPassedTicks = fTicks2;
                         }
                     }
                     else
                     {
                         Utility.IsWithinRange((int)this.xOwner.xRenderComponent.iActiveAnimation, 24, 27);
                     }
                 }
             }
         }
     }
     this.xOwner.xTransform.v2ServerPos = this.xOwner.xTransform.v2Pos;
 }
Exemplo n.º 5
0
 public override void OnHitByAttack(AttackCollisionData xAtColData, AttackPhase xAtPhase)
 {
     if (xAtPhase.xStats.iBreakingPower >= 0)
     {
         this.iNextHardUpdate = 34;
         this.enCurrentAction = BrawlerBotAI.BrawlerBotAction.TakingDamage;
     }
     if (!this.bGonnaDie)
     {
         this.v2RandMoveDir = Vector2.Zero;
     }
     base.OnHitByAttack(xAtColData, xAtPhase);
     NetworkHelperInterface.NetworkRole arg_49_0 = Program.GetTheGame().xNetworkInfo.enCurrentRole;
 }
Exemplo n.º 6
0
 public override void OnAnimationCallback(AnimationInstruction xIns)
 {
     if (xIns.xEvent.afAlterableValues[0] == 0f)
     {
         this.enCurrentAction = BrawlerBotAI.BrawlerBotAction.Chillin;
         this.iNextHardUpdate = 0;
         this.StopDashSound();
         return;
     }
     if (xIns.xEvent.afAlterableValues[0] == 1f)
     {
         this.enCurrentAction = BrawlerBotAI.BrawlerBotAction.Chillin;
         this.iNextHardUpdate = 0;
         return;
     }
     if (xIns.xEvent.afAlterableValues[0] == 2f)
     {
         if (this.xDashSoundWrapper == null)
         {
             this.xDashSoundWrapper = Program.game.xSoundSystem.PlayCue("BrawlerBot_DashMid", this.xOwner, true);
             return;
         }
     }
     else if (xIns.xEvent.afAlterableValues[0] == 3f)
     {
         this.iSuperSlowDownProgress = 24;
     }
 }