示例#1
0
    public override void PlaceTile(TownManager tm, Map map, List <Tile> buildingTiles, int rotAmt, Vector2 curBuildRotScale)
    {
        ResourceTile rT = buildingTiles[0] as ResourceTile;

        rotatedScale = curBuildRotScale;
        CollectResourceBuildingTile bMain = new CollectResourceBuildingTile(buildingTiles[0].GetMapLoc(), buildingTiles[0].GetWorldLoc(), 'B', buildingTiles[0].GetTileObj(), this, rT.GetIsTrees());

        bMain.mapScript = map;
        bMain.tm        = tm;
        Vector2 tileMapPos             = buildingTiles[0].GetMapLoc();
        List <WorldResource> resources = rT.GetResourcesList();

        map.SetTileFromMapPos((int)tileMapPos.x, (int)tileMapPos.y, bMain);
        bMain.SetResourcesLeft(resources.Count);
        for (int i = 0; i < resources.Count; i++)
        {
            // Create a task for each tree and send it to the town manager citizenTasks list
            Queue <Target> taskQ = new Queue <Target>();
            Vector3        loc   = resources[i].GetResourceObject().transform.position;
            taskQ.Enqueue(new Target(loc, bMain, resources[i], null, 4f, false, true));
            taskQ.Enqueue(new Target(new Vector3(0, 0, 0), false));
            Task t = new Task(taskQ, true);
            tm.AddTask(t);
        }
    }