/// <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); }
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. }
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(); }
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(); }
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. }
protected DiagonalBlock(BlockStructure blockStructure, Vector3 pos) : base(blockStructure, pos) { // }
/// <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; }
protected SlopeBlock(BlockStructure blockStructure, Vector3 pos) : base(blockStructure, pos) { // }