// Gets the shape of the bit protected void GetBitShapeString() { if (neighbourDependant) { string code = "x"; // Work out which neighbours are the same type as this bit for (int i = 0; i < 4; ++i) { if (neighbours[i].displayType == displayType) { neighboursSimilar[i] = true; code += (i + 1).ToString(); } else { neighboursSimilar[i] = false; } } if (code != "x") { wallShape = (BitShape)System.Enum.Parse(typeof(BitShape), code); } else { wallShape = BitShape.x0; } } }
// Get the sprite for a WallShape public Sprite GetWallShapeSprite(BitShape ws) { return(wallShapeSprites[ws]); }
// Add wall shape to dictionary public void AddWallShapeSprite(BitShape ws, Sprite sprite) { wallShapeSprites.Add(ws, sprite); }
// Gets the shape of the bit (badly) protected void GetWallType() { bool[] directions = new bool[4]; // Work out which neighbours are the same type as this bit for (int i = 0; i < 4; ++i) { if (neighbours[i].displayType == displayType) { directions[i] = true; } else { directions[i] = false; } } // Save data about neighbouring types if (directions[(int)Direction.up]) { if (directions[(int)Direction.right]) { if (directions[(int)Direction.down]) { if (directions[(int)Direction.left]) { wallShape = BitShape.x1234; } else { wallShape = BitShape.x123; } } else { if (directions[(int)Direction.left]) { wallShape = BitShape.x124; } else { wallShape = BitShape.x12; } } } else { if (directions[(int)Direction.down]) { if (directions[(int)Direction.left]) { wallShape = BitShape.x134; } else { wallShape = BitShape.x13; } } else { if (directions[(int)Direction.left]) { wallShape = BitShape.x14; } else { wallShape = BitShape.x1; } } } } else { if (directions[(int)Direction.right]) { if (directions[(int)Direction.down]) { if (directions[(int)Direction.left]) { wallShape = BitShape.x234; } else { wallShape = BitShape.x23; } } else { if (directions[(int)Direction.left]) { wallShape = BitShape.x24; } else { wallShape = BitShape.x2; } } } else { if (directions[(int)Direction.down]) { if (directions[(int)Direction.left]) { wallShape = BitShape.x34; } else { wallShape = BitShape.x3; } } else { if (directions[(int)Direction.left]) { wallShape = BitShape.x4; } else { wallShape = BitShape.x0; } } } } }