Esempio n. 1
0
    public static void Correctmove()
    {
        int          id             = 0;
        float        catchTime      = timer;
        List <float> boxes_coords_x = new List <float>();
        List <float> boxes_coords_y = new List <float>();
        panels       panel          = Camera.main.GetComponent <panels>();

        comboText.GetComponent <Text>().text = combo + "x";
        if (combo > 1)
        {
            comboText.GetComponent <Animation>().Play("combo_appear");
        }
        foreach (GameObject obj in selected_boxes)
        {
            boxes_coords_x.Add(obj.GetComponent <block>().coord_x);
            boxes_coords_y.Add(obj.GetComponent <block>().coord_y);
            obj.GetComponent <block>().disappearBlock();
            panel.placeBox(boxes_coords_x[id], boxes_coords_y[id]);
            id++;
            Destroy(obj);
        }
        boxes_coords_x = new List <float>();
        boxes_coords_y = new List <float>();
        scoreManager.increasePoints((int)catchTime);
        StateManager.playCorrect();
        correctAddTime(combo);
        RestoreToDefault();
        generateNewWantedValue();
    }
    void OnTutorialOn(panels _panel)
    {
        SetOff();
        switch (_panel)
        {
        case panels.HURDLES:
            if (!Data.Instance.userData.ready_tutorial_hurdles)
            {
                tutorial_hurdles.SetActive(true); SetOn();
                StartCoroutine(PlayCoroutine(tutorial_hurdles.GetComponent <Animation>(), "hurdles", false));
                Data.Instance.userData.ready_tutorial_hurdles = true;
            }
            break;

        case panels.MUD:
            if (!Data.Instance.userData.ready_tutorial_mud)
            {
                tutorial_mud.SetActive(true); SetOn();
                StartCoroutine(PlayCoroutine(tutorial_mud.GetComponent <Animation>(), "hurdles", false));
                Data.Instance.userData.ready_tutorial_mud = true;
            }
            break;

        case panels.RUN:
            if (!Data.Instance.userData.ready_tutorial_run)
            {
                tutorial_run.SetActive(true); SetOn();
                StartCoroutine(PlayCoroutine(tutorial_run.GetComponent <Animation>(), "run", false));
                Data.Instance.userData.ready_tutorial_run = true;
            }
            break;

        case panels.TRAMPOLIN:
            if (!Data.Instance.userData.ready_tutorial_trampolin)
            {
                tutorial_trampolin.SetActive(true); SetOn();
                StartCoroutine(PlayCoroutine(tutorial_trampolin.GetComponent <Animation>(), "hurdles", false));
                Data.Instance.userData.ready_tutorial_trampolin = true;
            }
            break;

        case panels.WALLS:
            if (!Data.Instance.userData.ready_tutorial_walls)
            {
                tutorial_walls.SetActive(true); SetOn();
                StartCoroutine(PlayCoroutine(tutorial_walls.GetComponent <Animation>(), "walls", false));
                Data.Instance.userData.ready_tutorial_walls = true;
            }
            break;
        }
    }
Esempio n. 3
0
 public void Reshuffle()
 {
     if (reshuffles > 0)
     {
         StartCoroutine(reshuffleTimer());
         StateManager.playReshuffle();
         panels panel = Camera.main.GetComponent <panels>();
         panel.fillScene();
         blockselector.RestoreToDefault();
         blockselector.generateNewWantedValue();
         reshuffles--;
         if (reshuffles < 1)
         {
             GameObject.Find("shuffle_button").GetComponent <Button>().interactable = false;
         }
     }
     else
     {
         print("no shuffles left");
     }
 }
Esempio n. 4
0
 Register(panels[i].Item1, panels[i].Item2);
Esempio n. 5
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;
        }
    }
 //Selection Panel Control
 public void PanelControl(int newPanel)
 {
     if (newPanel != (int)currentPanel)
     {
         switch (newPanel)
         {
             case (int)panels.Target:
                 currentPanel = panels.Target;
                 break;
             case (int)panels.Magic:
                 currentPanel = panels.Magic;
                 break;
             case (int)panels.Item:
                 currentPanel = panels.Item;
                 break;
             case (int)panels.None:
                 currentPanel = panels.None;
                 break;
             default:
                 Debug.Log("newPanel value is not valid!  You f****d up in the inspector!");
                 break;
         }
         OpenPanel(SelectionPanel);
     }
     else
     {
         currentPanel = panels.None;
         ClosePanel(SelectionPanel);
     }
 }
    //Populating the contents of the panel
    private void getPanelContent(panels panel)
    {
        //Destroy all listItems to start fresh each time

        foreach (var item in population)
        {
            Destroy(item);
        }

        switch (panel)
        {
            case panels.None:
                population.Clear();
                break;
            case panels.Target:
                break;
            case panels.Magic:
                break;
            case panels.Item:
                //Test Case, NEEDS TO BE REPLACED
                for (int i = 0; i < Random.Range(20,20); i++)
                {
                    GameObject listItem = Instantiate(SelectionListItem) as GameObject;
                    population.Add(listItem);
                    listItem.transform.SetParent(ListItemsScrollRect,false);  //The second parameter keeps it from rescaling.  I don't understand why it does this.  Need to look at documentation.
                }
                break;
            default:
                break;
        }
    }
    //Before anything is drawn
    void Awake()
    {
        //Singleton Check
        if (instance != null)
            Destroy(this);
        else
            instance = gameObject;

        //All panels closed by default
        currentPanel = panels.None;
        ClosePanel(SelectionPanel);
        ClosePanel(PauseMenu);
    }