Ejemplo n.º 1
0
    /// <summary>
    /// Runs on controller creation.
    /// </summary>
    private void Awake()
    {
        // If the object has not been set yet (this object)
        if (canvas == null)
        {
            // Don't EVER destroy this one, and set this object so we have a reference to it later.
            DontDestroyOnLoad(gameObject);
            canvas = this;

            // Reassign the button onClick methods
            Button[] buttons = this.gameObject.GetComponentsInChildren <Button>();
            foreach (Button b in buttons)
            {
                if (b.name == "ButtonStart")
                {
                    b.onClick.AddListener(LocalNavigation_Start);
                }
                if (b.name == "ButtonQuit")
                {
                    b.onClick.AddListener(LocalNavigation_Quit);
                }
            }
        }
        else if (canvas != this)
        {
            // If there is an object already stored, and it's not this one, destroy this!
            Destroy(gameObject);
        }
    }
Ejemplo n.º 2
0
 public void HideCanvasMainMenu()
 {
     CanvasMainMenu.GetComponent <CanvasGroup>().alpha          = 0;
     CanvasMainMenu.GetComponent <CanvasGroup>().blocksRaycasts = false;
 }
Ejemplo n.º 3
0
 public void ShowCanvasMainMenu()
 {
     CanvasMainMenu.GetComponent <CanvasGroup>().alpha          = 1;
     CanvasMainMenu.GetComponent <CanvasGroup>().blocksRaycasts = true;
 }