예제 #1
0
    void Start()
    {
        objectCount = new Dictionary <string, int>();
        paletteMenu.SetActive(false);
        tileTypes = LevelParse.GetTileTypes();
        buttons   = new List <GameObject>();
        RectTransform rt;

        GameObject currentPlayerButton = Instantiate(playerButton, paletteMenuContent.transform);

        currentPlayerButton.GetComponent <PlayerButton>().SetValues(
            "Player", player.GetComponent <SpriteRenderer>().sprite,
            moveLayerPreview, "Player", draw);
        currentPlayerButton.GetComponent <PlayerButton>().SetPlayerValues(
            player.GetComponent <PlayerMovement>().speed, player.GetComponent <PlayerController>().jumpHeight, player);
        buttons.Add(currentPlayerButton);
        for (int i = 0; i < tileTypes.Length; i++)
        {
            GameObject currentButton = Instantiate(paletteButton, paletteMenuContent.transform);
            currentButton.GetComponent <PaletteButton>().SetValues(
                tileTypes[i], Resources.Load <Sprite>("Tiles/" + tileTypes[i] + "/_" + tileTypes[i] + "_1"),
                moveLayerPreview, tileTypes[i], draw);
            currentButton.GetComponent <PaletteButton>().SetPaletteValues(typeColors, draw);

            rt = currentButton.gameObject.GetComponent <RectTransform>();
            Vector3 destination = paletteButton.GetComponent <RectTransform>().position +
                                  new Vector3(paletteMenuContent.GetComponent <RectTransform>().rect.width / 2, 0, 0) +
                                  paletteMenuContent.GetComponent <RectTransform>().position +
                                  new Vector3(0, draw.GetLayerIndex(tileTypes[i]) * -80f, 0);

            rt.position = destination;
            buttons.Add(currentButton);
        }
        paletteSelect.transform.SetAsFirstSibling();
    }
예제 #2
0
    void Start()
    {
        tileTypes            = LevelParse.GetTileTypes();
        loadedTilesFull      = new Dictionary <string, Tile>();
        loadedTilesSemisolid = new Dictionary <string, Tile>();
        loadedTilesOutline   = new Dictionary <string, Tile>();
        tileVariations       = LevelParse.GetTileVariations();
        tileSizes            = LevelParse.LoadTileData("sizes");
        tileUpdateRadiuses   = LevelParse.LoadTileData("update_radiuses");
        tilemaps             = new Dictionary <string, Tilemap>();
        layers         = new Dictionary <string, GameObject>();
        paletteTypes   = new Dictionary <string, PaletteType>();
        tiles          = new Dictionary <string, List <Vector3Int> >();
        currentTool    = Tools.Draw;
        currentPalette = 0;
        currentLayer   = "Player";
        rect           = new GameObject("Rect");
        rect.AddComponent <RectDraw>();
        rect.transform.parent = transform;
        camBoundsRect         = new GameObject("CamBoundsRect");
        camBoundsRect.AddComponent <RectDraw>();
        camBoundsRect.transform.parent = transform;

        LoadTiles();
        New();
    }
예제 #3
0
 public void SetValues(string name, RectTransform moveLayerPreview, LevelDraw draw)
 {
     rt                    = GetComponent <RectTransform>();
     parentRt              = transform.parent.GetComponent <RectTransform>();
     contentRt             = parentRt.transform.parent.GetComponent <RectTransform>();
     action                = draw.MoveLayer;
     m_Name                = name;
     this.moveLayerPreview = moveLayerPreview;
     this.draw             = draw;
     nButtons              = LevelParse.GetTileTypes().Length;
 }
예제 #4
0
 void Start()
 {
     text      = GetComponent <Text>();
     tileTypes = LevelParse.GetTileTypes();
 }