Ejemplo n.º 1
0
    private void CreateTile(int x, int y)
    {
        GameObject tileTemplate = null;
        int        id           = GameManager.Instance.Map.GetNodeID(x, y);
        PMNode     node         = GameManager.Instance.Map[id];

        TileExtractor te = _tileTypes[(int)node.CType];

        DestroyTile(id);

        if (te == null)
        {
            tileTemplate = null;
        }
        else if (te as TEDouble16 != null)
        {
            tileTemplate = GetTile(x, y, te as TEDouble16);
        }
        else if (te as TESingle != null)
        {
            tileTemplate = GetTile(x, y, te as TESingle);
        }

        if (tileTemplate != null)
        {
            _mapCellVis[id]      = Instantiate(tileTemplate, new Vector3(x, y, 0), Quaternion.identity) as GameObject;
            _mapCellVis[id].name = "Tile_x " + x + "_y " + y;
            _mapCellVis[id].transform.SetParent(this.transform);
        }
    }
    private PMNode GetNode(string s)
    {
        PMNode node = new PMNode();

        switch (s)
        {
        case "W": node.CType = CellType.Wall; break;

        case "o": node.CType = CellType.Point; break;

        case "A": node.CType = CellType.Energizer; break;

        case "D": node.CType = CellType.Door; break;

        case "T": node.CType = CellType.Tunnel; break;

        case "G": node.CType = CellType.GhostHome; break;

        case "P": node.CType = CellType.PacManSpawn; break;

        case "E": node.CType = CellType.HomeEnter; break;
        }
        return(node);
    }