Exemple #1
0
    private void Update()
    {
        m_Input.Clear();
        m_Input.AddKeyPressed(keyHeldDown);

        fTimer += Time.deltaTime;

        if (fTimer > fMaxTimer)
        {
            fTimer -= fMaxTimer;

            // Pick a random direction
            int iRand = Random.Range(0, 5);
            if (iRand == 0)
            {
                keyHeldDown = KeyCode.W;
            }
            else if (iRand == 1)
            {
                keyHeldDown = KeyCode.A;
            }
            else if (iRand == 2)
            {
                keyHeldDown = KeyCode.S;
            }
            else if (iRand == 3)
            {
                keyHeldDown = KeyCode.D;
            }
            else if (iRand == 4)
            {
                keyHeldDown = KeyCode.Space;
            }
        }
    }