Exemple #1
0
        public Keyboard(Keyboard other_config, KeyCode base_key)
        {
            constructor_defaults(other_config.current_keyboard());
            key_configuration_location = other_config.configuration();
            base_config_key_loc        = (Vector2)key_hash[base_key];

            //checks to make sure it's not off keyboard, THROW EXCEPTION
            if (configuration_location_check(num_rows, row_size) == false)
            {
                throw new Exception("ERROR: Invalid key configuration given in constructor");
            }
        }
Exemple #2
0
    // Update is called once per frame
    void Update()
    {
        inspect  = temp.get_key_assignment((int)key_config.up);
        inspect2 = temp2.get_key_assignment((int)key_config.up);

        Vector3 vel = Vector3.zero;

        if (temp.get_key((int)key_config.up))
        {
            print("UP");
            vel.y += 5;
        }
        if (temp2.get_key((int)key_config.up))
        {
            print("UP2");
            vel.y += 5;
        }

        if (temp.get_key((int)key_config.down))
        {
            print("DOWN");
            vel.y -= 5;
        }
        if (temp2.get_key((int)key_config.down))
        {
            print("DOWN2");
            vel.y -= 5;
        }

        if (temp.get_key((int)key_config.right))
        {
            print("RIGHT");
            vel.x += 5;
        }
        if (temp2.get_key((int)key_config.right))
        {
            print("RIGHT2");
            vel.x += 5;
        }

        if (temp.get_key((int)key_config.left))
        {
            print("LEFT");
            vel.x -= 5;
        }
        if (temp2.get_key((int)key_config.left))
        {
            print("LEFT2");
            vel.x -= 5;
        }

        rigidbody.velocity = vel;
        if (Input.GetKeyDown(KeyCode.LeftShift))
        {
            if (temp.current_keyboard() == ConsistentKeyboard.Keyboard.Keyboard_Type.QWERTY)
            {
                temp.keyboard_switch(ConsistentKeyboard.Keyboard.Keyboard_Type.AZERTY);
                temp2.keyboard_switch(ConsistentKeyboard.Keyboard.Keyboard_Type.AZERTY);
            }
            else
            {
                temp.keyboard_switch(ConsistentKeyboard.Keyboard.Keyboard_Type.QWERTY);
                temp2.keyboard_switch(ConsistentKeyboard.Keyboard.Keyboard_Type.QWERTY);
            }
        }
    }