Esempio n. 1
0
    void GetNextKeys()
    {
        nextKeys = ChooseNewKeys();

        ChangeText(true);
        Invoke("ChangeKeys", NextKeyShowTime);
    }
Esempio n. 2
0
    private WalkBundle ChooseBundleEasy()
    {
        WalkBundle nextBundle = new WalkBundle(KeyCode.A, KeyCode.D, KeyCode.W, KeyCode.S);

        WalkBundle[] easy = new WalkBundle[easyBundle.Count];
        easyBundle.CopyTo(easy);

        nextBundle = WolfMath.Choose <WalkBundle>(easy);

        return(nextBundle);
    }
Esempio n. 3
0
    // Use this for initialization
    void Start()
    {
        easyBundle             = new List <WalkBundle> ();
        mediumBundleHorizontal = new List <WalkPair> ();
        mediumBundleVertical   = new List <WalkPair> ();
        keycodes = new List <KeyCode> ();
        nextKeys = new WalkBundle(player.left, player.right, player.up, player.down);

        timeOfLastChange = 0;

        SetBundles();
        SetStartingButtons();
    }
Esempio n. 4
0
    WalkBundle ChooseNewKeys()
    {
        WalkBundle nextBundle = new WalkBundle(KeyCode.A, KeyCode.D, KeyCode.W, KeyCode.S);

        if (DifficultyLevel == 0)
        {
            if (WolfMath.Chance(CurrentLevelChance))
            {
                return(ChooseBundleEasy());
            }
            else
            {
                return(ChooseBundleMedium());
            }
        }
        else if (DifficultyLevel == 1)
        {
            WalkBundle horizontal, vertical;

            // Choose Horizontal
            if (WolfMath.Chance(CurrentLevelChance))
            {
                horizontal = ChooseBundleMedium();
            }
            else
            {
                horizontal = ChooseBundleHard();
            }

            // Choose Vertical
            if (WolfMath.Chance(CurrentLevelChance))
            {
                vertical = ChooseBundleMedium();
            }
            else
            {
                vertical = ChooseBundleHard();
            }

            return(new WalkBundle(horizontal.left, horizontal.right, vertical.up, vertical.down));
        }
        else if (DifficultyLevel == 2)
        {
            return(ChooseBundleHard());
        }

        return(nextBundle);
    }
Esempio n. 5
0
    private WalkBundle ChooseBundleHard()
    {
        WalkBundle nextBundle;

        KeyCode up, down, left, right;

        KeyCode[] keys = new KeyCode[keycodes.Count];
        keycodes.CopyTo(keys);

        /* *
         * Choose key and then remove it from the keycode list so it's not picked twice
         * */

        up = WolfMath.Choose <KeyCode>(keys);

        keycodes.Remove(up);
        keys = new KeyCode[keycodes.Count];
        keycodes.CopyTo(keys);


        down = WolfMath.Choose <KeyCode>(keys);

        keycodes.Remove(down);
        keys = new KeyCode[keycodes.Count];
        keycodes.CopyTo(keys);


        left = WolfMath.Choose <KeyCode>(keys);

        keycodes.Remove(left);
        keys = new KeyCode[keycodes.Count];
        keycodes.CopyTo(keys);


        right = WolfMath.Choose <KeyCode>(keys);

        // Add the keys back
        keycodes.Add(up);
        keycodes.Add(down);
        keycodes.Add(left);

        nextBundle = new WalkBundle(left, right, up, down);

        return(nextBundle);
    }
Esempio n. 6
0
    private WalkBundle ChooseBundleMedium()
    {
        WalkBundle nextBundle = new WalkBundle(KeyCode.A, KeyCode.D, KeyCode.W, KeyCode.S);

        WalkPair horizontal, vertical;

        WalkPair[] mediumHorizontal = new WalkPair[mediumBundleHorizontal.Count];
        WalkPair[] mediumVertical   = new WalkPair[mediumBundleVertical.Count];

        mediumBundleHorizontal.CopyTo(mediumHorizontal);
        mediumBundleVertical.CopyTo(mediumVertical);

        horizontal = WolfMath.Choose <WalkPair>(mediumHorizontal);
        vertical   = WolfMath.Choose <WalkPair>(mediumVertical);

        nextBundle.left  = horizontal.negative;
        nextBundle.right = horizontal.positive;
        nextBundle.up    = vertical.positive;
        nextBundle.down  = vertical.negative;

        return(nextBundle);
    }
Esempio n. 7
0
    public void SetBundles()
    {
        WalkBundle bundle;
        WalkPair   pair;

        if (keyboardType == KeyboardType.QWERTY)
        {
            bundle = new WalkBundle(KeyCode.A, KeyCode.D, KeyCode.W, KeyCode.S);
            easyBundle.Add(bundle);
            bundle = new WalkBundle(KeyCode.S, KeyCode.F, KeyCode.E, KeyCode.D);
            easyBundle.Add(bundle);
            bundle = new WalkBundle(KeyCode.D, KeyCode.G, KeyCode.R, KeyCode.F);
            easyBundle.Add(bundle);
            bundle = new WalkBundle(KeyCode.F, KeyCode.H, KeyCode.T, KeyCode.G);
            easyBundle.Add(bundle);
            bundle = new WalkBundle(KeyCode.G, KeyCode.J, KeyCode.Y, KeyCode.H);
            easyBundle.Add(bundle);
            bundle = new WalkBundle(KeyCode.H, KeyCode.K, KeyCode.U, KeyCode.J);
            easyBundle.Add(bundle);
            bundle = new WalkBundle(KeyCode.J, KeyCode.L, KeyCode.I, KeyCode.K);
            easyBundle.Add(bundle);



            pair = new WalkPair(KeyCode.Z, KeyCode.X);
            mediumBundleHorizontal.Add(pair);
            pair = new WalkPair(KeyCode.X, KeyCode.C);
            mediumBundleHorizontal.Add(pair);
            pair = new WalkPair(KeyCode.C, KeyCode.V);
            mediumBundleHorizontal.Add(pair);
            pair = new WalkPair(KeyCode.V, KeyCode.B);
            mediumBundleHorizontal.Add(pair);
            pair = new WalkPair(KeyCode.B, KeyCode.N);
            mediumBundleHorizontal.Add(pair);
            pair = new WalkPair(KeyCode.N, KeyCode.M);
            mediumBundleHorizontal.Add(pair);


            pair = new WalkPair(KeyCode.A, KeyCode.Q);
            mediumBundleVertical.Add(pair);
            pair = new WalkPair(KeyCode.S, KeyCode.W);
            mediumBundleVertical.Add(pair);
            pair = new WalkPair(KeyCode.D, KeyCode.E);
            mediumBundleVertical.Add(pair);
            pair = new WalkPair(KeyCode.F, KeyCode.R);
            mediumBundleVertical.Add(pair);
            pair = new WalkPair(KeyCode.G, KeyCode.T);
            mediumBundleVertical.Add(pair);
            pair = new WalkPair(KeyCode.H, KeyCode.Y);
            mediumBundleVertical.Add(pair);
            pair = new WalkPair(KeyCode.J, KeyCode.U);
            mediumBundleVertical.Add(pair);
            pair = new WalkPair(KeyCode.K, KeyCode.I);
            mediumBundleVertical.Add(pair);
            pair = new WalkPair(KeyCode.L, KeyCode.O);
            mediumBundleVertical.Add(pair);
        }
        else if (keyboardType == KeyboardType.AZERTY)
        {
            bundle = new WalkBundle(KeyCode.Q, KeyCode.D, KeyCode.Z, KeyCode.S);
            easyBundle.Add(bundle);
            bundle = new WalkBundle(KeyCode.S, KeyCode.F, KeyCode.E, KeyCode.D);
            easyBundle.Add(bundle);
            bundle = new WalkBundle(KeyCode.D, KeyCode.G, KeyCode.R, KeyCode.F);
            easyBundle.Add(bundle);
            bundle = new WalkBundle(KeyCode.F, KeyCode.H, KeyCode.T, KeyCode.G);
            easyBundle.Add(bundle);
            bundle = new WalkBundle(KeyCode.G, KeyCode.J, KeyCode.Y, KeyCode.H);
            easyBundle.Add(bundle);
            bundle = new WalkBundle(KeyCode.H, KeyCode.K, KeyCode.U, KeyCode.J);
            easyBundle.Add(bundle);
            bundle = new WalkBundle(KeyCode.J, KeyCode.L, KeyCode.I, KeyCode.K);
            easyBundle.Add(bundle);
            bundle = new WalkBundle(KeyCode.K, KeyCode.M, KeyCode.O, KeyCode.L);
            easyBundle.Add(bundle);


            pair = new WalkPair(KeyCode.W, KeyCode.X);
            mediumBundleHorizontal.Add(pair);
            pair = new WalkPair(KeyCode.X, KeyCode.C);
            mediumBundleHorizontal.Add(pair);
            pair = new WalkPair(KeyCode.C, KeyCode.V);
            mediumBundleHorizontal.Add(pair);
            pair = new WalkPair(KeyCode.V, KeyCode.B);
            mediumBundleHorizontal.Add(pair);
            pair = new WalkPair(KeyCode.B, KeyCode.N);
            mediumBundleHorizontal.Add(pair);

            pair = new WalkPair(KeyCode.Q, KeyCode.A);
            mediumBundleVertical.Add(pair);
            pair = new WalkPair(KeyCode.S, KeyCode.Z);
            mediumBundleVertical.Add(pair);
            pair = new WalkPair(KeyCode.D, KeyCode.E);
            mediumBundleVertical.Add(pair);
            pair = new WalkPair(KeyCode.F, KeyCode.R);
            mediumBundleVertical.Add(pair);
            pair = new WalkPair(KeyCode.G, KeyCode.T);
            mediumBundleVertical.Add(pair);
            pair = new WalkPair(KeyCode.H, KeyCode.Y);
            mediumBundleVertical.Add(pair);
            pair = new WalkPair(KeyCode.J, KeyCode.U);
            mediumBundleVertical.Add(pair);
            pair = new WalkPair(KeyCode.K, KeyCode.I);
            mediumBundleVertical.Add(pair);
            pair = new WalkPair(KeyCode.L, KeyCode.O);
            mediumBundleVertical.Add(pair);
            pair = new WalkPair(KeyCode.M, KeyCode.P);
            mediumBundleVertical.Add(pair);
        }
        else if (keyboardType == KeyboardType.DVORAK)
        {
            bundle = new WalkBundle(KeyCode.E, KeyCode.I, KeyCode.P, KeyCode.U);
            easyBundle.Add(bundle);
            bundle = new WalkBundle(KeyCode.U, KeyCode.D, KeyCode.Y, KeyCode.I);
            easyBundle.Add(bundle);
            bundle = new WalkBundle(KeyCode.I, KeyCode.H, KeyCode.F, KeyCode.D);
            easyBundle.Add(bundle);
            bundle = new WalkBundle(KeyCode.D, KeyCode.T, KeyCode.G, KeyCode.H);
            easyBundle.Add(bundle);
            bundle = new WalkBundle(KeyCode.H, KeyCode.N, KeyCode.C, KeyCode.T);
            easyBundle.Add(bundle);
            bundle = new WalkBundle(KeyCode.T, KeyCode.S, KeyCode.R, KeyCode.N);
            easyBundle.Add(bundle);


            pair = new WalkPair(KeyCode.Q, KeyCode.J);
            mediumBundleHorizontal.Add(pair);
            pair = new WalkPair(KeyCode.J, KeyCode.K);
            mediumBundleHorizontal.Add(pair);
            pair = new WalkPair(KeyCode.K, KeyCode.X);
            mediumBundleHorizontal.Add(pair);
            pair = new WalkPair(KeyCode.X, KeyCode.B);
            mediumBundleHorizontal.Add(pair);
            pair = new WalkPair(KeyCode.B, KeyCode.M);
            mediumBundleHorizontal.Add(pair);
            pair = new WalkPair(KeyCode.M, KeyCode.W);
            mediumBundleHorizontal.Add(pair);
            pair = new WalkPair(KeyCode.W, KeyCode.V);
            mediumBundleHorizontal.Add(pair);
            pair = new WalkPair(KeyCode.V, KeyCode.Z);
            mediumBundleHorizontal.Add(pair);


            pair = new WalkPair(KeyCode.U, KeyCode.P);
            mediumBundleVertical.Add(pair);
            pair = new WalkPair(KeyCode.I, KeyCode.Y);
            mediumBundleVertical.Add(pair);
            pair = new WalkPair(KeyCode.D, KeyCode.F);
            mediumBundleVertical.Add(pair);
            pair = new WalkPair(KeyCode.H, KeyCode.G);
            mediumBundleVertical.Add(pair);
            pair = new WalkPair(KeyCode.T, KeyCode.C);
            mediumBundleVertical.Add(pair);
            pair = new WalkPair(KeyCode.N, KeyCode.R);
            mediumBundleVertical.Add(pair);
            pair = new WalkPair(KeyCode.S, KeyCode.L);
            mediumBundleVertical.Add(pair);
        }

        keycodes.Add(KeyCode.Q);
        keycodes.Add(KeyCode.W);
        keycodes.Add(KeyCode.E);
        keycodes.Add(KeyCode.R);
        keycodes.Add(KeyCode.T);
        keycodes.Add(KeyCode.Y);
        keycodes.Add(KeyCode.U);
        keycodes.Add(KeyCode.I);
        keycodes.Add(KeyCode.O);
        keycodes.Add(KeyCode.P);
        keycodes.Add(KeyCode.A);
        keycodes.Add(KeyCode.S);
        keycodes.Add(KeyCode.D);
        keycodes.Add(KeyCode.F);
        keycodes.Add(KeyCode.G);
        keycodes.Add(KeyCode.H);
        keycodes.Add(KeyCode.J);
        keycodes.Add(KeyCode.K);
        keycodes.Add(KeyCode.L);
        keycodes.Add(KeyCode.Z);
        keycodes.Add(KeyCode.X);
        keycodes.Add(KeyCode.C);
        keycodes.Add(KeyCode.V);
        keycodes.Add(KeyCode.B);
        keycodes.Add(KeyCode.N);
        keycodes.Add(KeyCode.M);
    }