Exemple #1
0
    public override void Logic()
    {
        mouse.PlaneDistance = mouse.Perspective.Position.Z;

        hud.Logic();
        if (Weapon != null)
        {
            Weapon.Logic();
        }

        if (!IsAlive)
        {
            return;
        }

        if (shadow != null && !dashCooldown.IsDone)
        {
            if (!IsDashing)
            {
                dashCooldown.Logic();
            }

            if (dashCooldown.IsDone && IsLocalPlayer)
            {
                Map.AddEffect(new EffectRing(shadow.CurrentPosition, 1.2f, 0.5f, Color, Map));
            }
        }

        dodgeCooldown.Logic();

        oldInput = input;
        input    = new PlayerInput(inputData);
        if (oldInput == null)
        {
            oldInput = input;
        }

        if (!input.Equals(oldInput) && IsLocalPlayer)
        {
            if (IsDodgeing || IsDashing)
            {
                SendInputPure();
            }
            else
            {
                SendInput();
            }
        }

        if (gravityIgnore > 0 && !input.Equals(oldInput))
        {
            gravityIgnore = 0;
        }
        gravityIgnore -= Game.delta;

        dodgeIntervalTimer -= Game.delta;

        if (dashTarget == null && dodgeTarget == null)
        {
            Input();

            if (!WallStickable && WallTouch == 0)
            {
                WallStickable = true;
            }
            if (wallStick > 0)
            {
                if (WallTouch == 0 || IsOnGround)
                {
                    wallStick     = 0;
                    WallStickable = true;
                }
                wallStick -= Game.delta;
            }

            if (!canDoublejump && IsOnGround)
            {
                canDoublejump = true;
            }

            base.Logic();

            if (shadow == null && (IsOnGround || WallTouch != 0))
            {
                CreateShadow();
            }
            if (shadow != null)
            {
                shadow.Logic();
            }
        }
        else if (dashTarget != null)
        {
            DashStep();
        }
        else if (dodgeTarget != null)
        {
            DodgeStep();
            if (shadow != null)
            {
                shadow.Logic();
            }
        }
    }