Ejemplo n.º 1
0
    public void UpdateStep()
    {
        tick++;
        health.UpdateStep();
        if (health.bleeding > 0 && tick % 5 == 0)
        {
            World.AddEffect(new Trail(Position, 150, new ColoredGlyph(Color.Red, Color.Black, '+')));
        }
        if (health.bloodHP < 1 || health.bodyHP < 1)
        {
            Active = false;
            this.AddMessage(new InfoEvent("You have died"));
        }

        /*
         * if(AllowUpdate()) {
         *  World.AddEffect(new RealtimeTrail(Position, 0.25, new ColoredGlyph('@', Color.White, Color.Black)));
         * }
         */

        if (frameCounter > 0)
        {
            frameCounter--;
        }

        this.UpdateGravity();
        this.UpdateMotion();

        foreach (var a in Actions)
        {
            a.Update();
        }
        Actions.RemoveWhere(a => a.Done());

        foreach (var i in Inventory)
        {
            //Copy so that when the item updates motion, the change does not apply to the player
            i.Position = Position.copy;
            i.Velocity = Velocity.copy;
            i.UpdateStep();
        }

        Inventory.RemoveWhere(i => !i.Active);
        Watch.RemoveWhere(t => !t.Active);
        if (!this.OnGround())
        {
            frameCounter = 20;
        }

        //HistoryRecent.RemoveAll(e => e.ScreenTime < 1);
    }