// Start is called before the first frame update protected virtual void Start() { currentTile = HexMapHelper.GetTileFromWorldPoint(transform.position); currentTileFacing = HexMapHelper.GetNeighborTiles(currentTile)[0]; PositionAndOrientPiece(); eventPublisher.Publish(new Events.CompletedSetup()); }
void Start() { //Randomly Generate Model GameObject prefab = template.modelPrefabs.RandomItem(); GameObject.Instantiate(prefab, Vector3.zero, Quaternion.identity, modelHolder); if (pivotPosition.index == 0) { pivotPosition = HexMapHelper.GetTileFromWorldPoint(transform.position); } TileCoords pivotFacing = HexMapHelper.GetNeighborTiles(pivotPosition).RandomItem(); transform.position = HexMapHelper.GetWorldPointFromTile(pivotPosition, pivotLevel); modelHolder.transform.rotation = HexMapHelper.GetRotationFromFacing(pivotPosition, pivotFacing); footprint = new StaticFootprint(template.footprint, pivotPosition, pivotFacing, pivotLevel); }
// Start is called before the first frame update void Start() { TileCoords startTile = HexMapHelper.GetTileFromWorldPoint(transform.position); TileWithFacing startVec = new TileWithFacing() { position = startTile, facing = HexMapHelper.GetNeighborTiles(startTile)[facingIndex] }; List <TileWithLevel> footprintParts = new List <TileWithLevel>(); footprintParts.Add(new TileWithLevel() { position = startVec.position, level = level }); List <Vector3> lineNodes = new List <Vector3>(); TileWithFacing currentVec = startVec; for (int nodeIndex = 0; nodeIndex < maxLength; nodeIndex++) { currentVec = currentVec.Traverse(HexDirection.Forward); if (currentVec.position == startVec.position) { break; } lineNodes.Add(HexMapHelper.GetWorldPointFromTile(currentVec.position, level)); footprintParts.Add(new TileWithLevel() { position = currentVec.position, level = level }); } line.positionCount = lineNodes.Count; line.SetPositions(lineNodes.ToArray()); footprint = new StaticFootprint(footprintParts); }