Esempio n. 1
0
    public void TestCombatBuffer()
    {
        CombatBuffer buffer = new CombatBuffer(10);

        for (int iter = 0; iter < 1; iter++)
        {
            for (int i = 0; i < 3; i++)
            {
                buffer.Write(CombatCommand.Down);
            }
            Debug.Assert(buffer.Count == 3);

            for (int i = 0; i < 20; i++)
            {
                buffer.Write(CombatCommand.Down);
            }
            Debug.Assert(buffer.Count == 10);

            buffer.Write(CombatCommand.Right);
            Debug.Assert(buffer.Newest() == CombatCommand.Right);
            Debug.Assert(buffer.Oldest() == CombatCommand.Down);

            Debug.Assert(buffer.Match(new CombatCommand[] { CombatCommand.Down }) == false);
            Debug.Assert(buffer.Match(new CombatCommand[] { CombatCommand.Right, CombatCommand.Down }));
            Debug.Assert(buffer.Match(new CombatCommand[] { CombatCommand.Down, CombatCommand.Down }) == false);

            buffer.Write(CombatCommand.Up);
            Debug.Assert(buffer.Match(new CombatCommand[] { CombatCommand.Up, CombatCommand.Right }));

            buffer.ClearCommands();
            Debug.Assert(buffer.Count == 0);
        }
    }
Esempio n. 2
0
    // -ButtBehaviour API-
    protected override void Update()
    {
        base.Update();

        m_Movement.Move(m_MovementAmount, TimeController.GetDeltaTime(TimeCategory.Gameplay));
        m_ComboLife += TimeController.GetDeltaTime(TimeCategory.Gameplay);

        if (m_ComboLife > m_ComboTimeout)
        {
            m_CombatBuffer.ClearCommands();
            m_ComboLife = 0.0f;
        }
    }