Example #1
0
 public VFX_GenericGhostImage(Vector2 v2Pos, RenderComponent xParent, float fFadeSpeed, float fStartAlpha, Color cCol)
     : base()
 {
     this.fFadeSpeed = 0.03f;
     this.xTransform = new TransformComponent(v2Pos);
     SnatchRenderComponent xStat = new SnatchRenderComponent(xParent, this.xTransform);
     this.xRenderComponent = xStat;
     this.xRenderComponent.fVirtualHeight = xParent.fVirtualHeight;
     this.xRenderComponent.cColor = cCol;
     this.xRenderComponent.fAlpha = fStartAlpha;
     this.xRenderComponent.v2OffsetRenderPos = xParent.v2OffsetRenderPos;
     this.fFadeSpeed = fFadeSpeed;
     Program.GetTheGame().xRenderMaster.RegisterSortedRenderComponent(this.xRenderComponent);
 }
Example #2
0
 public override void OnNetworkInstruction(params float[] p_af)
 {
     if (p_af[0] == 0f)
     {
         this.bTriggered = true;
         using (Dictionary<long, PlayerView>.ValueCollection.Enumerator enumerator = Program.game.dixPlayers.Values.GetEnumerator())
         {
             while (enumerator.MoveNext())
             {
                 PlayerView xView = enumerator.Current;
                 SnatchRenderComponent xRC = new SnatchRenderComponent(xView.xEntity.xRenderComponent, new TransformComponent(xView.xEntity.xTransform.v2Pos));
                 this.lxSnatchedPlayerRC.Add(xRC);
                 Program.game.xRenderMaster.RegisterSortedRenderComponent(xRC);
             }
             return;
         }
     }
     if (p_af[0] == 1f)
     {
         this.bClosing = true;
     }
 }
Example #3
0
 public virtual void SnatchRender(SnatchRenderComponent snatch, GraphicsDevice Device, SpriteBatch spriteBatch)
 {
     snatch.bSnatchedSuccessful = false;
 }
Example #4
0
 public override void SnatchRender(SnatchRenderComponent snatch, GraphicsDevice Device, SpriteBatch spriteBatch)
 {
     int iWidth = this.rt2dCurrentFrame.Width;
     int iHeight = this.rt2dCurrentFrame.Height;
     if (snatch.sJustSnatched != "Player")
     {
         snatch.rt2dRenderTarget = new RenderTarget2D(Device, iWidth, iHeight, false, SurfaceFormat.Color, DepthFormat.Depth24Stencil8);
     }
     snatch.sJustSnatched = "Player";
     Device.SetRenderTarget(snatch.rt2dRenderTarget);
     Device.Clear(Color.Transparent);
     this.PreRender(spriteBatch);
     snatch.bSnatchedSuccessful = true;
     snatch.v2Offset = new Vector2(75f, 75f);
 }
 public override void SnatchRender(SnatchRenderComponent snatch, GraphicsDevice Device, SpriteBatch spriteBatch)
 {
     int iWidth = this.GetCurrentAnimation().iCellWidth;
     int iHeight = this.GetCurrentAnimation().iCellHeight;
     snatch.rt2dRenderTarget = new RenderTarget2D(Device, iWidth, iHeight, false, SurfaceFormat.Color, DepthFormat.Depth24Stencil8);
     Device.SetRenderTarget(snatch.rt2dRenderTarget);
     Device.Clear(Color.Transparent);
     spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.Default, null);
     Texture2D txToUse = this.dixAnimations[this.iActiveAnimation].txTexture;
     if (RenderMaster.enCurrentPass != RenderMaster.PlayfieldRenderPass.Standard && this.dditxAlternateTextures.ContainsKey(RenderMaster.enCurrentPass))
     {
         txToUse = this.dditxAlternateTextures[RenderMaster.enCurrentPass][this.iActiveAnimation];
     }
     if (!txToUse.IsDisposed)
     {
         spriteBatch.Draw(txToUse, Vector2.Zero, new Rectangle?(this.dixAnimations[this.iActiveAnimation].recCurrentFrame), this.cColor * this.fAlpha, this.fRotation, Vector2.Zero, 1f, this.enSpriteEffect, 0f);
     }
     spriteBatch.End();
     snatch.v2Scale = this.v2Scale;
     snatch.v2Offset = this.dixAnimations[this.iActiveAnimation].v2PositionOffset;
     snatch.fVirtualHeight = this.fVirtualHeight;
     snatch.bSnatchedSuccessful = true;
 }
Example #6
0
 public void Swallow(PlayerView xView)
 {
     this.xSwallowedPlayer = xView;
     this.xSwallowedPlayer.xEntity.bShieldUp = false;
     this.xSwallowedPlayer.xEntity.xBaseStats.HealShieldDamage(10000f);
     this.xSwallowPlayerRC = new SnatchRenderComponent(xView.xEntity.xRenderComponent, new TransformComponent(xView.xEntity.xTransform.v2Pos));
     Program.GetTheGame()._Player_UnsummonAll(this.xSwallowedPlayer.xEntity);
     this.iCounter = 0;
     this.enCurrentAction = Trick_Original.CurrentAction.Swallowing;
     Program.GetTheGame().xRenderMaster.RegisterSortedRenderComponent(this.xSwallowPlayerRC);
     if (this.xTreat.xPlayerLockedOnto == xView.xEntity)
     {
         this.xTreat.PlayerRemovedFromPlay(xView.xEntity);
     }
     xView.xEntity.xCollisionComponent.DeactivateGroup(CollisionComponent.ColliderGroup.All);
 }
Example #7
0
 public override void OnUpdate()
 {
     if (!this.bActive)
     {
         this.xOwner.xTransform.v2ServerPos = this.xOwner.xTransform.v2Pos;
         return;
     }
     if (!this.bInited)
     {
         this.xOwner.xRenderComponent.SwitchAnimation((ushort)((byte)Program.GetTheGame().randomInLogic.Next(4)), Animation.CancelOptions.UseAnimationDefault);
         this.bAggro = true;
         this.bInited = true;
         this.iNumberOfPlayers = Program.GetTheGame().dixPlayers.Count;
     }
     if (this.xBullet != null)
     {
         this.xBullet.xEffect.xTransform.v2Pos += this.xBullet.v2TravelDir;
         if (this.xBullet.xEffect.xTransform.v2Pos.Y >= 310f)
         {
             this.xSwallowedPlayer.xEntity.xTransform.SetBoth(this.xBullet.xEffect.xTransform.v2Pos);
             Program.GetTheGame()._CollisionMaster_ApplyAndSendPlayerPushback(this.xSwallowedPlayer.xEntity, new Vector2(0f, -30f));
             this.xSwallowedPlayer.xEntity.xRenderComponent.SwitchAnimation(14, Animation.CancelOptions.IgnoreIfPlaying);
             Program.GetTheGame()._Player_TakeDamage(this.xSwallowedPlayer, 20, 0);
             this.xSwallowedPlayer.xEntity.xCollisionComponent.ActivateGroup(CollisionComponent.ColliderGroup.All);
             Program.GetTheGame()._EffectMaster_AddEffect(new SortedAnimated(this.xBullet.xEffect.xTransform.v2Pos, SortedAnimated.SortedAnimatedEffects.SlimeDeath));
             this.xBullet.xEffect.bToBeDestroyed = true;
             this.xBullet = null;
             this.xSwallowedPlayer = null;
         }
     }
     if (this.xTreat.xPlayerLockedOnto == this.xPlayerLockedOnto && !this.bIsLead)
     {
         if (Vector2.Distance(this.xTreat.xOwner.xTransform.v2Pos, this.xOwner.xTransform.v2Pos) > 70f)
         {
             this.fRotDir = this.xTreat.fRotDir;
         }
         else
         {
             this.fRotDir = -this.xTreat.fRotDir;
         }
     }
     if (this.v2RandMoveDir != Vector2.Zero)
     {
         float fSpeedBonus = 1f;
         this.xOwner.xTransform.v2Pos += this.xOwner.xBaseStats.fMovementSpeed * this.v2RandMoveDir * fSpeedBonus;
     }
     else if (Utility.IsWithinRange((int)this.xOwner.xRenderComponent.iActiveAnimation, 4, 7))
     {
         this.xOwner.xRenderComponent.SwitchAnimation((ushort)this.xOwner.byAnimationDirection, Animation.CancelOptions.IgnoreIfPlaying);
     }
     if (this.iDowned > 0)
     {
         this.iDowned--;
         ushort lol = 12;
         if (this.xOwner.byAnimationDirection == 3)
         {
             lol = 13;
         }
         if (this.iDowned == 0)
         {
             this.xOwner.xRenderComponent.SwitchAnimation(lol, Animation.CancelOptions.UseAnimationDefault);
         }
     }
     this.iCounter++;
     this.iTimeSinceLastAttack++;
     this.iNextHardUpdate--;
     this.iWannaCircleBaby--;
     if (this.enCurrentAction == Trick_Original.CurrentAction.Sucking)
     {
         if (this.xOwner.xRenderComponent.iActiveAnimation == 13)
         {
             List<WorldActor> lxTargets = Program.GetTheGame()._Enemy_GetTargetList(this, true);
             float fRange = 60f;
             float fSwallowRange = 10f;
             float fMaxEffect = 12f;
             float fMinEffect = 3f;
             float fClosest = 10000f;
             for (int i = 0; i < lxTargets.Count; i++)
             {
                 if (!(this.xOwner.xTransform.v2Pos == lxTargets[i].xTransform.v2Pos))
                 {
                     Vector2 v2Dir = Vector2.Normalize(this.xOwner.xTransform.v2Pos + new Vector2(0f, 8f) - lxTargets[i].xTransform.v2Pos);
                     if (this.xOwner.xTransform.v2Pos.Y + 8f <= lxTargets[i].xTransform.v2Pos.Y)
                     {
                         float fDistance = Vector2.Distance(this.xOwner.xTransform.v2Pos, lxTargets[i].xTransform.v2Pos);
                         fClosest = fDistance;
                         if (fDistance < fRange)
                         {
                             if (fDistance <= fSwallowRange)
                             {
                                 if (lxTargets[i].enEntityType == IEntity.EntityType.Player)
                                 {
                                     this.Swallow((lxTargets[i] as PlayerEntity).Owner);
                                     return;
                                 }
                             }
                             else
                             {
                                 float fEffect = (1f - fDistance / fRange) * (fMaxEffect - fMinEffect) + fMinEffect;
                                 lxTargets[i].xTransform.v2SmoothPush = v2Dir * fEffect;
                             }
                         }
                     }
                 }
             }
             if (this.iCounter >= 300 || fClosest > fRange)
             {
                 this.xOwner.xRenderComponent.SwitchAnimation(14, Animation.CancelOptions.IgnoreIfPlaying);
                 this.enCurrentAction = Trick_Original.CurrentAction.WaitTo0;
                 this.iCounter = -60;
             }
         }
     }
     else if (this.enCurrentAction == Trick_Original.CurrentAction.Swallowing)
     {
         if (this.xSwallowPlayerRC != null)
         {
             this.xSwallowPlayerRC.fVirtualHeight = 20f;
             TransformComponent expr_531_cp_0 = this.xSwallowPlayerRC.xTransform;
             expr_531_cp_0.v2Pos.Y = expr_531_cp_0.v2Pos.Y - 0.15f;
             this.xSwallowPlayerRC.fScale *= 0.96f;
             this.xSwallowPlayerRC.fRotation += 0.3f;
             this.xSwallowPlayerRC.fAlpha -= 0.025f;
         }
         if (this.iCounter == 1)
         {
             if (this.xSwallowedPlayer != null)
             {
                 this.xSwallowedPlayer.xEntity.xRenderComponent.SwitchAnimation(41000, Animation.CancelOptions.IgnoreIfPlaying);
             }
             SnatchRenderComponent expr_5BE_cp_0 = this.xSwallowPlayerRC;
             expr_5BE_cp_0.v2Offset.Y = expr_5BE_cp_0.v2Offset.Y - 15f;
             TransformComponent expr_5DF_cp_0 = this.xSwallowPlayerRC.xTransform;
             expr_5DF_cp_0.v2Pos.Y = expr_5DF_cp_0.v2Pos.Y - 15f;
         }
         if (this.iCounter == 36)
         {
             this.xOwner.xRenderComponent.SwitchAnimation(15, Animation.CancelOptions.IgnoreIfPlaying);
         }
         if (this.iCounter == 40)
         {
             Program.GetTheGame().xRenderMaster.UnregisterRenderComponenent(this.xSwallowPlayerRC);
             this.xSwallowPlayerRC = null;
         }
     }
     else if (this.enCurrentAction == Trick_Original.CurrentAction.Swallowed)
     {
         if (this.iCounter == 120)
         {
             this.xOwner.xRenderComponent.SwitchAnimation(22, Animation.CancelOptions.IgnoreIfPlaying);
         }
     }
     else if (this.enCurrentAction == Trick_Original.CurrentAction.WaitTo0)
     {
         if (this.iCounter == 0)
         {
             this.enCurrentAction = Trick_Original.CurrentAction.WaitingForlead;
         }
     }
     else if (this.xOwner.xRenderComponent.GetCurrentAnimation().bIsMoveCancellable)
     {
         if (this.enCurrentAction == Trick_Original.CurrentAction.Sumthin)
         {
             Vector2 v2Look = this.xPlayerLockedOnto.xTransform.v2Pos - this.xOwner.xTransform.v2Pos;
             v2Look.Normalize();
             byte lolKuk = Utility.ConvertV2DirectionToClosestByteDirection(v2Look);
             this.xOwner.xRenderComponent.SwitchAnimation((ushort)lolKuk, Animation.CancelOptions.UseAnimationDefault);
         }
         if (this.iNextHardUpdate <= 0)
         {
             this.iNextHardUpdate = 10;
             Game1 Lord = Program.GetTheGame();
             Random knark = Program.GetTheGame().randomInLogic;
             Rectangle arg_732_0 = Program.GetTheGame().xLevelMaster.xCurrentLevel.recCurrentBounds;
             float fClosest2 = 50000f;
             PlayerEntity xClosestPlayer = null;
             if (this.bAggro)
             {
                 foreach (PlayerView xPlayer in Lord.dixPlayers.Values)
                 {
                     if (!xPlayer.xViewStats.bIsDead && this.xTreat.xSwallowedPlayer != xPlayer)
                     {
                         float fDist = Vector2.Distance(xPlayer.xEntity.xTransform.v2Pos, this.xOwner.xTransform.v2Pos);
                         if (fDist < this.fAggroDistance && fDist < fClosest2)
                         {
                             xClosestPlayer = xPlayer.xEntity;
                             fClosest2 = fDist;
                         }
                     }
                 }
             }
             if (xClosestPlayer == null)
             {
                 this.iWannaCircleBaby = 0;
             }
             if (xClosestPlayer != null)
             {
                 this.xPlayerLockedOnto = xClosestPlayer;
                 if (this.iWannaCircleBaby == 0)
                 {
                     this.iWannaCircleBaby = 60 + knark.Next(230);
                 }
                 if (this.bIsLead && knark.Next(2) == 0)
                 {
                     this.fRotDir *= -1;
                 }
                 Vector2 v2Dirr = this.xPlayerLockedOnto.xTransform.v2Pos - this.xOwner.xTransform.v2Pos;
                 v2Dirr.Normalize();
                 this.fCurrentRotation = (float)Math.Atan2((double)v2Dirr.X, (double)(-(double)v2Dirr.Y));
                 float fDistance2 = Vector2.Distance(this.xPlayerLockedOnto.xTransform.v2Pos, this.xOwner.xTransform.v2Pos);
                 if (this.bIsLead && this.enCurrentAction == Trick_Original.CurrentAction.WaitingForlead && fDistance2 <= this.fFurthestAllowedDistance && fDistance2 >= this.fMinAttackDistance)
                 {
                     if (MathHelper.Distance(this.xOwner.xTransform.v2Pos.Y, this.xPlayerLockedOnto.xTransform.v2Pos.Y) < 10f)
                     {
                         if (this.xOwner.xTransform.v2Pos.X < this.xPlayerLockedOnto.xTransform.v2Pos.X)
                         {
                             this.byChosenDirection = 1;
                             this.enCurrentAction = Trick_Original.CurrentAction.SurroundingAsLead;
                         }
                         else
                         {
                             this.byChosenDirection = 3;
                             this.enCurrentAction = Trick_Original.CurrentAction.SurroundingAsLead;
                         }
                     }
                     else if (MathHelper.Distance(this.xOwner.xTransform.v2Pos.X, this.xPlayerLockedOnto.xTransform.v2Pos.X) < 10f)
                     {
                         if (this.xOwner.xTransform.v2Pos.Y < this.xPlayerLockedOnto.xTransform.v2Pos.Y)
                         {
                             this.byChosenDirection = 2;
                             this.enCurrentAction = Trick_Original.CurrentAction.SurroundingAsLead;
                         }
                         else
                         {
                             this.byChosenDirection = 0;
                             this.enCurrentAction = Trick_Original.CurrentAction.SurroundingAsLead;
                         }
                     }
                     this.v2RandMoveDir = Vector2.Zero;
                     this.iNextHardUpdate = 0;
                 }
                 bool bDidAttack = false;
                 if (this.enCurrentAction == Trick_Original.CurrentAction.WaitingForlead)
                 {
                     if (Vector2.Distance(this.v2TargetPos, this.xOwner.xTransform.v2Pos) < 10f)
                     {
                         this.fCurrentRotation += (float)this.fRotDir * 0.02f;
                     }
                     this.iNextHardUpdate = 5;
                     Vector2 v2Look2 = this.xPlayerLockedOnto.xTransform.v2Pos - this.xOwner.xTransform.v2Pos;
                     v2Look2.Normalize();
                     byte lolKuk2 = Utility.ConvertV2DirectionToClosestByteDirection(v2Look2);
                     this.xOwner.xRenderComponent.SwitchAnimation((ushort)(lolKuk2 + 4), Animation.CancelOptions.UseAnimationDefault);
                     float x = (float)Math.Cos((double)this.fCurrentRotation);
                     float y = (float)Math.Sin((double)this.fCurrentRotation);
                     this.v2TargetPos = this.xPlayerLockedOnto.xTransform.v2Pos + new Vector2(x * this.fTargetDistance, y * this.fTargetDistance);
                     if (this.xTreat.xPlayerLockedOnto == this.xPlayerLockedOnto && !this.bIsLead && (this.bGetToOtherSide || Vector2.Distance(this.xTreat.xOwner.xTransform.v2Pos, this.xOwner.xTransform.v2Pos) < 70f))
                     {
                         this.v2TargetPos = this.xPlayerLockedOnto.xTransform.v2Pos + (this.xPlayerLockedOnto.xTransform.v2Pos - this.xTreat.xOwner.xTransform.v2Pos);
                         this.bGetToOtherSide = true;
                     }
                     this.v2RandMoveDir = this.v2TargetPos - this.xOwner.xTransform.v2Pos;
                     this.v2RandMoveDir.Normalize();
                     if (!this.bIsLead && this.xTreat.byChosenDirection != 4)
                     {
                         this.enCurrentAction = Trick_Original.CurrentAction.SurroundingAsFollow;
                         this.v2RandMoveDir = Vector2.Zero;
                         this.byRandomFollowAdd = (byte)(Program.GetTheGame().randomInLogic.Next(3) + 1);
                         this.byChosenDirection = (byte)((this.xTreat.byChosenDirection + this.byRandomFollowAdd) % 4);
                     }
                 }
                 else if (this.enCurrentAction == Trick_Original.CurrentAction.Sumthin)
                 {
                     this.iNextHardUpdate = 10;
                     this.enCurrentAction = Trick_Original.CurrentAction.WaitingForlead;
                 }
                 else if (this.enCurrentAction == Trick_Original.CurrentAction.SurroundingAsFollow)
                 {
                     if (this.byChosenDirection == this.xTreat.byChosenDirection)
                     {
                         this.byRandomFollowAdd = (byte)(Program.GetTheGame().randomInLogic.Next(3) + 1);
                         this.byChosenDirection = (byte)((this.xTreat.byChosenDirection + this.byRandomFollowAdd) % 4);
                     }
                     if (this.xOwner.byAnimationDirection != this.xTreat.byChosenDirection && this.IsWithingRangeSomehow(fDistance2))
                     {
                         this.byChosenDirection = this.xOwner.byAnimationDirection;
                     }
                     this.v2TargetPos = this.xPlayerLockedOnto.xTransform.v2Pos + Utility.AnimationDirectionToVector2((int)((this.byChosenDirection + 2) % 4)) * 23f;
                     if (Vector2.Distance(this.v2TargetPos, this.xOwner.xTransform.v2Pos) > 8f)
                     {
                         this.v2RandMoveDir = this.v2TargetPos - this.xOwner.xTransform.v2Pos;
                         this.v2RandMoveDir.Normalize();
                         this.LookAt(this.xPlayerLockedOnto.xTransform.v2Pos);
                     }
                     else
                     {
                         this.v2RandMoveDir = Vector2.Zero;
                     }
                     if (this.xTreat.iTimeSinceLastAttack < this.iTimeBetweenAttacks && this.DistanceToTarget() > 70f)
                     {
                         this.enCurrentAction = Trick_Original.CurrentAction.WaitingForlead;
                         this.bIsLead = true;
                         this.xTreat.bIsLead = false;
                         this.byChosenDirection = 4;
                         this.xTreat.byChosenDirection = 4;
                     }
                     if ((this.xTreat.byChosenDirection + 2 + this.byRandomFollowAdd) % 4 != 2)
                     {
                         bDidAttack = this.TryAttack(fDistance2);
                     }
                 }
                 else if (this.enCurrentAction == Trick_Original.CurrentAction.SurroundingAsLead)
                 {
                     if (this.xOwner.byAnimationDirection != this.xTreat.xOwner.byAnimationDirection && this.IsWithingRangeSomehow(fDistance2))
                     {
                         this.byChosenDirection = this.xOwner.byAnimationDirection;
                     }
                     this.v2TargetPos = this.xPlayerLockedOnto.xTransform.v2Pos + Utility.AnimationDirectionToVector2((int)((this.byChosenDirection + 2) % 4)) * 23f;
                     if (Vector2.Distance(this.v2TargetPos, this.xOwner.xTransform.v2Pos) > 8f)
                     {
                         this.v2RandMoveDir = this.v2TargetPos - this.xOwner.xTransform.v2Pos;
                         this.v2RandMoveDir.Normalize();
                         this.LookAt(this.xPlayerLockedOnto.xTransform.v2Pos);
                     }
                     else
                     {
                         this.v2RandMoveDir = Vector2.Zero;
                     }
                     if (!this.bIsLead)
                     {
                         this.enCurrentAction = Trick_Original.CurrentAction.WaitingForlead;
                     }
                     bDidAttack = this.TryAttack(fDistance2);
                 }
                 if (!bDidAttack)
                 {
                     if (knark.Next(50) == 0 && this.iLastDirectionChange + 600 < this.iCounter)
                     {
                         this.fRotDir *= -1;
                         this.iLastDirectionChange = this.iCounter;
                     }
                     if (this.iWannaCircleBaby > 0 && knark.Next(25 + this.iNumberOfPlayers * 3) == 0)
                     {
                         this.enCurrentAction = Trick_Original.CurrentAction.Sumthin;
                         this.v2RandMoveDir = Vector2.Zero;
                         this.iNextHardUpdate = 30 + knark.Next(60);
                     }
                 }
             }
             else
             {
                 this.iNextHardUpdate = 10;
                 this.v2RandMoveDir = Vector2.Zero;
                 this.xOwner.xRenderComponent.SwitchAnimation((ushort)this.xOwner.xRenderComponent.GetCurrentAnimation().byAnimationDirection, Animation.CancelOptions.UseAnimationDefault);
             }
         }
     }
     this.xOwner.xTransform.v2ServerPos = this.xOwner.xTransform.v2Pos;
 }
Example #8
0
 public override void Update()
 {
     if (this.bClosing)
     {
         if (this.xDistortedRC.v2Scale.X > 0f)
         {
             TeleportMosRC expr_2A_cp_0 = this.xDistortedRC;
             expr_2A_cp_0.v2Scale.X = expr_2A_cp_0.v2Scale.X - 0.1f;
         }
         if (this.xDistortedRC.v2Scale.X <= 0f)
         {
             this.bToBeDestroyed = true;
         }
         return;
     }
     if (!this.bTriggered)
     {
         if (this.xDistortedRC.v2Scale.Y < 1f)
         {
             TeleportMosRC expr_87_cp_0 = this.xDistortedRC;
             expr_87_cp_0.v2Scale.Y = expr_87_cp_0.v2Scale.Y + 0.05f;
         }
         else if (this.xDistortedRC.v2Scale.X < 1f && this.iCounter > 23)
         {
             TeleportMosRC expr_C6_cp_0 = this.xDistortedRC;
             expr_C6_cp_0.v2Scale.X = expr_C6_cp_0.v2Scale.X + 0.1f;
         }
         if (this.xDistortedRC.v2Scale.X > 1f)
         {
             this.xDistortedRC.v2Scale.X = 1f;
         }
         if (this.iCounter > 23 && this.xDistortedRC.fAlpha < 0.9f)
         {
             this.xDistortedRC.fAlpha += 0.1f;
         }
     }
     this.iCounter++;
     float fProgress = (float)(this.iCounter % 60) / 60f;
     if (this.iCounter % 120 >= 60)
     {
         fProgress = 1f - (float)(this.iCounter % 60) / 60f;
     }
     this.xDistortedRC.fDistortGrade = fProgress * 0.1f + 0.05f;
     fProgress = (float)(this.iCounter % 300) / 300f;
     Vector2 v2Up = new Vector2(0f, -1f);
     this.xDistortedRC.v2DistortOffset = Utility.RotateDirectionVector(v2Up, 6.28318548f * fProgress) * 0.2f;
     if (!this.bTriggered)
     {
         bool bSomeoneIn = false;
         foreach (PlayerView xView in Program.game.dixPlayers.Values)
         {
             if (!xView.xViewStats.bIsDead && !xView.xEntity.bInLockedState && Vector2.Distance(xView.xEntity.xTransform.v2Pos, this.xTransform.v2Pos) <= (float)(10 + 2 * Program.game.dixPlayers.Count))
             {
                 bSomeoneIn = true;
             }
         }
         if (bSomeoneIn)
         {
             bool bSomeoneOut = false;
             bool bLocalPlayerIn = false;
             bool bLastFirstStillIn = false;
             PlayerView xLastIn = this.xCurrentShowMan;
             PlayerView xSomeoneThatsIn = null;
             int iNumberIn = 0;
             foreach (PlayerView xView2 in Program.game.dixPlayers.Values)
             {
                 if (xView2.xViewStats.bIsDead || !xView2.bInitializedToServer || Vector2.Distance(xView2.xEntity.xTransform.v2Pos, this.xTransform.v2Pos) > (float)(10 + 2 * Program.game.dixPlayers.Count))
                 {
                     bSomeoneOut = true;
                 }
                 else
                 {
                     xSomeoneThatsIn = xView2;
                     if (xView2 == Program.game.xLocalPlayer)
                     {
                         bLocalPlayerIn = true;
                     }
                     if (xView2 == xLastIn)
                     {
                         bLastFirstStillIn = true;
                     }
                     iNumberIn++;
                 }
             }
             if (!bSomeoneOut && CAS.NetworkRole != NetworkHelperInterface.NetworkRole.Client)
             {
                 this.bTriggered = true;
                 float[] p_af = new float[1];
                 base.SendNetworkInstruction(p_af);
                 foreach (PlayerView xView3 in Program.game.dixPlayers.Values)
                 {
                     SnatchRenderComponent xRC = new SnatchRenderComponent(xView3.xEntity.xRenderComponent, new TransformComponent(xView3.xEntity.xTransform.v2Pos));
                     this.lxSnatchedPlayerRC.Add(xRC);
                     Program.game.xRenderMaster.RegisterSortedRenderComponent(xRC);
                 }
                 return;
             }
             if (bLocalPlayerIn)
             {
                 this.SetNewShowman(Program.game.xLocalPlayer, iNumberIn);
                 return;
             }
             if (!bLastFirstStillIn)
             {
                 if (xSomeoneThatsIn != null)
                 {
                     this.SetNewShowman(xSomeoneThatsIn, iNumberIn);
                 }
                 Program.game.xLocalPlayer.xGUIStuff.iWaitingForPlayers = 0;
                 return;
             }
             if (this.xCurrentShowMan != null)
             {
                 this.xCurrentShowMan.xGUIStuff.iWaitingForPlayers = iNumberIn;
                 return;
             }
         }
         else if (this.xCurrentShowMan != null)
         {
             this.SetNewShowman(null, 0);
             return;
         }
     }
     else
     {
         if (this.iZoneCounter == 0)
         {
             foreach (PlayerView x in Program.game.dixPlayers.Values)
             {
                 x.xGUIStuff.iWaitingForPlayersDisplay = 0;
             }
             this.SetNewShowman(null, 0);
             Program.game.xCutsceneMaster.LoadCutscene(CutsceneLibrary.CutsceneID.TeleportCut);
         }
         foreach (SnatchRenderComponent xSnatchedPlayerRC in this.lxSnatchedPlayerRC)
         {
             xSnatchedPlayerRC.fVirtualHeight += 30f;
         }
         this.iZoneCounter++;
         foreach (SnatchRenderComponent xSnatchedPlayerRC2 in this.lxSnatchedPlayerRC)
         {
             SnatchRenderComponent expr_53A_cp_0 = xSnatchedPlayerRC2;
             expr_53A_cp_0.v2OffsetAdjustment.Y = expr_53A_cp_0.v2OffsetAdjustment.Y + 0.25f;
         }
         foreach (SnatchRenderComponent xSnatchedPlayerRC3 in this.lxSnatchedPlayerRC)
         {
             if (xSnatchedPlayerRC3.v2Scale.X > 0f)
             {
                 SnatchRenderComponent expr_596_cp_0 = xSnatchedPlayerRC3;
                 expr_596_cp_0.v2Scale.X = expr_596_cp_0.v2Scale.X - 0.025f;
             }
         }
         bool bFirstOnly = false;
         foreach (SnatchRenderComponent xSnatchedPlayerRC4 in this.lxSnatchedPlayerRC)
         {
             if (xSnatchedPlayerRC4.fAlpha > 0f)
             {
                 xSnatchedPlayerRC4.fAlpha -= 0.025f;
             }
             else if (!bFirstOnly)
             {
                 if (this.xDistortedRC.v2Scale.X > 0f)
                 {
                     TeleportMosRC expr_62D_cp_0 = this.xDistortedRC;
                     expr_62D_cp_0.v2Scale.X = expr_62D_cp_0.v2Scale.X - 0.1f;
                 }
                 else if (CAS.NetworkRole != NetworkHelperInterface.NetworkRole.Client)
                 {
                     Program.game._Level_PrepareSwitch(LevelBlueprint.GetBlueprint(this.enZone), this.iSpawnPoint, Level.ZoneEnum.None);
                     foreach (PlayerView xView4 in Program.game.dixPlayers.Values)
                     {
                         xView4.xEntity.v2ZoningOffset = Vector2.Zero;
                     }
                 }
                 bFirstOnly = true;
             }
         }
     }
 }
Example #9
0
 public override void SnatchRender(SnatchRenderComponent snatch, GraphicsDevice Device, SpriteBatch spriteBatch)
 {
     int iWidth = this.txTexture.Width;
     int iHeight = this.txTexture.Height;
     snatch.rt2dRenderTarget = new RenderTarget2D(Device, iWidth, iHeight, false, SurfaceFormat.Color, DepthFormat.Depth24Stencil8);
     Device.SetRenderTarget(snatch.rt2dRenderTarget);
     Device.Clear(Color.Transparent);
     spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.Default, null);
     this.txToUse = this.txTexture;
     if (this.dentxAlternateTextures.ContainsKey(RenderMaster.enCurrentPass))
     {
         this.txToUse = this.dentxAlternateTextures[RenderMaster.enCurrentPass];
     }
     if (base.xEffectWrapper == null)
     {
         spriteBatch.Draw(this.txToUse, this.v2Offset, null, this.cColor * this.fAlpha, this.fRotation, this.v2Offset, 1f, this.enSpriteEffect, 0f);
     }
     else
     {
         spriteBatch.End();
         foreach (KeyValuePair<string, float> kvp in this.dsfFloatShaderParameters)
         {
             base.xEffectWrapper.xEffect.Parameters[kvp.Key].SetValue(kvp.Value);
         }
         spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.Default, null, base.xEffectWrapper.xEffect);
         spriteBatch.Draw(this.txToUse, this.v2Offset, null, this.cColor * this.fAlpha, this.fRotation, this.v2Offset, 1f, this.enSpriteEffect, 0f);
         spriteBatch.End();
         spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.Default, null);
     }
     spriteBatch.End();
     snatch.v2Scale = this.v2Scale;
     snatch.v2Offset = this.v2OffsetRenderPos;
     snatch.fVirtualHeight = this.fVirtualHeight;
     snatch.bSnatchedSuccessful = true;
 }