Example #1
0
 // Token: 0x06000064 RID: 100 RVA: 0x00006C40 File Offset: 0x00004E40
 public void AddLowerNode(eCollitionNode LN)
 {
     LN.CollitionHierarchy = this.CollitionHierarchy;
     this.CollitionHierarchy.AllNodes.Add(LN);
     LN.UpperNode = this;
     this.LowerNodes.Add(LN);
 }
Example #2
0
        // Token: 0x0600005D RID: 93 RVA: 0x00006520 File Offset: 0x00004720
        public static eCollitionHierarchy CreateNewHierarchyForArrow(Arrow A1)
        {
            A1.CollitionHierarchy = new eCollitionHierarchy(A1);
            eCollitionNode CN = new eCollitionNode(Vector3.Zero, 10f, new ePart(A1));

            A1.CollitionHierarchy.AddNode(CN);
            return(A1.CollitionHierarchy);
        }
Example #3
0
        // Token: 0x0600005C RID: 92 RVA: 0x000064A4 File Offset: 0x000046A4
        public eCollitionNode GetCollided(Ray R, float RL)
        {
            eCollitionNode IsC = null;

            foreach (eCollitionNode N in this.UpperMostNodes)
            {
                eCollitionNode CCN  = N.GetCollided(R, RL);
                bool           flag = !Information.IsNothing(CCN);
                if (flag)
                {
                    IsC = CCN;
                }
            }
            return(IsC);
        }
Example #4
0
        // Token: 0x0600005E RID: 94 RVA: 0x00006568 File Offset: 0x00004768
        public static eCollitionHierarchy CreateNewHumanHierarchy(Human H1)
        {
            H1.CollitionHierarchy = new eCollitionHierarchy(H1);
            eCollitionNode CN = new eCollitionNode(new Vector3(0f, 76f, 0f), 80f, new ePart(H1));

            H1.CollitionHierarchy.AddNode(CN);
            CN.AddLowerNode(new eCollitionNode(new Vector3(0f, 164f, 0f), 15f, H1.BodyParts[5])
            {
                RRewardMultiplier = new RewardSetMultiplier(4f, 1f, 1f)
            });
            eCollitionNode BodyNode = new eCollitionNode(new Vector3(0f, 125f, 0f), 25f, H1.BodyParts[3]);

            CN.AddLowerNode(BodyNode);
            BodyNode.AddLowerNode(new eCollitionNode(new Vector3(10f, 140f, 2f), 10f, H1.BodyParts[3]));
            BodyNode.AddLowerNode(new eCollitionNode(new Vector3(-10f, 140f, 2f), 10f, H1.BodyParts[3]));
            BodyNode.AddLowerNode(new eCollitionNode(new Vector3(9f, 130f, 1f), 10f, H1.BodyParts[3]));
            BodyNode.AddLowerNode(new eCollitionNode(new Vector3(-9f, 130f, 1f), 10f, H1.BodyParts[3]));
            BodyNode.AddLowerNode(new eCollitionNode(new Vector3(0f, 130f, 0f), 10f, H1.BodyParts[3]));
            BodyNode.AddLowerNode(new eCollitionNode(new Vector3(6f, 120f, -3f), 9f, H1.BodyParts[3]));
            BodyNode.AddLowerNode(new eCollitionNode(new Vector3(-6f, 120f, -3f), 9f, H1.BodyParts[3]));
            BodyNode.AddLowerNode(new eCollitionNode(new Vector3(5f, 110f, -3f), 9f, H1.BodyParts[3]));
            BodyNode.AddLowerNode(new eCollitionNode(new Vector3(-5f, 110f, -3f), 9f, H1.BodyParts[3]));
            eCollitionNode LegsNode = new eCollitionNode(new Vector3(0f, 50f, 0f), 35f, H1.BodyParts[2]);

            CN.AddLowerNode(LegsNode);
            LegsNode.AddLowerNode(new eCollitionNode(new Vector3(0f, 95f, -1f), 12f, H1.BodyParts[2]));
            LegsNode.AddLowerNode(new eCollitionNode(new Vector3(10f, 78f, -2f), 7f, H1.BodyParts[2]));
            LegsNode.AddLowerNode(new eCollitionNode(new Vector3(-10f, 78f, -2f), 7f, H1.BodyParts[7]));
            LegsNode.AddLowerNode(new eCollitionNode(new Vector3(10f, 63f, -2f), 7f, H1.BodyParts[2]));
            LegsNode.AddLowerNode(new eCollitionNode(new Vector3(-10f, 63f, -2f), 7f, H1.BodyParts[7]));
            LegsNode.AddLowerNode(new eCollitionNode(new Vector3(10f, 48f, 0f), 7f, H1.BodyParts[2]));
            LegsNode.AddLowerNode(new eCollitionNode(new Vector3(-10f, 48f, 0f), 7f, H1.BodyParts[7]));
            LegsNode.AddLowerNode(new eCollitionNode(new Vector3(10f, 33f, 2f), 7f, H1.BodyParts[4]));
            LegsNode.AddLowerNode(new eCollitionNode(new Vector3(-10f, 33f, 2f), 7f, H1.BodyParts[0]));
            LegsNode.AddLowerNode(new eCollitionNode(new Vector3(10f, 18f, 0f), 7f, H1.BodyParts[4]));
            LegsNode.AddLowerNode(new eCollitionNode(new Vector3(-10f, 18f, 0f), 7f, H1.BodyParts[0]));
            H1.CollitionHierarchy.UpdateAllSpheres(H1.Position);
            return(H1.CollitionHierarchy);
        }
Example #5
0
        // 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;
                }
            }
        }
Example #6
0
        // Token: 0x06000068 RID: 104 RVA: 0x000070DC File Offset: 0x000052DC
        public eCollitionNode GetCollided(Ray BBS, float RL)
        {
            eCollitionNode IsC  = null;
            bool           flag = this.Type1 == eCollitionNode.Type.BoundingSphere;

            if (flag)
            {
                bool flag2 = this.BS.Intersects(BBS) != null;
                if (flag2)
                {
                    bool flag3 = Vector3.Distance(this.BS.Center, BBS.Position) < RL;
                    if (flag3)
                    {
                        bool flag4 = this.LowerNodes.Count > 0;
                        if (flag4)
                        {
                            foreach (eCollitionNode LN in this.LowerNodes)
                            {
                                eCollitionNode CCN   = LN.GetCollided(BBS, RL);
                                bool           flag5 = !Information.IsNothing(CCN);
                                if (flag5)
                                {
                                    IsC = CCN;
                                }
                            }
                        }
                        else
                        {
                            IsC = this;
                        }
                    }
                }
                else
                {
                    IsC = null;
                }
            }
            else
            {
                bool flag6 = this.Type1 == eCollitionNode.Type.BoundingBox;
                if (flag6)
                {
                    bool flag7 = this.BB.Intersects(BBS) != null;
                    if (flag7)
                    {
                        IsC = this;
                    }
                    else
                    {
                        IsC = null;
                    }
                }
                else
                {
                    bool flag8 = this.Type1 == eCollitionNode.Type.Ray;
                    if (flag8)
                    {
                        IsC = null;
                    }
                    else
                    {
                        bool flag9 = this.Type1 == eCollitionNode.Type.BoundingFrustum;
                        if (flag9)
                        {
                            bool flag10 = this.BF.Intersects(BBS) != null;
                            if (flag10)
                            {
                                IsC = this;
                            }
                            else
                            {
                                IsC = null;
                            }
                        }
                        else
                        {
                            bool flag11 = this.Type1 == eCollitionNode.Type.Plane;
                            if (flag11)
                            {
                                IsC = this;
                            }
                            else
                            {
                                IsC = null;
                            }
                        }
                    }
                }
            }
            return(IsC);
        }
Example #7
0
 // Token: 0x06000057 RID: 87 RVA: 0x00006318 File Offset: 0x00004518
 public void AddNode(eCollitionNode Node)
 {
     Node.CollitionHierarchy = this;
     this.AllNodes.Add(Node);
     this.UpperMostNodes.Add(Node);
 }