// ISCENECOMPONENT INTERFACE void ISceneComponent.Initialize(MainScene scene) { m_HeadTransform = scene.PlayerController.HeadTransform; m_TerrainManager = scene.TerrainManager; m_InputManager = scene.InputManager; m_TerrainBlock.Initialize(m_TerrainManager.BlockSettings); UpdateSelectedBlock(true); }
// PRIVATE METHODS private void InitializeSceneComponents() { var sceneComponents = GetComponentsInChildren <ISceneComponent>(true); PlayerController = FindComponent <PlayerController>(sceneComponents); InputManager = FindComponent <InputManager>(sceneComponents); TerrainManager = FindComponent <BlockTerrainManager>(sceneComponents); System.Array.ForEach(sceneComponents, component => component.Initialize(this)); }