public Sector() { Lights = new List <SectorLight>(); Tiles = new SectorTile[4096]; Objects = new List <GameObject>(); TileScripts = new List <TileScript>(); }
public void SetSectorTile(SectorTile st) { nowSectorTile = st; nowSectorTile.onSector = this; if (transform.childCount == 1) { transform.GetChild(0).GetComponent <PlanetBase>().targetPos = nowSectorTile.thirdSeat; transform.GetChild(0).GetComponent <PlanetBase>().isMove = false; } else if (transform.childCount == 2) { transform.GetChild(0).GetComponent <PlanetBase>().targetPos = nowSectorTile.secondSeat; transform.GetChild(1).GetComponent <PlanetBase>().targetPos = nowSectorTile.fourthSeat; transform.GetChild(0).GetComponent <PlanetBase>().isMove = false; transform.GetChild(1).GetComponent <PlanetBase>().isMove = false; } else { transform.GetChild(0).GetComponent <PlanetBase>().targetPos = nowSectorTile.firstSeat; transform.GetChild(1).GetComponent <PlanetBase>().targetPos = nowSectorTile.thirdSeat; transform.GetChild(2).GetComponent <PlanetBase>().targetPos = nowSectorTile.fifthSeat; transform.GetChild(0).GetComponent <PlanetBase>().isMove = false; transform.GetChild(1).GetComponent <PlanetBase>().isMove = false; transform.GetChild(2).GetComponent <PlanetBase>().isMove = false; } //StartCoroutine(CoroutineUtil.LerpMove(this.gameObject, this.transform.position, new Vector2(nowSectorTile.x, transform.position.y), 2)); }
public void SetSectorTile(SectorTile st) { nowSectorTile = st; nowSectorTile.onSector = this; if (transform.childCount == 1) { transform.GetChild(0).GetComponent<PlanetBase>().targetPos = nowSectorTile.thirdSeat; transform.GetChild(0).GetComponent<PlanetBase>().isMove = false; } else if (transform.childCount == 2) { transform.GetChild(0).GetComponent<PlanetBase>().targetPos = nowSectorTile.secondSeat; transform.GetChild(1).GetComponent<PlanetBase>().targetPos = nowSectorTile.fourthSeat; transform.GetChild(0).GetComponent<PlanetBase>().isMove = false; transform.GetChild(1).GetComponent<PlanetBase>().isMove = false; } else { transform.GetChild(0).GetComponent<PlanetBase>().targetPos = nowSectorTile.firstSeat; transform.GetChild(1).GetComponent<PlanetBase>().targetPos = nowSectorTile.thirdSeat; transform.GetChild(2).GetComponent<PlanetBase>().targetPos = nowSectorTile.fifthSeat; transform.GetChild(0).GetComponent<PlanetBase>().isMove = false; transform.GetChild(1).GetComponent<PlanetBase>().isMove = false; transform.GetChild(2).GetComponent<PlanetBase>().isMove = false; } //StartCoroutine(CoroutineUtil.LerpMove(this.gameObject, this.transform.position, new Vector2(nowSectorTile.x, transform.position.y), 2)); }
public SectorTileInfo(SectorTile tile) { if (tile.sector != null) { sector = tile.sector.sector; hasSector = true; } else { hasSector = false; } }
private SimpleMesh BuildSubTileMesh(RenderingDevice device, VertexShader shader, Sector sector) { var builder = new SubTileMeshBuilder(sector.secLoc); for (int y = 0; y < Sector.SectorSideSize; y++) { for (int x = 0; x < Sector.SectorSideSize; x++) { var tileIdx = Sector.GetSectorTileIndex(x, y); var tile = sector.tilePkt.tiles[tileIdx]; for (int dx = 0; dx < 3; dx++) { for (int dy = 0; dy < 3; dy++) { var blockFlag = SectorTile.GetBlockingFlag(dx, dy); var flyOverFlag = SectorTile.GetFlyOverFlag(dx, dy); var blocking = tile.flags.HasFlag(blockFlag); var flyover = tile.flags.HasFlag(flyOverFlag); PackedLinearColorA color; if (blocking) { color = new PackedLinearColorA(200, 0, 0, 127); } else if (flyover) { color = new PackedLinearColorA(127, 0, 127, 127); } else { continue; } builder.Add(x * 3 + dx, y * 3 + dy, color); } } } } return(builder.Build(shader)); }
void Start() { planetFactory = GameObject.FindObjectOfType <PlanetFactory>(); gm = GameObject.FindObjectOfType <GameManager>(); dm = GameObject.FindObjectOfType <DataManager>(); player = GameObject.FindObjectOfType <Player>(); for (int i = 0; i < sectorTiles.Length; i++) { sectorTiles[i] = new SectorTile(); sectorTiles[i].index = i; //sectorTiles[i].x = -8f + 3.2f * i; sectorTiles[i].onSector = null; } sectorTiles[0].firstSeat = new Vector2(-1000, -800) / 100f; sectorTiles[0].secondSeat = new Vector2(-1000, -800) / 100f; sectorTiles[0].thirdSeat = new Vector2(-1000, -800) / 100f; sectorTiles[0].fourthSeat = new Vector2(-1000, -800) / 100f; sectorTiles[0].fifthSeat = new Vector2(-1000, -800) / 100f; sectorTiles[1].firstSeat = new Vector2(-800, -500) / 100f; sectorTiles[1].secondSeat = new Vector2(-800, -500) / 100f; sectorTiles[1].thirdSeat = new Vector2(-512, -198) / 100f; sectorTiles[1].fourthSeat = new Vector2(-800, -500) / 100f; sectorTiles[1].fifthSeat = new Vector2(-800, -500) / 100f; sectorTiles[2].firstSeat = new Vector2(-512, 114) / 100f; sectorTiles[2].secondSeat = new Vector2(-386, 96) / 100f; sectorTiles[2].thirdSeat = new Vector2(-255, 10) / 100f; sectorTiles[2].fourthSeat = new Vector2(-188, -117) / 100f; sectorTiles[2].fifthSeat = new Vector2(-175, -207) / 100f; sectorTiles[3].firstSeat = new Vector2(-23, 255) / 100f; sectorTiles[3].secondSeat = new Vector2(47, 139) / 100f; sectorTiles[3].thirdSeat = new Vector2(90, 64) / 100f; sectorTiles[3].fourthSeat = new Vector2(119, -30) / 100f; sectorTiles[3].fifthSeat = new Vector2(134, -117) / 100f; sectorTiles[4].firstSeat = new Vector2(368, 258) / 100f; sectorTiles[4].secondSeat = new Vector2(430, 150) / 100f; sectorTiles[4].thirdSeat = new Vector2(452, 80) / 100f; sectorTiles[4].fourthSeat = new Vector2(470, -10) / 100f; sectorTiles[4].fifthSeat = new Vector2(486, -95) / 100f; sectorTiles[5].firstSeat = new Vector2(800, 500) / 100f; sectorTiles[5].secondSeat = new Vector2(800, 500) / 100f; sectorTiles[5].thirdSeat = new Vector2(800, 500) / 100f; sectorTiles[5].fourthSeat = new Vector2(800, 500) / 100f; sectorTiles[5].fifthSeat = new Vector2(800, 500) / 100f; for (int i = 0; i < sectors.Length; i++) { sectors[i] = Instantiate(sector); sectors[i].gameObject.SetActive(false); } for (int i = 0; i < 6; i++) { if (i == 1) { continue; } Sector s = CreateSector(); s.SetSectorTile(sectorTiles[i]); for (int j = 0; j < s.transform.childCount; j++) { s.transform.GetChild(j).position = s.transform.GetChild(j).GetComponent <PlanetBase>().targetPos; } } startSector.SetSectorTile(sectorTiles[1]); for (int i = 0; i < startSector.transform.childCount; i++) { startSector.transform.GetChild(i).position = startSector.transform.GetChild(i).GetComponent <PlanetBase>().targetPos; } ProbabilityRevision(); sectorData = dm.GetCurrentSectorData(currentSector); }
void Start() { planetFactory = GameObject.FindObjectOfType<PlanetFactory>(); gm = GameObject.FindObjectOfType<GameManager>(); dm = GameObject.FindObjectOfType<DataManager>(); player = GameObject.FindObjectOfType<Player>(); for (int i = 0; i < sectorTiles.Length; i++) { sectorTiles[i] = new SectorTile(); sectorTiles[i].index = i; //sectorTiles[i].x = -8f + 3.2f * i; sectorTiles[i].onSector = null; } sectorTiles[0].firstSeat = new Vector2(-1000, -800)/100f; sectorTiles[0].secondSeat = new Vector2(-1000, -800) / 100f; sectorTiles[0].thirdSeat = new Vector2(-1000, -800) / 100f; sectorTiles[0].fourthSeat = new Vector2(-1000, -800) / 100f; sectorTiles[0].fifthSeat = new Vector2(-1000, -800) / 100f; sectorTiles[1].firstSeat = new Vector2(-800, -500) / 100f; sectorTiles[1].secondSeat = new Vector2(-800, -500) / 100f; sectorTiles[1].thirdSeat = new Vector2(-512, -198) / 100f; sectorTiles[1].fourthSeat = new Vector2(-800, -500) / 100f; sectorTiles[1].fifthSeat = new Vector2(-800, -500) / 100f; sectorTiles[2].firstSeat = new Vector2(-512, 114) / 100f; sectorTiles[2].secondSeat = new Vector2(-386, 96) / 100f; sectorTiles[2].thirdSeat = new Vector2(-255, 10) / 100f; sectorTiles[2].fourthSeat = new Vector2(-188, -117) / 100f; sectorTiles[2].fifthSeat = new Vector2(-175, -207) / 100f; sectorTiles[3].firstSeat = new Vector2(-23, 255) / 100f; sectorTiles[3].secondSeat = new Vector2(47, 139) / 100f; sectorTiles[3].thirdSeat = new Vector2(90, 64) / 100f; sectorTiles[3].fourthSeat = new Vector2(119, -30) / 100f; sectorTiles[3].fifthSeat = new Vector2(134, -117) / 100f; sectorTiles[4].firstSeat = new Vector2(368, 258) / 100f; sectorTiles[4].secondSeat = new Vector2(430, 150) / 100f; sectorTiles[4].thirdSeat = new Vector2(452, 80) / 100f; sectorTiles[4].fourthSeat = new Vector2(470, -10) / 100f; sectorTiles[4].fifthSeat = new Vector2(486, -95) / 100f; sectorTiles[5].firstSeat = new Vector2(800, 500) / 100f; sectorTiles[5].secondSeat = new Vector2(800, 500) / 100f; sectorTiles[5].thirdSeat = new Vector2(800, 500) / 100f; sectorTiles[5].fourthSeat = new Vector2(800, 500) / 100f; sectorTiles[5].fifthSeat = new Vector2(800, 500) / 100f; for (int i = 0; i < sectors.Length; i++) { sectors[i] = Instantiate(sector); sectors[i].gameObject.SetActive(false); } for (int i = 0; i < 6; i++) { if (i == 1) continue; Sector s = CreateSector(); s.SetSectorTile(sectorTiles[i]); for (int j = 0; j < s.transform.childCount; j++) s.transform.GetChild(j).position = s.transform.GetChild(j).GetComponent<PlanetBase>().targetPos; } startSector.SetSectorTile(sectorTiles[1]); for (int i = 0; i < startSector.transform.childCount; i++) startSector.transform.GetChild(i).position = startSector.transform.GetChild(i).GetComponent<PlanetBase>().targetPos; ProbabilityRevision(); sectorData = dm.GetCurrentSectorData(currentSector); }