MiningGameServer.NetworkPlayer.Update C# (CSharp) Méthode

Update() public méthode

public Update ( GameTime theTime ) : void
theTime Microsoft.Xna.Framework.GameTime
Résultat void
        public void Update(GameTime theTime)
        {
            UpdateCache();

            if (_jumpTimer > 0) _jumpTimer--;
            if (AttackTimer > 0)
            {
                AttackTimer--;
                if (AttackTimer == 5)
                {
                    UpdateMask |= (int)PlayerUpdateFlags.Player_Update;
                    UpdateMask |= (int)PlayerUpdateFlags.Player_Movement_Flags;
                    MovementFlags |= (int)PlayerMovementFlag.Idle;
                }
            }

            if ((MovementFlags & (int)PlayerMovementFlag.Jump_Pressed) != 0)
            {
                if (!Falling && _jumpTimer <= 0)
                {
                    EntityVelocity.Y -= 10;
                    _jumpTimer = 20;
                }
            }
            float playerRunSpeed = ((MovementFlags & (byte)PlayerMovementFlag.Sprinting) > 0 ? PClass.GetPlayerSprintVelocity()  : PClass.GetPlayerWalkVelocity());
            if (LeftPressed)
            {
                EntityVelocity.X = MathHelper.Clamp(EntityVelocity.X - playerRunSpeed, -playerRunSpeed, playerRunSpeed);
                FacingLeft = true;
            }

            if (RightPressed)
            {
                EntityVelocity.X = MathHelper.Clamp(EntityVelocity.X + playerRunSpeed, -playerRunSpeed, playerRunSpeed);
                FacingLeft = false;
            }

            if ((OldLeftPressed || OldRightPressed) && (!RightPressed && !LeftPressed))
            {
                UpdateMask |= (int)PlayerUpdateFlags.Player_Update;
                UpdateMask |= (int)PlayerUpdateFlags.Player_Movement_Flags;
                MovementFlags |= (int)PlayerMovementFlag.Idle;
            }

            if (AttackPressed)
            {
                _timeHeldAttack++;
                if (_timeHeldAttack > 30)
                    _timeHeldAttack = 30;
            }

            if (OldAttackPressed && !AttackPressed)
            {
                if (AttackTimer <= 0)
                {
                    if (_timeHeldAttack == 0)
                        _timeHeldAttack = 1;
                    AttackTimer = 20;
                    Attack();
                }
                _timeHeldAttack = 0;
            }

            Vector2 oldPos = new Vector2(EntityPosition.X, EntityPosition.Y);

            PClass.Update_PrePhys(theTime);
            GameServer.GameMode.OnPlayerPrePhysicsUpdate(this);

            EntityMovement();

            bool movedSince = oldPos != EntityPosition;

            PClass.Update_PostPhys(theTime, movedSince);
            GameServer.GameMode.OnPlayerPostPhysicsUpdate(this, movedSince);

            if (movedSince)
            {
                UpdateMask |= (int)PlayerUpdateFlags.Player_Update;
                UpdateMask |= (int)PlayerUpdateFlags.Player_Position;
            }
            OldMovementFlags = MovementFlags;
        }