Esempio n. 1
0
    private NinjaLevel LoadSomeLevel(GameObject originalLevel, bool instantiateOnNetwork)
    {
        if (instantiateOnNetwork)
        {
            if (Network.peerType == NetworkPeerType.Server)
            {
                level = FlexiInstantiate <NinjaLevel>(originalLevel, new Vector3(0, 0, 0), Quaternion.identity, instantiateOnNetwork);
                mainCamera.transform.position = level.cameraPosition;
            }
        }
        else
        {
            level = FlexiInstantiate <NinjaLevel>(originalLevel, new Vector3(0, 0, 0), Quaternion.identity, instantiateOnNetwork);
            mainCamera.transform.position = level.cameraPosition;

            localNinja = CreateNinja(NinjaBehaviour.NinjaColor.White, level.whiteNinjaPosition, instantiateOnNetwork);
            CreateNinja(NinjaBehaviour.NinjaColor.Black, level.blackNinjaPosition, instantiateOnNetwork);
        }

        //Set global game state to fighting
        GetComponent <GlobalGameState>().SetFightingState();

        ((GameHUD)FindObjectOfType(typeof(GameHUD))).showMe = true;

        return(level);
    }
    // Called by ConnectGui once connected.
    public void OnNetworkLoadedLevel()
    {
        Destroy(currentMainMenuGrid);
        DisposeCurrentLevel();

        const bool instantiateOnNetwork = true;
        if(hasPlayedTutorial)
        {
            currentLevel = GetComponent<LevelLoader>().LoadLevel002(instantiateOnNetwork);
        }
        else
        {
            currentLevel = GetComponent<LevelLoader>().LoadTutorialLevel(instantiateOnNetwork);
            hasPlayedTutorial = true;
        }
    }
    // Called by ConnectGui once connected.
    public void OnNetworkLoadedLevel()
    {
        Destroy(currentMainMenuGrid);
        DisposeCurrentLevel();

        const bool instantiateOnNetwork = true;

        if (hasPlayedTutorial)
        {
            currentLevel = GetComponent <LevelLoader>().LoadLevel002(instantiateOnNetwork);
        }
        else
        {
            currentLevel      = GetComponent <LevelLoader>().LoadTutorialLevel(instantiateOnNetwork);
            hasPlayedTutorial = true;
        }
    }