예제 #1
0
    public override void PlaceTile(TownManager tm, Map map, List <Tile> buildingTiles, int rotAmt, Vector2 curBuildRotScale)
    {
        CropBuildingTile bMain = new CropBuildingTile(buildingTiles[0].GetMapLoc(), buildingTiles[0].GetWorldLoc(), 'B', null, new Vector2(1, 1), this);

        bMain.rotatedScale = curBuildRotScale;
        Vector3    pos            = buildingTiles[0].GetWorldLoc();
        Vector2    tileMapPos     = buildingTiles[0].GetMapLoc();
        Vector3    adjustedObjPos = new Vector3(pos.x + 0.5f, 0, pos.z + 0.5f);
        Quaternion tileRot        = Quaternion.Euler(0, 90 * rotAmt + 90, 0);
        GameObject newTileObj;

        buildingTiles[0].DestroyTileObject();
        newTileObj = (GameObject)GameObject.Instantiate(tileStages[0].tilePrefabs[0], adjustedObjPos, tileRot);
        newTileObj.transform.parent = map.gameObject.transform;
        bMain.SetTileObj(newTileObj);
        map.SetTileFromMapPos((int)tileMapPos.x, (int)tileMapPos.y, bMain);
        bMain.PlacedTile();
        tm.AddBuilding(bMain);
    }
예제 #2
0
 public CropBuildingTile(Vector2 mapLoc, Vector3 worldLoc, char type, GameObject tileObj, Vector2 scale, CropBuildingTile tileToCopy)
     : base(mapLoc, worldLoc, type, tileObj, scale)
 {
     CopyTile(tileToCopy);
     this.crop       = tileToCopy.GetCrop();
     this.growTime   = tileToCopy.GetGrowTime();
     this.stageTimes = tileToCopy.GetStageTimes();
 }