LoadByIndex() public method

public LoadByIndex ( int sceneIndex ) : void
sceneIndex int
return void
Ejemplo n.º 1
0
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.RightArrow))
     {
         if (index < boards.Length - 1)
         {
             index++;
             boards[index].storyboard.gameObject.SetActive(true);
             boards[index - 1].storyboard.gameObject.SetActive(false);
         }
         else
         {
             loadScene.LoadByIndex(1);
         }
     }
     if (Input.GetKeyDown(KeyCode.LeftArrow))
     {
         if (index > 0)
         {
             index--;
             boards[index + 1].storyboard.gameObject.SetActive(false);
             boards[index].storyboard.gameObject.SetActive(true);
         }
         else
         {
             return;
         }
     }
     if (Input.GetKeyDown(KeyCode.Return))
     {
         loadScene.LoadByIndex(1);
     }
 }
Ejemplo n.º 2
0
 public void SelectCharacter()
 {
     selectedPlayers++;
     if (selectedPlayers >= 2)
     {
         //Debug.Log("Begin Game");
         levelLoader.LoadByIndex(2);
     }
 }
Ejemplo n.º 3
0
 public void FirstTimeClick()
 {
     if (Level == 1 && EXP == 0)
     {
     }
     else
     {
         LoadSceneOnclick.LoadByIndex(1);
     }
 }
Ejemplo n.º 4
0
    public void RemovePreferences()
    {
        PlayerPrefs.DeleteAll();

        //lockedPatterns = GameObject.FindObjectOfType<LockedPatterns>();
        //lockedPatterns.CheckForUnlockedPatterns();

        //dataController = GameObject.FindObjectOfType<DataController>();
        //dataController.ReloadProgress();
        loadSceneOnClick.LoadByIndex(0);
    }
Ejemplo n.º 5
0
 private void CheckNetworkSelections()
 {
     if (localChose && opponentChose)
     {
         //move to next scene
         LoadSceneOnClick scenechanger = GetComponent <LoadSceneOnClick>();
         scenechanger.LoadByIndex(7);
         CancelInvoke();
     }
     else if (!opponentChose)
     {
         //popup
         waitPanel.SetActive(true);
         Invoke("SetTimeoutPanelToActive", 10);
     }
 }
Ejemplo n.º 6
0
    void Populate()
    {
        GameObject newObject;

        for (int i = 0; i < numberToCreate; i++)
        {
            newObject = (GameObject)Instantiate(prefab, transform);     // transform is the parent
            //newObject.GetComponent<Button>().image.color = Random.ColorHSV();
            //newObject.GetComponentInChildren<Text>().text = "Level " + (i+1);
            newObject.GetComponentInChildren <Text>().text = " ";
            newObject.GetComponent <Button>().onClick.AddListener(delegate
            {
                LoadSceneOnClick click = new LoadSceneOnClick();
                click.LoadByIndex(i + 1);
            });
        }
    }
Ejemplo n.º 7
0
    public void TaskOnClick()
    {
        mainMenu.SetActive(false);
        if (GameManager.instance.inGame)
        {
            // Already in game so `resume` is active, just continue game on click
            GameManager.instance.ContinueGame();
        }
        else
        {
            // Button clicked outside of game, i.e. start screen
            // so set in game context and activate return to start screen button
            InGameContext();
            startScreenButton.SetActive(true);

            // TODO: Loads a specific level, this should be configuratble (for load games etc.)
            sceneSwitcher.LoadByIndex(1);
        }
    }
Ejemplo n.º 8
0
    void OnTriggerEnter(Collider other)
    {
        Debug.Log("CollisionDetected");
        if (other.gameObject.tag == "PointOfInterest" && other.gameObject != currentPoint.gameObject)
        {
            if (other.gameObject.GetComponent <PointOfInterestManager>().isWin)
            {
                Debug.Log("You win");
                sceneLoadScript.LoadByIndex(4);
            }

            currentPoint = other.GetComponent <PointOfInterestManager>();

            StartCoroutine("CommandAfterDelay");
        }
        else if (other.gameObject.tag == "Hazard")
        {
            DoDeath();
        }
    }
Ejemplo n.º 9
0
    public void ServerSelection()
    {
        //string servername = GetComponent<InputField>().text;
        string servername  = selectionText.text;
        bool   serverFound = false;

        if (servername != "")
        {
            try
            {
                PlayerInfo[] servers = netcontroller.GetServerListFromClient(false);
                int          index   = 0;
                foreach (PlayerInfo info in servers)
                {
                    if (servername == info.Name)
                    {
                        netcontroller.ServerSelected(index);
                        serverFound = true;
                        LoadSceneOnClick scenechanger = GetComponent <LoadSceneOnClick>();
                        scenechanger.LoadByIndex(4);
                        break;
                    }
                    index++;
                }
            }
            catch (Exception e)
            {
                Debug.Log(e.Message);
            }
        }
        if (!serverFound)
        {
            //invalid name, must choose another
            descText.text = "Please enter a valid name";
            GetComponent <InputField>().text = "";
        }
    }
Ejemplo n.º 10
0
 //method that destroys GameManager and loads game over scene
 public void Quit()
 {
     Destroy(gameObject);
     sceneLoader.LoadByIndex(2);
 }