Exemplo n.º 1
0
        public void MapTest()
        {
            WorldContainer map = new WorldContainer();
            Random         rng = new Random();

            map.InitMap(rng);
            map.DisplayMap();
        }
Exemplo n.º 2
0
        /// <inheritdoc cref="IWorldTask"/>
        public void RunWorldTask(WorldContainer world)
        {
            foreach (var block in m_EditBatch())
            {
                world.SetBlock(block.Position, block.BlockID);
            }

            world.RemeshDirtyChunks();
        }
Exemplo n.º 3
0
        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();
        }
Exemplo n.º 4
0
    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;
    }
Exemplo n.º 5
0
        /// <inheritdoc cref="IWorldTask"/>
        public void RunWorldTask(WorldContainer world)
        {
            if (world.DoesChunkExist(m_ChunkPosition))
            {
                return;
            }

            world.LoadChunk(m_ChunkPosition);
            WasJustLoaded = true;
        }
Exemplo n.º 6
0
        /// <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();
        }
Exemplo n.º 7
0
        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();
        }
Exemplo n.º 8
0
 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;
 }
Exemplo n.º 9
0
        /// <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;
        }
Exemplo n.º 10
0
        /// <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;
        }
Exemplo n.º 11
0
        /// <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();
        }
Exemplo n.º 12
0
 /// <inheritdoc cref="IWorldTask"/>
 public void RunWorldTask(WorldContainer world)
 {
     BlockID = world.GetBlock(m_BlockPosition, m_CreateChunk);
 }
Exemplo n.º 13
0
 void Start()
 {
     enable = containers.ToArray()[0];
     enable.selector.interactable = false;
     enable.stages.gameObject.SetActive(true);
 }
Exemplo n.º 14
0
 /// <inheritdoc cref="IWorldTask" />
 public void RunWorldTask(WorldContainer world)
 {
     world.RemeshDirtyChunks();
 }
Exemplo n.º 15
0
 /// <inheritdoc cref="IWorldTask"/>
 public void RunWorldTask(WorldContainer world)
 {
     world.SetBlock(m_BlockPosition, m_BlockID);
 }
Exemplo n.º 16
0
 public void Init(WorldContainer world, UIContainer gameInterface)
 {
     m_world     = world;
     m_interface = gameInterface;
 }
Exemplo n.º 17
0
 public NexusServer(WorldContainer worldContainer)
 {
     this.worldContainer = worldContainer;
 }
Exemplo n.º 18
0
 /// <inheritdoc cref="IWorldTask" />
 public void RunWorldTask(WorldContainer world)
 {
     world.SaveWorld();
 }