예제 #1
0
        private void MoveCharacter()
        {
            MyCharacter entity = this.m_entity as MyCharacter;

            if (entity != null)
            {
                if (this.m_speed != 0f)
                {
                    MyCharacterJetpackComponent jetpackComp = entity.JetpackComp;
                    if (((jetpackComp != null) && !jetpackComp.TurnedOn) && this.m_path.Flying)
                    {
                        jetpackComp.TurnOnJetpack(true, false, false);
                    }
                    else if (((jetpackComp != null) && jetpackComp.TurnedOn) && !this.m_path.Flying)
                    {
                        jetpackComp.TurnOnJetpack(false, false, false);
                    }
                    Vector3 vector  = Vector3.TransformNormal(this.m_forwardVector, entity.PositionComp.WorldMatrixNormalizedInv);
                    Vector3 vector2 = this.m_aiming.RotationHint * this.m_rotationSpeedModifier;
                    if (this.m_path.Flying)
                    {
                        if (vector.Y > 0f)
                        {
                            entity.Up();
                        }
                        else
                        {
                            entity.Down();
                        }
                    }
                    entity.MoveAndRotate(vector * this.m_speed, new Vector2(vector2.Y * 30f, vector2.X * 30f), 0f);
                }
                else if (this.m_speed == 0f)
                {
                    if (!this.HasRotation(0.0316f))
                    {
                        if (this.m_wasStopped)
                        {
                            entity.MoveAndRotate(Vector3.Zero, Vector2.Zero, 0f);
                            this.m_wasStopped = true;
                        }
                    }
                    else
                    {
                        int num1;
                        if (entity.WantsWalk || entity.IsCrouching)
                        {
                            num1 = 1;
                        }
                        else
                        {
                            num1 = 2;
                        }
                        float   num     = num1;
                        Vector3 vector3 = this.m_aiming.RotationHint * this.m_rotationSpeedModifier;
                        entity.MoveAndRotate(Vector3.Zero, new Vector2((vector3.Y * 20f) * num, (vector3.X * 25f) * num), 0f);
                        this.m_wasStopped = false;
                    }
                }
            }
            Vector3D targetLocation = new Vector3D();

            this.m_stuckDetection.Update(this.m_worldMatrix.Translation, this.m_aiming.RotationHint, targetLocation);
        }