IEnumerator Start () 
	{	
		_world = new World();
		
		ChunkRenderer.SmoothLight = _smoothLight;
		World.LightAttenuation = _lightAttenuation;
		ChunkRenderer.WorldHeight = new float[_world.WorldVisibleSizeX, _world.WorldVisibleSizeZ];
		
		_simplexNoise3D = new SimplexNoise3D(WorldConfig.WorldSeed);
		
		if (Application.platform == RuntimePlatform.Android || Application.platform == RuntimePlatform.IPhonePlayer)
		{
			_characterMobile.Init(_world);
		}
		else
		{
			_character.Init(_world);
		}
		
		// The following code avoid the player fall before the world creation finish
		// Note: Yeah, I know... I'm a lazy bastard. 
		// Since this project is not focused on the character control I don't mind to do some ugly stuff like this
		StartCoroutine( "FreezePlayer" );
			
		yield return StartCoroutine( CreateWorld() );
		
		StopCoroutine( "FreezePlayer" );
		
	}
Example #2
0
    IEnumerator Start()
    {
        _world = new World();

        ChunkRenderer.SmoothLight = _smoothLight;
        World.LightAttenuation    = _lightAttenuation;
        ChunkRenderer.WorldHeight = new float[_world.WorldVisibleSizeX, _world.WorldVisibleSizeZ];

        _simplexNoise3D = new SimplexNoise3D(WorldConfig.WorldSeed);

        if (Application.platform == RuntimePlatform.Android || Application.platform == RuntimePlatform.IPhonePlayer)
        {
            _characterMobile.Init(_world);
        }
        else
        {
            _character.Init(_world);
        }

        // The following code avoid the player fall before the world creation finish
        // Note: Yeah, I know... I'm a lazy bastard.
        // Since this project is not focused on the character control I don't mind to do some ugly stuff like this
        StartCoroutine("FreezePlayer");

        yield return(StartCoroutine(CreateWorld()));

        StopCoroutine("FreezePlayer");
    }