private void Awake() { tileChangeManager = transform.GetComponentInParent <TileChangeManager>(); metaDataLayer = transform.GetComponentInParent <MetaDataLayer>(); metaTileMap = transform.GetComponentInParent <MetaTileMap>(); Layer = GetComponent <Layer>(); matrix = GetComponentInParent <Matrix>(); tileChangeManager.OnFloorOrPlatingRemoved.RemoveAllListeners(); tileChangeManager.OnFloorOrPlatingRemoved.AddListener(cellPos => { //Poke items when both floor and plating are gone //As they might want to change matrix if (!metaTileMap.HasTile(cellPos, LayerType.Floors) && !metaTileMap.HasTile(cellPos, LayerType.Base) && metaTileMap.HasObject(cellPos, CustomNetworkManager.Instance._isServer) ) { foreach (var customNetTransform in matrix.Get <CustomNetTransform>(cellPos, true)) { customNetTransform.CheckMatrixSwitch(); } } }); }
//Poke items when both floor and plating are gone //As they might want to change matrix public void SwitchObjectsMatrixAt(Vector3Int cellPos) { if (!metaTileMap.HasTile(cellPos, LayerType.Floors) && !metaTileMap.HasTile(cellPos, LayerType.Base) && metaTileMap.HasObject(cellPos, CustomNetworkManager.Instance._isServer) ) { foreach (var customNetTransform in matrix.Get <CustomNetTransform>(cellPos, true)) { customNetTransform.CheckMatrixSwitch(); } } }