private Vector3 BirdseyePosition(ChunkView chunkView, ChunkRequest chunkRequest, ChunkFeature chunkFeature, ChunkFeatureView chunkFeatureView) { int depth = ChunkMath.Depth(chunkRequest); int side = ChunkMath.Side(chunkRequest); int depthStartChunkNum = ChunkMath.DepthStartChunkNum(chunkRequest); int sideStartChunkNum = ChunkMath.SideStartChunkNum(chunkRequest); int sideChunkNum = ChunkMath.SideChunkNum(chunkRequest); switch (side) { case 0: return(Position(chunkRequest, chunkReference.Northeast, chunkReference.Northwest, sideChunkNum, depth, chunkFeature, chunkFeatureView)); case 1: return(Position(chunkRequest, chunkReference.East, chunkReference.Northeast, sideChunkNum, depth, chunkFeature, chunkFeatureView)); case 2: return(Position(chunkRequest, chunkReference.Southeast, chunkReference.East, sideChunkNum, depth, chunkFeature, chunkFeatureView)); case 3: return(Position(chunkRequest, chunkReference.Southwest, chunkReference.Southeast, sideChunkNum, depth, chunkFeature, chunkFeatureView)); case 4: return(Position(chunkRequest, chunkReference.West, chunkReference.Southwest, sideChunkNum, depth, chunkFeature, chunkFeatureView)); case 5: return(Position(chunkRequest, chunkReference.Northwest, chunkReference.West, sideChunkNum, depth, chunkFeature, chunkFeatureView)); } Debug.LogError("Failed to compute spiral chunk position"); return(Vector3.zero); }
public ChunkFacade( Chunk chunk, ChunkView chunkView) { this.chunk = chunk; this.chunkView = chunkView; }
public ChunkBase( ChunkReference chunkReference, ChunkView chunkView, ChunkBaseView chunkBaseView, ChunkFeatureView chunkFeatureView, PlatformView.Factory platformViewFactory) { this.chunkReference = chunkReference; this.chunkView = chunkView; this.chunkBaseView = chunkBaseView; this.chunkFeatureView = chunkFeatureView; this.platformViewFactory = platformViewFactory; }
public void Place(ChunkView chunkView, ChunkRequest chunkRequest, ChunkFeature chunkFeature, ChunkFeatureView chunkFeatureView) { if (chunkRequest.chunkNum == 0) { chunkView.Rotation *= Quaternion.AngleAxis( 120, chunkView.Up ); chunkView.Position = Vector3.zero + Altitude(chunkRequest, chunkFeature, chunkFeatureView); return; } chunkView.Rotation *= BirdseyeRotation(chunkView, chunkRequest); chunkView.Position = BirdseyePosition(chunkView, chunkRequest, chunkFeature, chunkFeatureView); previousChunkView = chunkView; }
public Chunk( DiContainer container, Settings settings, ChunkRequest chunkRequest, ChunkView chunkView, ChunkFeature chunkFeature, ChunkFeatureView chunkFeatureView, IChunkPlacingStrategy chunkPlacingStrategy) { this.container = container; this.settings = settings; this.chunkRequest = chunkRequest; this.chunkView = chunkView; this.chunkFeature = chunkFeature; this.chunkFeatureView = chunkFeatureView; this.chunkPlacingStrategy = chunkPlacingStrategy; }
private Quaternion BirdseyeRotation(ChunkView chunkView, ChunkRequest chunkRequest) { int side = ChunkMath.Side(chunkRequest); int depthStartChunkNum = ChunkMath.DepthStartChunkNum(chunkRequest); int depthEndChunkNum = ChunkMath.DepthEndChunkNum(chunkRequest); if (chunkRequest.chunkNum == depthStartChunkNum || chunkRequest.chunkNum == depthEndChunkNum) { side = 5; } side = (side + 4) % 6; return(Quaternion.AngleAxis( side * 60, chunkView.Up )); }