public void MapTest() { WorldContainer map = new WorldContainer(); Random rng = new Random(); map.InitMap(rng); map.DisplayMap(); }
/// <inheritdoc cref="IWorldTask"/> public void RunWorldTask(WorldContainer world) { foreach (var block in m_EditBatch()) { world.SetBlock(block.Position, block.BlockID); } world.RemeshDirtyChunks(); }
public DirectXUi(IGame game, WorldContainer worldContainer) { #if GPU_DEBUG SharpDX.Configuration.EnableObjectTracking = true; #endif _game = game; _worldContainer = worldContainer; _timer = new Toolkit.Timer(); _notificationResolver = new NotificationResolver(); }
public void OnClick(int i) { var c = containers.ToArray()[i - 1]; c.selector.interactable = false; c.stages.gameObject.SetActive(true); enable.stages.gameObject.SetActive(false); enable.selector.interactable = true; enable = c; }
/// <inheritdoc cref="IWorldTask"/> public void RunWorldTask(WorldContainer world) { if (world.DoesChunkExist(m_ChunkPosition)) { return; } world.LoadChunk(m_ChunkPosition); WasJustLoaded = true; }
/// <summary> /// Called when the BlockWorld behaviour is disabled. /// </summary> private void OnDisable() { WorldContainer.BlockContainerProvider.OnBlockContainerCreated -= OnChunkCreated; WorldContainer.BlockContainerProvider.OnBlockContainerDestroyed -= OnChunkDestroyed; WorldContainer = null; foreach (var chunk in m_Chunks) { m_ChunkCreator.DestroyChunk(chunk); } m_Chunks.Clear(); }
public void TestMethod1() { WorldContainer world = new WorldContainer(); world.AddTile("AA", new Ocean()); world.AddTile("AB", new Ocean()); world.AddTile("BA", new Ocean()); world.AddTile("AC", new Coast()); world.AddTile("BB", new Coast()); world.AddTile("BC", new Coast()); world.AddTile("CC", new Coast()); world.DisplayMap(); }
public Context(RenderForm form, Dx11 directX, IGame game, WorldContainer worldContainer, IUiManager uiManager, IInput input, Camera camera, NotificationResolver notificationResolver, DataLock datalock) { _worldContainer = worldContainer; NotificationResolver = notificationResolver; Form = form; DirectX = directX; Game = game; TextureManager = new TextureManager(DirectX.Device); TextManager = new TextManager(this); Shaders = new ShaderManager(DirectX.Device); Camera = camera; UiManager = uiManager; Input = input; DataLock = datalock; }
/// <summary> /// Called when the BlockWorld behaviour is enabled. /// </summary> private void OnEnable() { var chunkSize = new GridSize(4); var world = new World(chunkSize); var blockList = new BlockTypeList(); var remesh = new RemeshHandler(); var database = new WorldDatabase("/home/thedudefromci/Bones3/TestWorld"); remesh.AddDistributor(new StandardDistributor()); WorldContainer = new WorldContainer(world, remesh, blockList, database); WorldContainer.BlockContainerProvider.OnBlockContainerCreated += OnChunkCreated; WorldContainer.BlockContainerProvider.OnBlockContainerDestroyed += OnChunkDestroyed; WorldContainer.RemeshHandler.OnRemeshFinish += OnRemeshFinished; }
/// <summary> /// Creates a new chunk group for remeshing. /// </summary> /// <param name="container">The world container being remeshed.</param> /// <param name="chunkPos">The position of the chunk to remesh.</param> internal ChunkGroup(WorldContainer container, ChunkPosition chunkPos) { for (int x = 0; x < 3; x++) { for (int y = 0; y < 3; y++) { for (int z = 0; z < 3; z++) { m_Chunks[x * 3 * 3 + y * 3 + z] = container.World.GetChunk(new ChunkPosition(x - 1, y - 1, z - 1) + chunkPos); } } } m_BlockList = container.BlockList; ChunkSize = container.World.ChunkSize; }
/// <summary> /// Displays the given planetoid's surface sunlight and radiation. /// </summary> /// <param name="world">The world to be displayed.</param> internal void AddSurfaceConditions(WorldContainer world) { var surfaceConditionRows = sis.surfaceConditionRows; var parent = sis.worldTraitsPanel.Content.gameObject; GameObject lights, rads; int n = surfaceConditionRows.Count; bool isNew = n < 2; for (int i = n; i < 2; i++) { surfaceConditionRows.Add(Util.KInstantiateUI(sis.iconLabelRow, parent, true)); } lights = surfaceConditionRows[0]; rads = surfaceConditionRows[1]; if (lights.TryGetComponent(out HierarchyReferences hr)) { var valueLabel = hr.GetReference <LocText>("ValueLabel"); if (isNew) { hr.GetReference <Image>("Icon").sprite = Assets.GetSprite("overlay_lights"); hr.GetReference <LocText>("NameLabel").SetText(STRINGS.UI.CLUSTERMAP. ASTEROIDS.SURFACE_CONDITIONS.LIGHT); valueLabel.alignment = TMPro.TextAlignmentOptions.MidlineRight; } valueLabel.SetText(GameUtil.GetFormattedLux(world.SunlightFixedTraits[world. sunlightFixedTrait])); } lights.transform.SetAsLastSibling(); if (rads.TryGetComponent(out hr)) { var valueLabel = hr.GetReference <LocText>("ValueLabel"); if (isNew) { hr.GetReference <Image>("Icon").sprite = Assets.GetSprite( "overlay_radiation"); hr.GetReference <LocText>("NameLabel").SetText(STRINGS.UI.CLUSTERMAP. ASTEROIDS.SURFACE_CONDITIONS.RADIATION); valueLabel.alignment = TMPro.TextAlignmentOptions.MidlineRight; } valueLabel.SetText(GameUtil.GetFormattedRads(world.CosmicRadiationFixedTraits[ world.cosmicRadiationFixedTrait])); } rads.transform.SetAsLastSibling(); }
/// <inheritdoc cref="IWorldTask"/> public void RunWorldTask(WorldContainer world) { BlockID = world.GetBlock(m_BlockPosition, m_CreateChunk); }
void Start() { enable = containers.ToArray()[0]; enable.selector.interactable = false; enable.stages.gameObject.SetActive(true); }
/// <inheritdoc cref="IWorldTask" /> public void RunWorldTask(WorldContainer world) { world.RemeshDirtyChunks(); }
/// <inheritdoc cref="IWorldTask"/> public void RunWorldTask(WorldContainer world) { world.SetBlock(m_BlockPosition, m_BlockID); }
public void Init(WorldContainer world, UIContainer gameInterface) { m_world = world; m_interface = gameInterface; }
public NexusServer(WorldContainer worldContainer) { this.worldContainer = worldContainer; }
/// <inheritdoc cref="IWorldTask" /> public void RunWorldTask(WorldContainer world) { world.SaveWorld(); }