Exemple #1
0
        /// <summary>
        ///     Makes a copy of this object.
        /// </summary>
        /// <param name="blockStructure">The BlockStructure</param>
        /// <param name="pos">The position</param>
        /// <returns>The new copy</returns>
        public virtual Block DeepCopy(BlockStructure blockStructure, Vector3 pos)
        {
            var arguments = new object[2];

            arguments[0] = blockStructure;
            arguments[1] = pos;
            var block = (Block)Activator.CreateInstance(GetType(), arguments);

            block.SlopeType = SlopeType;
            return(block);
        }
Exemple #2
0
        public static Block Build(BlockStructure blockStructure, Vector3 position)
        {
            var slopeType = 0;
            for (var i = 2; i < 8; i++)
            {
                if (BitHelper.CheckBit(blockStructure.SlopeType, i))
                    slopeType += (int)Math.Pow(2, i - 2);
            }

            foreach(var block in _blocks)
                if (block.IsSlopeOf((SlopeType)slopeType))
                    return block.DeepCopy(blockStructure, position);

            //return new CubeBlock(blockStructure, position);    //Hack until all the different _blocks are implemented.
            throw new NotSupportedException("Slope Type " + slopeType + " not implemented!"); // <- Must be this.
        }
Exemple #3
0
 protected Block(BlockStructure blockStructure, Vector3 pos)
 {
     BlockStructure = blockStructure;
     Left = new BlockFaceEdge(blockStructure.Left);
     Right = new BlockFaceEdge(blockStructure.Right);
     Top = new BlockFaceEdge(blockStructure.Top);
     Bottom = new BlockFaceEdge(blockStructure.Bottom);
     Lid = new BlockFaceLid(blockStructure.Lid);
     Arrows = (RoadTrafficType) blockStructure.Arrows;
     ParseSlope(blockStructure.SlopeType);
     Position = pos;
     Coors = new List<VertexPositionNormalTexture>();
     IndexBufferCollection = new List<int>();
     Left.FixTileWallCollision();
     Right.FixTileWallCollision();
     Top.FixTileWallCollision();
     Bottom.FixTileWallCollision();
 }
Exemple #4
0
 protected Block(BlockStructure blockStructure, Vector3 pos)
 {
     BlockStructure = blockStructure;
     Left           = new BlockFaceEdge(blockStructure.Left);
     Right          = new BlockFaceEdge(blockStructure.Right);
     Top            = new BlockFaceEdge(blockStructure.Top);
     Bottom         = new BlockFaceEdge(blockStructure.Bottom);
     Lid            = new BlockFaceLid(blockStructure.Lid);
     Arrows         = (RoadTrafficType)blockStructure.Arrows;
     ParseSlope(blockStructure.SlopeType);
     Position = pos;
     Coors    = new List <VertexPositionNormalTexture>();
     IndexBufferCollection = new List <int>();
     Left.FixTileWallCollision();
     Right.FixTileWallCollision();
     Top.FixTileWallCollision();
     Bottom.FixTileWallCollision();
 }
Exemple #5
0
        public static Block Build(BlockStructure blockStructure, Vector3 position)
        {
            var slopeType = 0;

            for (var i = 2; i < 8; i++)
            {
                if (BitHelper.CheckBit(blockStructure.SlopeType, i))
                {
                    slopeType += (int)Math.Pow(2, i - 2);
                }
            }

            foreach (var block in _blocks)
            {
                if (block.IsSlopeOf((SlopeType)slopeType))
                {
                    return(block.DeepCopy(blockStructure, position));
                }
            }

            //return new CubeBlock(blockStructure, position);    //Hack until all the different _blocks are implemented.
            throw new NotSupportedException("Slope Type " + slopeType + " not implemented!"); // <- Must be this.
        }
Exemple #6
0
 protected DiagonalBlock(BlockStructure blockStructure, Vector3 pos) : base(blockStructure, pos)
 {
     //
 }
Exemple #7
0
 /// <summary>
 ///     Makes a copy of this object.
 /// </summary>
 /// <param name="blockStructure">The BlockStructure</param>
 /// <param name="pos">The position</param>
 /// <returns>The new copy</returns>
 public virtual Block DeepCopy(BlockStructure blockStructure, Vector3 pos)
 {
     var arguments = new object[2];
     arguments[0] = blockStructure;
     arguments[1] = pos;
     var block = (Block) Activator.CreateInstance(GetType(), arguments);
     block.SlopeType = SlopeType;
     return block;
 }
Exemple #8
0
 protected DiagonalBlock(BlockStructure blockStructure, Vector3 pos) : base(blockStructure, pos)
 {
     //
 }
Exemple #9
0
 protected SlopeBlock(BlockStructure blockStructure, Vector3 pos) : base(blockStructure, pos)
 {
     //
 }
Exemple #10
0
 protected SlopeBlock(BlockStructure blockStructure, Vector3 pos) : base(blockStructure, pos)
 {
     //
 }