Example #1
0
    public override void OnSelected()
    {
        SomePrefab.GetComponent <MeshFilter>().mesh = MeshGenerator.GenerateCubeMesh(3, new Vector3(20, 10, 20));
        TerrainManager.ApplyTerrainToMesh(SomePrefab.GetComponent <MeshFilter>().mesh, _gridPosition, 0, new IntVector2(1, 1), false);
        SomePrefab.GetComponent <MeshRenderer>().materials = new[] { _mat };

        SomePrefab.GetComponent <MeshRenderer>().enabled = true;
    }
    public override void OnSelected()
    {
        SomePrefab.GetComponent <MeshRenderer>().enabled = true;
        _currentTile = SomePrefab.GetComponent <Tile>();
        _currentTile.SetupTile(new TrackTileSavable(), new IntVector2(1, 1), new IntVector2(0, 0), TerrainManager, "field.cfl");

        SelectTile(1);
    }
Example #3
0
 public override void OnMouseOverTile(IntVector2 point)
 {
     if (_gridPosition.x != point.x || _gridPosition.y != point.y)
     {
         _gridPosition = point;
         SomePrefab.transform.position = new Vector3(point.x * TrackManager.TileSize, 5, -1 * point.y * TrackManager.TileSize);
         SomePrefab.GetComponent <MeshFilter>().mesh = MeshGenerator.GenerateCubeMesh(3, new Vector3(20, 10, 20));
         TerrainManager.ApplyTerrainToMesh(SomePrefab.GetComponent <MeshFilter>().mesh, _gridPosition, 0, new IntVector2(1, 1), false);
     }
 }
    private void SelectTile(int i)
    {
        ShowTiles(_gridPosition, _currentTile.Size, true);

        SelectedTileId = i;

        TileManager.LoadModelForTileId(i);

        Mesh m = TileManager.TileList[i].Model.CreateMesh();

        SomePrefab.GetComponent <MeshFilter>().mesh    = m;
        SomePrefab.GetComponent <Renderer>().materials = TileManager.TileList[i].Materials.ToArray();

        SomePrefab.position = new Vector3(SomePrefab.position.x, TileManager.TileList[i].Model.P3DMeshes[0].Height / 2, SomePrefab.position.z);

        _currentTile.SetupTile(new TrackTileSavable(), TileManager.TileList[i].Size, _gridPosition, TerrainManager, TileManager.TileList[i].Name);
        _currentTile.SetOriginalVertices(m.vertices);
        _currentTile.ApplyTerrain();

        ShowTiles(_gridPosition, _currentTile.Size, false);
    }
Example #5
0
 public override void OnDeselected()
 {
     SomePrefab.GetComponent <MeshRenderer>().enabled = false;
 }
    public override void OnDeselected()
    {
        SomePrefab.GetComponent <MeshRenderer>().enabled = false;

        ShowTiles(_gridPosition, _currentTile.Size, true);
    }