public void Update()
        {
            var size = handle.GetBoundingBox().Maximum - handle.GetBoundingBox().Minimum;
            var bb   = handle.GetBoundingBox().GetCenter().ToBoundingBox(new Vector3((range + 0.5f) * size.X, 1, (range + 0.5f) * size.Z));

            TW.Graphics.LineManager3D.AddBox(bb, Color.Red);
        }
示例#2
0
        public static Matrix getItemCircleTransformation(int i, GameVoxel targetVoxel, float radiusScale)
        {
            var radius = targetVoxel.GetBoundingBox().Maximum.X - targetVoxel.GetBoundingBox().Minimum.X;

            radius *= radiusScale;
            var angle = MathHelper.TwoPi / targetVoxel.Data.Inventory.ItemCount * i;

            return(Matrix.Translation(new Vector3(Math.Cos(angle).ToF(), 0.5f, Math.Sin(angle).ToF()) * radius));
        }
        private void showDataValueRect(GameVoxel target, int value)
        {
            var max = target.GetBoundingBox().Maximum;
            var min = target.GetBoundingBox().Minimum;
            var pos = (max + min) * 0.5f + new Vector3(0, 6.5f, 0);

            dataValueRectangle.Position    = pos;
            dataValueRectangle.IsBillboard = true;
            dataValueRectangle.Text        = value.ToString();// target.DataValue.ToString();
            dataValueRectangle.Radius      = 3;
            dataValueRectangle.Update();
        }
        public void Update()
        {
            ValueControl.Value = getValue();
            var pos = voxel.GetBoundingBox().GetCenter() + new Vector2(0.5f).ToXZ();

            ValueControl.WorldMatrix = local * Matrix.Translation(pos);
            ValueControl.WorldMatrix = local * Matrix.Scaling(new Vector3(voxel.World.VoxelSize.X)) * Matrix.Translation(pos);
            ValueControl.Update();
        }
示例#5
0
        public void Update()
        {
            var center = handle.GetBoundingBox().GetCenter();
            var items  = handle.Data.Inventory.Items.ToArray();

            for (int i = 0; i < items.Length; i++)
            {
                var ent = getEntity(i);
                ent.Mesh        = items[i].Mesh;
                ent.WorldMatrix = ItemRelativeTransformationProvider(i) * Matrix.Translation(center);
                ent.Visible     = true;
            }
            for (int i = items.Length; i < entityCache.Length; i++)
            {
                var ent = getEntity(i);
                if (ent == null)
                {
                    continue;
                }
                ent.Visible = false;
            }
        }