private void Start()
 {
     score     = FindObjectOfType <background>();
     button    = FindObjectOfType <buttons>();
     healthbar = GameObject.Find("health").GetComponent <Text>();
     health_check();
 }
    // Update is called once per frame
    void Update()
    {
        if (onButton)
        {
            if (Input.GetKeyUp("i"))
            {
                typeButton = buttons.UP;
            }

            if (Input.GetKeyUp("k"))
            {
                typeButton = buttons.DOWN;
            }

            if (Input.GetKeyUp("l"))
            {
                typeButton = buttons.RIGHT;
            }

            if (Input.GetKeyUp("j"))
            {
                typeButton = buttons.LEFT;
            }

            if (typeButton != buttons.NULL)
            {
                manager.gameObject.GetComponent <Manager>().MovePlatform(ID, typeButton, hud, room, transform.parent.gameObject, collider);
                typeButton = buttons.NULL;
            }
        }
    }
Exemple #3
0
 void Start()
 {
     sv = svGO.GetComponent<save>();
     tst = tstGO.GetComponent<teste>();
     adAP = adAPGO.GetComponent<addAP>();
     mp = mpGO.GetComponent<maxPoints>();
     sn = snGO.GetComponent<SelecaoNiveis>();
     btns = btnsGO.GetComponent<buttons>();
 }
Exemple #4
0
 void Start()
 {
     sv = svGO.GetComponent<save>();
     tst = tstGO.GetComponent<teste>();
     adAP = adAPGO.GetComponent<addAP>();
     mp = mpGO.GetComponent<maxPoints>();
     sn = snGO.GetComponent<SelecaoNiveis>();
     btns = btnsGO.GetComponent<buttons>();
     btl = btlGO.GetComponent<Battle>();
     ce = ceGO.GetComponent<CreateEnemys>();
 }
    public static void saveSettings(buttons score)
    {
        BinaryFormatter binary = new BinaryFormatter();
        string          path   = Application.persistentDataPath + "/mazesettings.bblaze";

        FileStream stream = new FileStream(path, FileMode.Create);

        saveSettings playersData = new saveSettings(score);

        binary.Serialize(stream, playersData);
        stream.Close();
    }
Exemple #6
0
 public Controller()
 {
     cTime = 0; min = 0; sec = 0;
     // Creating Monoplayer modules
     player          = new MediaPlayer(this);
     btns            = new buttons(this);
     mediaController = new MediaController(this);
     dataBase        = new DataBase();
     mediaDB         = new MediaDataBase(this);
     menus           = new Menus(this);
     configmgr       = new ConfigManager(this);
 }
Exemple #7
0
    //오브젝트 리스트의 내용을 UI 스크롤뷰에 반영
    public void UpdateUIformObjectList()
    {
        int nidx = 0;

        foreach (ObjectInfo info in _lstObject)
        {
            var inst = Instantiate(_objButton, new Vector3(0, 0, 0), Quaternion.identity);
            inst.transform.SetParent(_objContent.transform);

            buttons btnScript = inst.GetComponent <buttons>();
            btnScript.SetInfo(info.szDispName, info.szFileName, info.byType, nidx++);
        }
    }
Exemple #8
0
 void Start()
 {
     sv = svGO.GetComponent<save>();
     tst = tstGO.GetComponent<teste>();
     adAP = adAPGO.GetComponent<addAP>();
     mp = mpGO.GetComponent<maxPoints>();
     sn = snGO.GetComponent<SelecaoNiveis>();
     btns = btnsGO.GetComponent<buttons>();
     btl = btlGO.GetComponent<Battle>();
     ce = ceGO.GetComponent<CreateEnemys>();
     lu = luGO.GetComponent<LevelUp>();
     ask = askGO.GetComponent<ActivateSkills>();
     us = usGO.GetComponent<UseSkills>();
 }
    bool updateMap(int ID, int delta_x, int delta_y, buttons typeButton)
    {
        MyVector2 pos = findPos(ID);

        if (ID == 7)
        {
            if (typeButton == buttons.RIGHT)
            {
                pos.y = pos.y + 1;
            }
            else if (typeButton == buttons.DOWN || typeButton == buttons.UP)
            {
                for (int i = 0; i < 2; i++)
                {
                    if (!(validPosition(pos, delta_x, delta_y + i) && map[pos.x + delta_x, pos.y + delta_y + i] == 0))
                    {
                        return(false);
                    }
                }
            }
        }

        if (validPosition(pos, delta_x, delta_y) && map[pos.x + delta_x, pos.y + delta_y] == 0)
        {
            map[pos.x + delta_x, pos.y + delta_y] = ID;
            if (ID == 7 && typeButton == buttons.LEFT)
            {
                map[pos.x, pos.y + 1] = 0;
            }
            else if (ID == 7 && typeButton == buttons.RIGHT)
            {
                map[pos.x, pos.y - 1] = 0;
            }
            else if (ID == 7 && (typeButton == buttons.DOWN || typeButton == buttons.UP))
            {
                for (int i = 0; i < 2; i++)
                {
                    map[pos.x + delta_x, pos.y + delta_y + i] = ID;
                    map[pos.x, pos.y + i] = 0;
                }
            }
            else
            {
                map[pos.x, pos.y] = 0;
            }
            return(true);
        }
        return(false);
    }
Exemple #10
0
    void ButtonClicked(buttons buttonNo)
    {
        //Output this to console when the Button3 is clicked
        Debug.Log("Button clicked = " + buttonNo);

        switch (buttonNo)
        {
        case buttons.BUTTON_RIGHT:

            index_option = (index_option + 1) % angle_options.Length;
            var angle_option = container_options.transform.eulerAngles;
            angle_option.z = angle_options[index_option];
            selected_container.transform.eulerAngles = angle_option;

            break;

        case buttons.BUTTON_LEFT:

            index_option--;
            if (index_option < 0)
            {
                index_option = angle_options.Length - 1;
            }

            angle_option   = container_options.transform.eulerAngles;
            angle_option.z = angle_options[index_option];
            selected_container.transform.eulerAngles = angle_option;


            break;

        case buttons.BUTTON_OPTIONS:
            show_screen(container_options, selected_container);

            break;
        }
    }
Exemple #11
0
 private void GoRight(object sender, RoutedEventArgs e)
 {
     EnumToButton(CurrentButton).BorderBrush = Brushes.Gray;
     if(CurrentButton == buttons.inner_right){
         CurrentButton = buttons.rtoz;
     }
     else
     {
         CurrentButton++;
     }
     EnumToButton(CurrentButton).BorderBrush = Brushes.Yellow;
 }
Exemple #12
0
    public void MovePlatform(int ID, buttons typeButton, GameObject HUDelem, GameObject RoomElem, GameObject platform, Collider collider)
    {
        switch (typeButton)
        {
        case buttons.UP:
            if (updateMap(ID, -1, 0, buttons.UP))
            {
                HUDelem.transform.Translate(UP.x / DELTA_HUD_X, UP.y / DELTA_HUD_Y, 0, Space.World);
                RoomElem.transform.Translate(Vector3.forward * DELTA_ROOM_Y);
                platform.transform.Translate(Vector3.forward * DELTA_PLATFORM_y);
                if (platform.name == "6_platform")
                {
                    tmp             = map_camera.rect;
                    tmp.y           = tmp.y + DELTA_CAMERA_Y;
                    map_camera.rect = tmp;
                }
                else if (platform.name == "3_platform")
                {
                    tmp              = life_camera.rect;
                    tmp.y            = tmp.y + DELTA_CAMERA_Y;
                    life_camera.rect = tmp;
                }
            }
            break;

        case buttons.LEFT:
            if (updateMap(ID, 0, -1, buttons.LEFT))
            {
                HUDelem.transform.Translate(LEFT.x / DELTA_HUD_X, LEFT.y / DELTA_HUD_Y, 0, Space.World);
                RoomElem.transform.Translate(Vector3.left * DELTA_ROOM_X);
                platform.transform.Translate(Vector3.left * DELTA_PLATFORM_x);
                if (platform.name == "6_platform")
                {
                    tmp             = map_camera.rect;
                    tmp.x           = tmp.x - DELTA_CAMERA;
                    map_camera.rect = tmp;
                }
                else if (platform.name == "3_platform")
                {
                    tmp              = life_camera.rect;
                    tmp.x            = tmp.x - DELTA_CAMERA;
                    life_camera.rect = tmp;
                }
            }
            break;

        case buttons.RIGHT:
            if (updateMap(ID, 0, 1, buttons.RIGHT))
            {
                HUDelem.transform.Translate(RIGHT.x / DELTA_HUD_X, RIGHT.y / DELTA_HUD_Y, 0, Space.World);
                RoomElem.transform.Translate(Vector3.right * DELTA_ROOM_X);
                platform.transform.Translate(Vector3.right * DELTA_PLATFORM_x);
                if (platform.name == "6_platform")
                {
                    tmp             = map_camera.rect;
                    tmp.x           = tmp.x + DELTA_CAMERA;
                    map_camera.rect = tmp;
                }
                else if (platform.name == "3_platform")
                {
                    tmp              = life_camera.rect;
                    tmp.x            = tmp.x + DELTA_CAMERA;
                    life_camera.rect = tmp;
                }
            }
            break;

        case buttons.DOWN:
            if (updateMap(ID, 1, 0, buttons.DOWN))
            {
                HUDelem.transform.Translate(DOWN.x / DELTA_HUD_X, DOWN.y / DELTA_HUD_Y, 0, Space.World);
                RoomElem.transform.Translate(Vector3.back * DELTA_ROOM_Y);
                platform.transform.Translate(Vector3.back * DELTA_PLATFORM_y);
                if (platform.name == "6_platform")
                {
                    tmp             = map_camera.rect;
                    tmp.y           = tmp.y - DELTA_CAMERA_Y;
                    map_camera.rect = tmp;
                }
                else if (platform.name == "3_platform")
                {
                    tmp              = life_camera.rect;
                    tmp.y            = tmp.y - DELTA_CAMERA_Y;
                    life_camera.rect = tmp;
                }
            }
            break;
        }
    }
 public void ChangeButton(buttons newButton)
 {
     this.button = newButton;
     UpdateBorder();
 }
        /// <summary>
        /// Returns the joystick button, will be used for debouncing, check if the return is button.notRecognized
        /// </summary>
        /// <param name="js">Joystick object</param>
        /// <param name="jsTimer">JoystickTimer (Control) that ticks for the joystick</param>
        public static buttons getPressedButton(Joystick js, Timer jsTimer)
        {
            previousState = currentState;

            try
            {
                js.UpdateStatus();
                joystickButtons = js.availableButtons;   //Get joystick all buttons in a bool array

                if (js.Xaxis == 0)
                {
                    currentState = buttons.Left;
                }

                if (js.Xaxis == axis_Max_Val)
                {
                    currentState = buttons.Right;
                }

                if (js.Yaxis == 0)
                {
                    currentState = buttons.Up;
                }

                if (js.Yaxis == axis_Max_Val)
                {
                    currentState = buttons.Down;
                }

                //Find the pressed button
                for (int i = 0; i < joystickButtons.Length; i++)
                {
                    if (joystickButtons[i] == true) //The pressed button will have a true value
                    {
                        currentState = (buttons)(i + 1); //Save the pressed button
                    }
                }
            }
            catch
            {
                jsTimer.Enabled = false;    //Disable the timer
                Joystick.connectToJoystick(js, jsTimer);    //Reconnect to the joystick
            }
            return currentState;    //Return the current button
        }
Exemple #15
0
 private Button EnumToButton(buttons butt)
 {
     switch(butt){
         case buttons.rtoz:
             return Rtoz;
         case buttons.inner_left:
             return Inner_left;
         case buttons.play:
             return Play;
         case buttons.stop:
             return Stop;
         case buttons.inner_right:
             return Inner_right;
         default:
             return Play;
     }
 }
 public saveSettings(buttons score)
 {
     change = score.leftRight;
 }
Exemple #17
0
    public void ClickSimpleButton(buttons button)
    {
        switch (button)
        {
        case buttons.EDITING:
            character.ChangeState(Character.states.EDITING);
            break;

        case buttons.EDITING_FREE:
            character.ChangeState(Character.states.EDITING_FREE);
            break;

        case buttons.CUBE_CONSTRUCTOR:
            character.ChangeState(Character.states.CUBE_CONSTRUCTOR);
            break;

        case buttons.FREE_DRAWING:
            character.ChangeState(Character.states.FREE_DRAWING);
            break;

        case buttons.TELEPORT:
            character.ChangeState(Character.states.TELEPORT);
            break;

        case buttons.SCALE_X1:
            Events.OnResizeWorld(UIZoom.sizes.SMALL);
            break;

        case buttons.SCALE_X2:
            Events.OnResizeWorld(UIZoom.sizes.MEDIUM);
            break;

        case buttons.SCALE_X3:
            Events.OnResizeWorld(UIZoom.sizes.BIG);
            break;

        case buttons.GRAVITY_YES:
            World.Instance.useGravity = true;
            Events.OnRecalculateGravity();
            break;

        case buttons.GRAVITY_NO:
            World.Instance.useGravity = false;
            break;

        case buttons.SNAPPING_ON:
            World.Instance.useSnapping = true;
            break;

        case buttons.SNAPPING_OFF:
            World.Instance.useSnapping = false;
            break;

        case buttons.COLORS_ON:
            character.ChangeState(Character.states.COLOR_PAINT);
            panelActive = panels.COLORS;
            SetActivePanel();
            break;

        case buttons.COLORS_OFF:
            panelActive = panels.INIT;
            SetActivePanel();
            break;

        case buttons.SETTINGS_ON:
            panelActive = panels.SETTINGS;
            SetActivePanel();
            break;

        case buttons.SETTINGS_OFF:
            panelActive = panels.INIT;
            SetActivePanel();
            break;

        case buttons.DESTROY:
            character.ChangeState(Character.states.DESTROY);
            break;
        }
    }
Exemple #18
0
 ShowWithButtons(text, instructionText, buttons, detail, icon, cancelable, expandedLabel);
Exemple #19
0
 public Form1()
 {
     _buttons = new buttons(this);
 }