void OnEnable() { if (!blockCursor) { blockCursor = Instantiate(blockCursorPrefab); blockCursor.name = "BlockCursor"; blockCursor.SetActive(false); meshFilter = blockCursor.GetComponentInChildren <MeshFilter>(); MeshBuilder.BuildBlock(new Vector3(-0.5f, -0.5f, -0.5f), meshFilter.mesh); } interactor = GetComponent <BlockInteractor>(); interactor.selectedBlockChanged += OnSelectedBlockChanged; builder = GetComponent <BlockBuilder>(); if (builder) { builder.blockTypeSelected += OnSelectedBlockChanged; } }
void Awake() { blockTypeToBuild = buildableBlocks[0]; playerTransform = gameObject.transform; interactor = GetComponent <BlockInteractor>(); }
void OnEnable() { interactor = GetComponent <BlockInteractor>(); interactor.selectedBlockChanged += OnSelectedBlockChanged; }