Ejemplo n.º 1
0
    public void Place()
    {
        GameObject objToPlace = isTestudoOnBlock ? testudoOnBlockPrefab : testudoPrefab;

        Instantiate(objToPlace, currentPreviewObject.transform.position, currentPreviewObject.transform.rotation);
        Destroy(currentPreviewObject);
        ARMenu.Show();
    }
Ejemplo n.º 2
0
    /// <summary>
    /// Hide this menu (and any Children)
    /// </summary>
    public void Hide()
    {
        // Reference ARMenu component of this object
        ARMenu ThisMenu = gameObject.GetComponent(typeof(ARMenu)) as ARMenu;

        // Hide this menu button and tell children to do the same
        gameObject.SetActive(false);
        if (ThisMenu.Children.Count != 0)
        {
            foreach (ARMenu child in ThisMenu.Children)
            {
                child.Hide();
            }
        }
    }
Ejemplo n.º 3
0
    private void SpawnMenu()
    {
        m_IsMenuBuilt = true;
        // Spawn the AR Menu and intitialize
        GameObject arMenuLiivObj = Instantiate(ARMenu_Liiv_Prefab) as GameObject;

        arMenuLiivObj.transform.SetParent(transform, false);
        arMenuLiivObj.transform.position = transform.position;
        arMenuLiivObj.transform.rotation = transform.rotation;

        _activeARMenu = arMenuLiivObj.transform.GetComponent <ARMenu>();
        _activeARMenu.Init(ARMenu.MENU_TYPE.Liiv);

        appStateManager.CurrentScreenState = AppStateManager.SCREEN_STATE.MENU;
        if (OnStateChange != null)
        {
            OnStateChange(AppStateManager.SCREEN_STATE.MENU);
        }
    }
Ejemplo n.º 4
0
    /// <summary>
    /// When triggered by clicking on a menu item
    /// </summary>
    public void Interact()
    {
        // Reference ARMenu component of this object
        ARMenu ThisMenu = gameObject.GetComponent(typeof(ARMenu)) as ARMenu;

        // If this button is in the Active state
        if (IsActive && IsImplemented)
        {
            // Play select/tap sound
            TeleportalUi.Shared.PlaySound(TeleportalUi.SoundType.Select);

            // Make sure button target is set
            if (Executable && TargetObject != null && TargetMethod != null && TargetScript != null)
            {
                // Run the targeted method on target script
                (TargetObject.GetComponent(TargetScript) as MonoBehaviour).Invoke(TargetMethod, 0f);
            }
            // Otherwise, throw an error
            else if (Executable)
            {
                print("Button " + transform.name + " is missing target associations and cannot execute.");
            }

            if (HasChildren)
            {
                // Activate this menu's children
                foreach (ARMenu child in ThisMenu.Children)
                {
                    child.Activate();
                }

                // Hide this menu's siblings (but not children)
                foreach (ARMenu sibling in ThisMenu.Siblings)
                {
                    sibling.NotChosen();
                }

                // Set this button to inactive
                ThisMenu.Deactivate();

                // Hide menu text now that this has become inactive
                LostFocus();
            }
        }

        // If this button is in the Inactive state
        else if (!IsActive && IsImplemented)
        {
            // Hide this menu's children
            foreach (ARMenu child in ThisMenu.Children)
            {
                child.Hide();
            }

            // Activate this menu's siblings
            foreach (ARMenu sibling in ThisMenu.Siblings)
            {
                sibling.Activate();
            }

            // Set this button to active
            ThisMenu.Activate();

            // Display menu button title text
            GotFocus();
        }
    }