Beispiel #1
0
    void AddToConstructableTilesIfAvailable(int x, int y)
    {
        /* Attempts to add a new PotentialShipTile at (x, y).
         *
         * Only adds a new PST if no PST or ShipTile currently exists there.
         */
        ShipTile old_tile = player_ship.tilemap.Get(x, y);

        if (!old_tile)
        {
            if (!_ConstructableTiles.Exists(tile => tile.x == x && tile.y == y))
            {
                GameObject        potential_tile_obj = Instantiate(ParticleDict.get().potential_ship_tile) as GameObject;
                PotentialShipTile potential_tile     = potential_tile_obj.GetComponent <PotentialShipTile>();
                potential_tile.editor_index            = _ConstructableTiles.Count;
                potential_tile.transform.parent        = player_ship.transform;
                potential_tile.transform.localPosition = new Vector3(x, y, 0);
                TileCoordinates tile_coordinates = new TileCoordinates {
                    x = x,
                    y = y,
                    potential_tile = potential_tile
                };
                _ConstructableTiles.Add(tile_coordinates);
            }
        }
    }
Beispiel #2
0
    /* Private methods */

    void Start()
    {
        if (active_context_menu)
        {
            GameObject.Destroy(active_context_menu);
            active_context_menu = this;
        }
        int num_actions = actions.Count;

        for (int i = 0; i < num_actions; ++i)
        {
            GameObject ecma_gameobj = Instantiate(ParticleDict.get().editor_context_menu_action) as GameObject;
            ecma_gameobj.transform.parent        = transform;
            ecma_gameobj.transform.localPosition = Vector3.zero;
            actions[i].ConfigureRegion(i, num_actions, ecma_gameobj);
        }
    }