Exemplo n.º 1
0
        private bool canPlacePiece(Vector2 pos, Block piece, float deg)
        {
            Vector2 dimensions = piece.getWidthHeight(deg);

            if (pos.x < 0 || pos.y < 0 || pos.x + dimensions.x > level.getWidth() || pos.y + dimensions.y > level.getHeight())
            {
                return(false);
            }
            level.removeBlock(piece);
            return(level.canSet((int)pos.x, (int)pos.y, piece, deg));
        }
Exemplo n.º 2
0
 private void makeGrid()
 {
     for (int x = 0; x < level.getWidth(); x++)
     {
         for (int z = 0; z < level.getHeight(); z++)
         {
             GameObject gridPlane = (GameObject)Instantiate(plane);
             gridPlane.transform.position = new Vector3(x,
                                                        0, z);
         }
     }
 }
Exemplo n.º 3
0
        // Use this for initialization
        void Start()
        {
            XmlDocument doc   = XmlHelper.getXml();
            Level       level = GameMode.getCurrentLevel();
            XmlNode     node  = doc.SelectSingleNode("//camera[@width = '" + level.getWidth() + "' and @height = '" + level.getHeight() + "']");

            if (node == null)
            {
                Debug.LogError("Please add the camera config in the xml file");
                return;
            }
            XmlNode position = node.SelectSingleNode("position");


            transform.position = new Vector3(float.Parse(position.Attributes ["x"].Value), float.Parse(position.Attributes ["y"].Value), float.Parse(position.Attributes ["z"].Value));
            GetComponent <Camera> ().orthographicSize = float.Parse(position.Attributes ["size"].Value);
        }
Exemplo n.º 4
0
 private void setEnd(int loc, Level level)
 {
     level.setEnd(getPos(level.getWidth(), level.getHeight(), loc));
 }
Exemplo n.º 5
0
 private bool isValidPos(int x, int y, ref Level level)
 {
     return(x < level.getWidth() && y < level.getHeight() && x >= 0 && y >= 0);
 }