// Start is called before the first frame update void Start() { _TileMap = WorldController.GetWorldController.TileMap; Lib = WorldController.GetWorldController.GetComponentInChildren <TileLibrary>(); MSC = WorldController.GetWorldController.GetComponentInChildren <MapSaveController>(); Dictionary <int, GameObject> t = Lib.GetTileList(); TileIds = new List <int>(t.Keys); TileIds.Sort(); }
protected override void OnTileStart() { base.OnTileStart(); _sideWalls = new List <GameObject> { _BuildingObject.transform.GetChild(0).GetChild(0).gameObject, _BuildingObject.transform.GetChild(0).GetChild(1).gameObject, _BuildingObject.transform.GetChild(0).GetChild(2).gameObject, _BuildingObject.transform.GetChild(0).GetChild(3).gameObject }; _tilemap = GameObject.FindGameObjectWithTag("Logic").GetComponent <TileMap3D>(); HadFluidBlock = true; }
void Start() { TileMap = WorldController.GetWorldController.TileMap; TileLib = WorldController.GetWorldController.GetComponentInChildren <TileLibrary>(); MapSaver = WorldController.GetWorldController.GetComponentInChildren <MapSaveController>(); MenuScript = GetComponent <MenuScript>(); if (StaticMapInfo.Level != "" && StaticMapInfo.LoadingIntoLevelEditor) { HideAllDialogPanels(); _yourMapsPanel.SetActive(false); // MapSaver.LoadTileSet(StaticMapInfo.Level); } }
// Start is called before the first frame update void Start() { Map = WorldController.GetWorldController.GetComponent <TileMap3D>(); Decal = FOW.GetComponentInChildren <DecalProjectorComponent>(); Directions = new Vector2Int[8]; Directions[0] = new Vector2Int(0, 1); Directions[1] = new Vector2Int(1, 0); Directions[2] = new Vector2Int(0, -1); Directions[3] = new Vector2Int(-1, 0); Directions[4] = new Vector2Int(1, 1); Directions[5] = new Vector2Int(1, -1); Directions[6] = new Vector2Int(-1, 1); Directions[7] = new Vector2Int(-1, -1); }
protected override void OnTileDestroy() { base.OnTileDestroy(); if (_worldController) { _worldController._HQ = null; TileMap3D tileMap = _worldController.TileMap; Tile temp = tileMap.GetTileAtPos(x + (int)_BuildingSize[0].x, y + (int)_BuildingSize[0].y); if (temp) { if (temp.tag == "HQ") { tileMap.ClearTile(temp.X, temp.Y); } } } }
// Start is called before the first frame update void Start() { #if UNITY_EDITOR || DEVELOPMENT_BUILD Samples = CustomSampler.Create("Fluid Update"); #endif _TileMap = transform.parent.GetComponent <TileMap3D>(); _Lib = GetComponent <FluidLibrary>(); UpdateScheduling(); BuildDataStrcutres(); Instance = this; if (WaterMat != null) { WaterMat = new Material(WaterMat); WaterMat.SetFloat("Vector1_FF411F1A", 1.0f); } }
protected virtual void OnFluidContact(FluidContactInfo f) { if (_TileHealth > 0.0f) { if (f.ContactedFluid != null) { _TileHealth -= f.ContactedFluid.DamageToTiles * Time.deltaTime; } else { _TileHealth -= 1.0f; } } else { TileMap3D mpa = WorldController._worldController.GetComponent <TileMap3D>(); mpa.ClearTile(x, y); } }
/// <summary> /// Set camera bounds using grid size /// </summary> public void ComputeBounds() { TileMap3D Tilemap = GetComponent <TileMap3D>(); if (Tilemap == null) { float MaxValue = 10e9f; CameraBounds = new Bounds(Vector3.zero, new Vector3(MaxValue, MaxValue, MaxValue)); return; } float XSize = Tilemap.GridXSize_ * Tilemap.GridSpacing; float YSize = Tilemap.GridYSize_ * Tilemap.GridSpacing; Vector3 pos = Tilemap.GetGridCentre(); pos.y = pos.z; pos.z = 0.0f; CameraBounds = new Bounds(Offset + pos, new Vector3(XSize - Padding, YSize - Padding, 20)); }
private void LateUpdate() { //Grabbing the tilemap in LateUpdate to ensure the correct tilemap id grabbed and loaded, then setting the minimaps position _currentLevel = GameObject.FindGameObjectWithTag("Logic").GetComponent <TileMap3D>(); SetMinimapPosition(CalculateBounds()); }
// Start is called before the first frame update void Start() { _theTilemap = WorldController.GetWorldController.GetComponent <TileMap3D>(); }
protected override void TileUpdate() { if (_VisibleRangeObject) { if (GetComponent <SelectableObject>()._selected) { _VisibleRangeObject.SetActive(true); } else { _VisibleRangeObject.SetActive(false); } } if (_Destroy) { //Just reussing build progress cause why not _BuildProgress += Time.deltaTime; _BuildingObject.transform.position = Vector3.Lerp(_OrigPos, new Vector3(_OrigPos.x, _OrigPos.y - 5, _OrigPos.z), _BuildProgress); //_BuildingObject.transform.position = new Vector3(_OrigPos.x, // Mathf.Min(_OrigPos.y - 5f + _BuildProgress, _OrigPos.y), // _OrigPos.z); if (_BuildProgress >= 1) { if (_Builder) { _Builder.transform.GetChild(0).GetChild(1).GetComponent <SkinnedMeshRenderer>().enabled = true; } smokeVFX.Stop(); TileMap3D mpa = WorldController._worldController.GetComponent <TileMap3D>(); mpa.ClearTile(x, y); } } //if (_Builder && !_Built) //{ // if (smokeVFX) // smokeVFX.Play(); // _BuildProgress += Time.deltaTime / _TimeToBuild; // _BuildingObject.transform.position = Vector3.Lerp(new Vector3(_OrigPos.x, _OrigPos.y - 5, _OrigPos.z), // _OrigPos, _BuildProgress); // //_BuildingObject.transform.position = new Vector3(_OrigPos.x, // // Mathf.Min(_OrigPos.y - 5f + _BuildProgress, _OrigPos.y), // // _OrigPos.z); // if (_BuildProgress >= 1) // { // _Built = true; // _Builder.CancelCurrentTask(); // _Builder = null; // OnBuilt(); // } //} if (_Built) { EnergyTimer(); } if (_audioSource != null) { if (!_Built && _building) { if (!_audioSource.isPlaying) { _audioSource.Play(); } } else { _audioSource.Stop(); } } //_building = false; }