Skip to content

Instantly share code, notes, and snippets.

@JonRurka
Created May 15, 2015 20:14
Show Gist options
  • Save JonRurka/d39980c36c4f5b11069b to your computer and use it in GitHub Desktop.
Save JonRurka/d39980c36c4f5b11069b to your computer and use it in GitHub Desktop.
public void SpawnChunk(Vector3Int location)
{
if (!pageController.BuilderExists(location.x, location.y, location.z))
{
SmoothChunk chunkInstance = new SmoothChunk();
ScriptComponent scriptComp = new ScriptComponent();
Entity chunkObj = new Entity();
//chunkObj.Transform.Parent = Entity.Transform;
SceneSystem.SceneInstance.Scene.AddChild<Entity>(chunkObj);
chunkObj.Name = string.Format("Chunk_{0}.{1}.{2}", location.x, location.y, location.z);
chunkObj.Add<ScriptComponent>(ScriptComponent.Key, scriptComp);
scriptComp.Scripts.Add(chunkInstance);
chunkInstance.Init(new Vector3Int(location.x, location.y, location.z), pageController);
pageController.Add(location, chunkInstance);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment