Ejemplo n.º 1
0
        public void CreateVoxelContents(IVoxel voxel, IGameVoxelType type)
        {
            voxel.Data.Type = type;

            type.OnCreated(voxel); // Maybe register this too as an event
            created.OnNext(voxel);
        }
        private void updateSelectedVoxelVisualizers()
        {
            var voxel = inputSim.GetTargetedVoxel();

            if (voxel != visualizedVoxel || (voxel != null && voxel.Type != visualizedType))
            {
                foreach (var v in visualizers)
                {
                    v.Hide();
                }
                visualizers.Clear();

                visualizedVoxel = null;
                visualizedType  = null;
                if (voxel != null && voxel.Type != null)
                {
                    visualizedVoxel = voxel;
                    visualizedType  = voxel.Type;
                    visualizers.AddRange(voxel.Type.GetInfoVisualizers(voxel));
                    foreach (var v in visualizers)
                    {
                        v.Show();
                    }
                }
            }

            foreach (var v in visualizers)
            {
                v.Update();
            }
        }
Ejemplo n.º 3
0
 /// <summary>
 /// This method changes the type of the given voxel, changing its contents
 /// </summary>
 public void ChangeType(IVoxel currentVoxel, IGameVoxelType type)
 {
     DestroyVoxelContents(currentVoxel);
     CreateVoxelContents(currentVoxel, type);
 }
Ejemplo n.º 4
0
 public RenderData(IRenderable[] visualizers, IGameVoxelType type)
 {
     Visualizers = visualizers;
     Type        = type;
 }
 public string Serialize(IGameVoxelType type)
 {
     return(type.Name);
 }
Ejemplo n.º 6
0
 public void ChangeType(IGameVoxelType type)
 {
     world.ChangeType(currentVoxel, type);
 }