/// <summary> /// Returns IsPathBlocked /// </summary> // Token: 0x06000036 RID: 54 RVA: 0x000041F4 File Offset: 0x000023F4 public static bool Go(Entity E, Actions A) { bool IsPathBlocked = false; switch (A) { case Actions.Forward: return(Controls.Go(E, E.ModelRotationY.Forward, E.Accelaration.Z)); case Actions.Backward: return(Controls.Go(E, E.ModelRotationY.Backward, E.Accelaration.X)); case Actions.Left: return(Controls.Go(E, E.ModelRotationY.Left, E.Accelaration.X)); case Actions.Right: return(Controls.Go(E, E.ModelRotationY.Right, E.Accelaration.X)); case Actions.Up: { bool onGround = E.OnGround; if (onGround) { E.Velocity += 50f * E.ModelRotation.Up; E.FallingSpeed = 0f; } break; } case Actions.Up2: { bool onGround2 = E.OnGround; if (onGround2) { E.Velocity += 28f * E.ModelRotation.Up; E.FallingSpeed = 0f; } break; } case Actions.RotateClockwiseY: { Matrix Rot = Matrix.CreateFromAxisAngle(Vector3.Up, -0.1f); E.HeadRotation *= Rot; E.NeededBodyRotation *= Rot; E.NeededBodyRotationChanged = true; break; } case Actions.RotateAntiClockwiseY: { Matrix Rot2 = Matrix.CreateFromAxisAngle(Vector3.Up, 0.1f); E.HeadRotation *= Rot2; E.NeededBodyRotation *= Rot2; E.NeededBodyRotationChanged = true; break; } } return(IsPathBlocked); }
// Token: 0x0600007D RID: 125 RVA: 0x000078BC File Offset: 0x00005ABC public virtual void DoCurrentActions() { foreach (Actions Act in this.CurrActionLst) { bool flag = Controls.Go(this, Act); if (flag) { bool inRandomMovement = this.InRandomMovement; if (inRandomMovement) { this.PickNewRandomMovement(); } } } bool flag2 = this.CurrActionLst.Contains(Actions.Attack); if (flag2) { bool flag3 = this.CTool != null; if (flag3) { bool flag4 = this.LastActionTime + 500.0 < (double)Main.NowGameTime & !this.CTool.Owner.LockedeA; if (flag4) { foreach (ePAnimation eA in this.CTool.Owner.CurrentAnimations) { eA.Reset(); } this.CTool.Owner.Revert(); this.CTool.Use(PhysicsFuncs.RandomOf <Tool.Action>(new Tool.Action[] { Tool.Action.PrimaryAttack1, Tool.Action.PrimaryAttack2, Tool.Action.ShortAttack })); this.LastActionTime = (double)Main.NowGameTime; } } } this.CurrActionLst.Clear(); }
// Token: 0x0600013C RID: 316 RVA: 0x00011378 File Offset: 0x0000F578 public override void Update() { bool flag = !this.IsDead; if (flag) { bool flag2 = !this.eType.IsPlayer && base.CheckOutOfStackRange(); if (!flag2) { this.Position += this.Velocity; this.Velocity *= this.ModelVelocityReducingFactor; bool flag3 = this.Velocity.LengthSquared() < 0.02f; if (flag3) { this.Velocity = Vector3.Zero; } bool flag4 = base.CheckOutOfWorld(); if (flag4) { base.PutInsideOfTheWorld(); } this.FacingDirection = this.HeadRotation.Forward; this.FacingDirection.Normalize(); this.DualFacingDirections = Physics.Find2DDualDirectionsOfDirection(this.FacingDirection); this.OnGround = false; this.BlockEnv = Ground.GetBlockEnvironment(this.Position - Ground.BlockSizeHalfYonlyV3, true); bool flag5 = Information.IsNothing(this.BlockEnv); if (flag5) { base.ChunkOutOfStackRange(); this.BlockEnv = Ground.GetBlockEnvironment(this.Position - Ground.BlockSizeHalfYonlyV3, true); bool flag6 = Information.IsNothing(this.BlockEnv); if (flag6) { bool isPlayer = this.eType.IsPlayer; if (!isPlayer) { return; } while (Information.IsNothing(this.BlockEnv)) { base.ChunkOutOfStackRange(); this.BlockEnv = Ground.GetBlockEnvironment(this.Position - Ground.BlockSizeHalfYonlyV3, true); } } } this.CurrentBlock = this.BlockEnv.CurrentBlock; this.CurrentChunk = this.CurrentBlock.Chunk; this.DualFacingDirectionsFB = this.DualFacingDirections[0]; this.DualFacingDirectionsLR = this.DualFacingDirections[1]; bool flag7 = !this.BlockEnv.LegsBlock.IsAir; if (flag7) { bool flag8 = this.TrappedCount > 10; if (flag8) { this.Position.Y = this.Position.Y + 100f; this.BodyParts[3].Hurten(20f); this.TrappedCount = 0; this.Update(); return; } checked { this.TrappedCount++; } } else { this.TrappedCount = 0; } bool flag9 = !this.CurrentBlock.RealBlock.IsAir; if (flag9) { this.Position.Y = (float)(checked ((this.CurrentBlock.Index * 50).Y + 50)); bool flag10 = this.Velocity.Y < -10f; if (flag10) { this.BodyParts[4].Hurten(this.Velocity.Y * -2f); this.BodyParts[0].Hurten(this.Velocity.Y * -2f); checked { this.Health -= (int)Math.Round((double)(unchecked (this.Velocity.Y * -2f))); } } this.FallingSpeed = 0f; } else { this.FallingSpeed += this.Weight; this.Velocity.Y = this.Velocity.Y - this.FallingSpeed; } bool flag11 = this.Velocity.Y < -10f; if (flag11) { bool flag12 = Ground.GetIsAirDistanceInTheDirection(this.Position, Vector3.Down, -2, false) > 20; if (flag12) { this.FallingSpeed = 0f; this.Velocity.Y = 0f; this.BlockEnv = Ground.GetBlockEnvironment(this.Position - Ground.BlockSizeYonlyV3, false); this.CurrentBlock = this.BlockEnv.CurrentBlock; this.DualFacingDirectionsFB = this.DualFacingDirections[0]; this.DualFacingDirectionsLR = this.DualFacingDirections[1]; this.DualFacingDirectionsFB = this.DualFacingDirections[0]; this.DualFacingDirectionsLR = this.DualFacingDirections[1]; this.CurrentChunk = this.CurrentBlock.Chunk; this.Position.Y = (float)(checked ((this.CurrentBlock.Index * 50).Y + 50)); this.OnGround = true; } } bool isPlayer2 = this.eType.IsPlayer; if (isPlayer2) { IntVector3 RealChunkIndex = Ground.ChunkIndexOfPosition(this.Position - Ground.BlockSizeYonlyV3); bool flag13 = this.CurrentChunk.Index.X != RealChunkIndex.X || this.CurrentChunk.Index.Z != RealChunkIndex.Z; if (flag13) { base.CheckOutOfStackRange(); } } bool flag14 = !this.CurrentBlock.RealBlock.IsAir; if (flag14) { this.OnGround = true; } bool movedFB = this.MovedFB; if (movedFB) { this.ResumeWalking(); } else { this.PuaseWalking(); } this.MovedFB = false; bool flag15 = !this.NoAI; if (flag15) { bool flag16 = this.DelUpdateAI != null; if (flag16) { this.DelUpdateAI(this); } } bool neededBodyRotationChanged = this.NeededBodyRotationChanged; if (neededBodyRotationChanged) { bool flag17 = this.ModelRotation.Forward != this.NeededBodyRotation.Forward; if (flag17) { bool flag18 = Vector3.Distance(this.NeededBodyRotation.Forward, this.ModelRotation.Forward) > this.GetingTargetBodyRotationLast; if (flag18) { bool getingTargetBodyRotationLastDir = this.GetingTargetBodyRotationLastDir; if (getingTargetBodyRotationLastDir) { this.GetingTargetBodyRotationLastDir = false; } else { this.GetingTargetBodyRotationLastDir = true; } } this.GetingTargetBodyRotationLast = Vector3.Distance(this.ModelRotation.Forward, this.NeededBodyRotation.Forward); bool flag19 = !this.GetingTargetBodyRotationLastDir; if (flag19) { this.RotationVelocity.Y = (float)((double)this.RotationVelocity.Y + (double)Vector3.Distance(this.NeededBodyRotation.Forward, this.ModelRotation.Forward) * 0.2); } else { this.RotationVelocity.Y = (float)((double)this.RotationVelocity.Y - (double)Vector3.Distance(this.NeededBodyRotation.Forward, this.ModelRotation.Forward) * 0.2); } bool flag20 = (double)Vector3.Distance(this.NeededBodyRotation.Forward, this.ModelRotation.Forward) < 0.001; if (flag20) { this.NeededBodyRotationChanged = false; } } } base.RotationY = MathHelper.WrapAngle(this.RotationVelocity.Y); base.RotationX = MathHelper.WrapAngle(this.RotationVelocity.X); base.RotationZ = MathHelper.WrapAngle(this.RotationVelocity.Z); this.ModelRotation *= Matrix.Identity; this.HeadRotation *= Matrix.Identity; bool flag21 = base.RotationY != 0f; if (flag21) { this.ModelRotation *= Matrix.CreateFromAxisAngle(Vector3.Up, base.RotationY); } bool flag22 = base.RotationX != 0f; if (flag22) { this.ModelRotation *= Matrix.CreateFromAxisAngle(this.ModelRotation.Right, base.RotationX); } bool flag23 = base.RotationZ != 0f; if (flag23) { this.ModelRotation *= Matrix.CreateFromAxisAngle(this.ModelRotation.Forward, base.RotationZ); } this.ModelRotationY *= Matrix.CreateRotationY(base.RotationY); Matrix RotationYCHange = Matrix.CreateFromAxisAngle(this.ModelRotation.Up, base.RotationY); this.BodyParts[5].Rotation = this.HeadRotation; this.BodyParts[3].Rotation = this.ModelRotation; this.BodyParts[1].RotateAsChild(this.ModelRotation.Up, base.RotationY); this.BodyParts[6].RotateAsChild(this.ModelRotation.Up, base.RotationY); this.BodyParts[2].RotateAsChild(RotationYCHange); this.BodyParts[7].RotateAsChild(RotationYCHange); this.BodyParts[5].OriginalRotation = this.HeadRotation * this.BodyParts[5].DefualtRotation; this.BodyParts[3].OriginalRotation = this.ModelRotation * this.BodyParts[3].DefualtRotation; this.BodyParts[7].OriginalRotation = this.ModelRotation * this.BodyParts[7].DefualtRotation; this.BodyParts[2].OriginalRotation = this.ModelRotation * this.BodyParts[2].DefualtRotation; this.BodyParts[0].OriginalRotation = this.ModelRotation * this.BodyParts[0].DefualtRotation; this.BodyParts[4].OriginalRotation = this.ModelRotation * this.BodyParts[4].DefualtRotation; bool flag24 = !Information.IsNothing(this.CTool); if (flag24) { this.CTool.Rotate(RotationYCHange); this.CTool.Update(); this.CTool.OriginalRotation = this.CTool.DefualtRotation * this.ModelRotation; } this.FacingDirection = this.HeadRotation.Forward; this.FacingDirection.Normalize(); this.CollitionHierarchy.UpdateAllSpheres(this.Position); float MeWidthSq = this.eType.Width * this.eType.Width * 2f; bool IsAttacking = this.CTool != null && this.CTool.Attacking; foreach (Entity e in Ground.CStack.eList) { bool flag25 = e != this; if (flag25) { bool flag26 = IsAttacking; if (flag26) { eCollitionNode CN = e.CollitionHierarchy.GetCollided(this.CTool.R, this.CTool.Length); bool flag27 = !Information.IsNothing(CN); if (flag27) { Vector3 Dir = e.Position - this.Position; Dir.Y = 0f; Dir.Normalize(); this.CTool.RewardsToVictim.Reward(e, CN.RRewardMultiplier); CN.eP.Hurten((float)(checked (-1 * this.CTool.RewardsToVictim.Health))); Controls.Go(e, Dir, 15f); e.ShotHit(this); } } float DistanceSquaredToE = Vector3.DistanceSquared(e.Position, this.Position); bool flag28 = DistanceSquaredToE < MeWidthSq; if (flag28) { Vector3 Dir2 = (this.Position - e.Position) * Physics.YZero; Controls.Go(this, Dir2, 0.1f); } } } base.RotationY = 0f; base.RotationX = 0f; base.RotationZ = 0f; this.RotationVelocity.Y = this.RotationVelocity.Y * this.RotationVelocityReducingFactor.Y; this.RotationVelocity.X = this.RotationVelocity.X * this.RotationVelocityReducingFactor.X; this.RotationVelocity.Z = this.RotationVelocity.Z * this.RotationVelocityReducingFactor.Z; bool flag29 = this.Health < 1; if (flag29) { this.Kill(); } } } else { base.RotationY = MathHelper.WrapAngle(this.RotationVelocity.Y); base.RotationX = MathHelper.WrapAngle(this.RotationVelocity.X); base.RotationZ = MathHelper.WrapAngle(this.RotationVelocity.Z); bool flag30 = base.RotationX != 0f; if (flag30) { this.ModelRotation *= Matrix.CreateFromAxisAngle(this.ModelRotation.Right, base.RotationX); Matrix RotationXCHange = Matrix.CreateFromAxisAngle(this.ModelRotation.Right, base.RotationX); this.BodyParts[5].Rotation = this.ModelRotation; this.BodyParts[5].RelativePosition = Vector3.Transform(this.BodyParts[5].RelativePosition, RotationXCHange); this.BodyParts[3].Rotation = this.ModelRotation; this.BodyParts[3].RelativePosition = Vector3.Transform(this.BodyParts[3].RelativePosition, RotationXCHange); this.BodyParts[1].Rotation = this.ModelRotation; this.BodyParts[1].RelativePosition = Vector3.Transform(this.BodyParts[1].RelativePosition, RotationXCHange); this.BodyParts[2].Rotation = this.ModelRotation; this.BodyParts[2].RelativePosition = Vector3.Transform(this.BodyParts[2].RelativePosition, RotationXCHange); this.BodyParts[6].Rotation = this.ModelRotation; this.BodyParts[6].RelativePosition = Vector3.Transform(this.BodyParts[6].RelativePosition, RotationXCHange); this.BodyParts[7].Rotation = this.ModelRotation; this.BodyParts[7].RelativePosition = Vector3.Transform(this.BodyParts[7].RelativePosition, RotationXCHange); this.BodyParts[0].Rotation = this.ModelRotation; this.BodyParts[0].RelativePosition = Vector3.Transform(this.BodyParts[0].RelativePosition, RotationXCHange); this.BodyParts[4].Rotation = this.ModelRotation; this.BodyParts[4].RelativePosition = Vector3.Transform(this.BodyParts[4].RelativePosition, RotationXCHange); bool flag31 = this.CTool != null; if (flag31) { this.CTool.Rotation = this.ModelRotation; this.CTool.RelativePosition = Vector3.Transform(this.CTool.RelativePosition, RotationXCHange); } base.RotationY = 0f; base.RotationX = 0f; base.RotationZ = 0f; this.RotationVelocity.Y = this.RotationVelocity.Y * 0.95f; this.RotationVelocity.X = this.RotationVelocity.X * 0.95f; this.RotationVelocity.Z = this.RotationVelocity.Z * 0.95f; } } }
// Token: 0x060001C7 RID: 455 RVA: 0x00017A98 File Offset: 0x00015C98 public void UpdateMan(KeyboardState controllerState, MouseState MouseState) { bool flag = !this.IsDead; if (flag) { this.FacingDirection = this.HeadRotation.Forward; foreach (Controls.Control C in this.ControlsList) { Actions A = C.Action; bool isKeyControl = C.IsKeyControl; if (isKeyControl) { Keys K = C.Key; bool flag2 = controllerState.IsKeyDown(K); if (flag2) { Controls.Go(this, A); this.Act(A); } } else { switch (C.MouseControl) { case Controls.Control.MouseKeys.LeftClick: { bool flag3 = MouseState.LeftButton == ButtonState.Pressed; if (flag3) { this.Act(A); } break; } case Controls.Control.MouseKeys.RightClick: { bool flag4 = MouseState.RightButton == ButtonState.Pressed; if (flag4) { this.Act(A); } break; } case Controls.Control.MouseKeys.WheelUp: { bool flag5 = MouseState.ScrollWheelValue > Main.MouseWheelValue; if (flag5) { this.Act(A); Main.MouseWheelValue = MouseState.ScrollWheelValue; } break; } case Controls.Control.MouseKeys.WheelDown: { bool flag6 = MouseState.ScrollWheelValue < Main.MouseWheelValue; if (flag6) { this.Act(A); Main.MouseWheelValue = MouseState.ScrollWheelValue; } break; } case Controls.Control.MouseKeys.WheelPress: { bool flag7 = MouseState.MiddleButton == ButtonState.Pressed; if (flag7) { this.Act(A); } break; } } } } } bool movedFB = this.MovedFB; if (movedFB) { this.ManMovedOnce = true; } else { bool manMovedOnce = this.ManMovedOnce; if (manMovedOnce) { } } }
/// <summary> /// Returns IsPathBlocked /// </summary> // Token: 0x06000037 RID: 55 RVA: 0x00004408 File Offset: 0x00002608 public static bool Go(Entity E, Vector3 Dir, float Accelaration) { bool IsPathBlocked = false; bool[] FBlocks = Ground.GetFacingIsAir(E.Position, Physics.Find2DDualDirectionsOfDirection(Dir), Dir); Direction MonoFacingDirection = Physics.Find2DUnitDirectionOfDirection(Dir); bool flag = Information.IsNothing(FBlocks); bool Go; if (flag) { Go = true; } else { bool flag2 = FBlocks[2]; if (flag2) { bool flag3 = FBlocks[3]; if (flag3) { bool flag4 = FBlocks[0]; if (flag4) { bool flag5 = FBlocks[1]; if (flag5) { bool flag6 = FBlocks[4]; if (flag6) { E.Velocity += Accelaration * Dir; E.MovedFB = true; } else { bool flag7 = MonoFacingDirection == Direction.Left || MonoFacingDirection == Direction.Right; if (flag7) { E.Velocity += Accelaration * Dir * Vector3.Right; E.MovedFB = true; } else { E.Velocity += Accelaration * Dir * Vector3.Backward; E.MovedFB = true; } } } else { bool flag8 = MonoFacingDirection == Direction.Left || MonoFacingDirection == Direction.Right; if (flag8) { E.Velocity += Accelaration * Dir * Vector3.Right; E.MovedFB = true; } else { bool flag9 = MonoFacingDirection == Direction.Forward || MonoFacingDirection == Direction.Backward; if (flag9) { Controls.Go(E, Actions.Up2); E.MovedFB = true; } } } } else { bool flag10 = FBlocks[1]; if (flag10) { bool flag11 = MonoFacingDirection == Direction.Left || MonoFacingDirection == Direction.Right; if (flag11) { Controls.Go(E, Actions.Up2); E.MovedFB = true; } else { bool flag12 = MonoFacingDirection == Direction.Forward || MonoFacingDirection == Direction.Backward; if (flag12) { E.Velocity += Accelaration * Dir * Vector3.Backward; E.MovedFB = true; } } } else { Controls.Go(E, Actions.Up2); E.MovedFB = true; } } } else { bool flag13 = FBlocks[2]; if (flag13) { bool flag14 = FBlocks[0]; if (flag14) { E.Velocity += Accelaration * Dir * Vector3.Right; E.MovedFB = true; IsPathBlocked = true; } else { Controls.Go(E, Actions.Up2); E.MovedFB = true; } } } } else { bool flag15 = FBlocks[3]; if (flag15) { bool flag16 = FBlocks[3]; if (flag16) { bool flag17 = FBlocks[1]; if (flag17) { E.Velocity += Accelaration * Dir * Vector3.Backward; E.MovedFB = true; IsPathBlocked = true; } else { Controls.Go(E, Actions.Up2); E.MovedFB = true; } } } } Go = IsPathBlocked; } return(Go); }