public void FixedUpdate() { if (m_tempBuildingObj == null) { return; } Vector3 pos = m_tempBuildingObj.transform.position; pos.y -= 0.1f; GameObject collider = M_GameHelper.SGetObjectAtWorldPoint(pos); if (collider != null) { if (m_currentMiddleTile != collider.transform.parent.gameObject || m_currentMiddleTile == null) { foreach (Tile obj in m_tilesHighlighted) { obj.HighlightOccupied(false); } m_tilesHighlighted.Clear(); m_currentMiddleTile = collider.transform.parent.gameObject; Tile tile = collider.transform.parent.gameObject.GetComponent <Tile>(); if (tile == null) { return; } BuildingPhysics physics = m_tempBuildingComp.GetPhysics(); bool[] area = physics.GetArea(); int middleI = physics.GetWidth() / 2; int middleJ = physics.GetHeight() / 2; for (int i = 0; i < physics.GetWidth(); i++) { for (int j = 0; j < physics.GetHeight(); j++) { int tempI = tile.i - (middleI - i); int tempJ = tile.j - (middleJ - j); Tile tempTile = M_MapManager.SGetTileObject(tempI, tempJ).GetComponent <Tile>(); tempTile.HighlightOccupied(true); m_tilesHighlighted.Add(tempTile); } } } } }