Exemplo n.º 1
0
    public void BuildBuilding(int type, int subtype, int index)
    {
        Entity t = TriIsleland.GetBuildingPrefabs(type, subtype, index);

        Selector.Instance.RequestLocation((Unit)selected, t.sizeType, new BuildCommand(t));
        Close();
    }
Exemplo n.º 2
0
    public static new BuildCommand Load(BinaryReader reader)
    {
        TriGrid      instance = TriGrid.Instance;
        TriCell      tCell    = instance.GetCell(TriCoordinates.Load(reader));
        TriDirection tDir     = (TriDirection)reader.ReadInt32();
        Entity       prefab   = TriIsleland.GetBuildingPrefabs(reader.ReadInt32(), reader.ReadInt32(), 0);

        return(new BuildCommand(tCell, tDir, prefab));
    }
Exemplo n.º 3
0
    void Awake()
    {
        DirectoryInfo di = new DirectoryInfo(Application.persistentDataPath + "/" + isleName);

        if (di.Exists == false)
        {
            di.Create();
        }
        Instance = this;
    }
Exemplo n.º 4
0
    public void CreateHall(TriDirection dir, TriCell cell)
    {
        Hall ret = (Hall)CreateBuilding(dir, cell, (Building)TriIsleland.GetBuildingPrefabs((int)BuildingType.HALL, (int)HallType.BASE, 0));

        if (ret)
        {
            TriIsleland.Instance.entities.camp = ret;
            for (int i = 0; i < 4; i++)
            {
                Unit t = CreateUnit(ret.EntranceLocation, (Unit)TriIsleland.GetUnitPrefabs((int)UnitType.PERSON, 0));
                ((Person)t).Home = null;
                t.AddCommand(new GetInCommand(ret));
            }
            ret.Working = true;
        }
    }
Exemplo n.º 5
0
    public static new Person Load(BinaryReader reader)
    {
        Person  ret  = Instantiate((Person)TriIsleland.GetUnitPrefabs((int)UnitType.PERSON, 0));
        TriCell tLoc = TriGrid.Instance.GetCell(TriCoordinates.Load(reader));

        if (tLoc)
        {
            ret.Home = (Inn)tLoc.Statics;
        }
        tLoc = TriGrid.Instance.GetCell(TriCoordinates.Load(reader));
        if (tLoc)
        {
            ret.Company = (Company)tLoc.Statics;
        }
        tLoc = TriGrid.Instance.GetCell(TriCoordinates.Load(reader));
        if (tLoc)
        {
            ret.Work = tLoc.Statics;
        }
        return(ret);
    }
Exemplo n.º 6
0
    public new static LoggingFacility Load(BinaryReader reader)
    {
        LoggingFacility ret = (LoggingFacility)Instantiate(TriIsleland.GetBuildingPrefabs((int)BuildingType.COMPANY, (int)CompType.CONSTRUCTOR, 0));

        return(ret);
    }
Exemplo n.º 7
0
 void SetTerrainType()
 {
     for (int i = 0; i < cellCount; i++)
     {
         TriCell cell = grid.GetCell(i), hexCell = grid.GetCell(TriMetrics.TriToHex(cell.coordinates));
         if (cell.coordinates == hexCell.coordinates)
         {
             float        moisture = climate[hexCell.Index].moisture;
             TriDirection d        = TriDirection.VERT;
             TriIsleland  isle     = TriIsleland.Instance;
             for (int j = 0; j < 6; j++)
             {
                 if (!cell)
                 {
                     break;
                 }
                 if (!cell.IsUnderwater)
                 {
                     if (cell.Elevation > 10)
                     {
                         cell.TerrainTypeIndex = 4;
                     }
                     else if (moisture < 0.02f)
                     {
                         cell.TerrainTypeIndex = 3;
                         if (Random.value < 0.5f && !cell.HasRiver)
                         {
                             Tree t = (Tree)Instantiate(TriIsleland.GetNaturalPrefabs((int)NaturalType.TREE, 0), isle.transform);
                             t.Location          = cell;
                             t.EntranceDirection = (TriDirection)((int)(Random.value * 3f));
                             entities.AddNatural(t);
                         }
                     }
                     else if (moisture < 0.12f)
                     {
                         cell.TerrainTypeIndex = 2;
                         if (Random.value < 0.2f && !cell.HasRiver)
                         {
                             Tree t = (Tree)Instantiate(TriIsleland.GetNaturalPrefabs((int)NaturalType.TREE, 0), isle.transform);
                             t.Location          = cell;
                             t.EntranceDirection = (TriDirection)((int)(Random.value * 3f));
                             entities.AddNatural(t);
                         }
                     }
                     else if (moisture < 0.20f)
                     {
                         cell.TerrainTypeIndex = 1;
                     }
                     else if (moisture < 0.85f)
                     {
                         cell.TerrainTypeIndex = 0;
                     }
                     else
                     {
                         cell.TerrainTypeIndex = 0;
                     }
                 }
                 else
                 {
                     cell.TerrainTypeIndex = 1;
                 }
                 cell = cell.GetNeighbor(d);
                 if (hexCell.inverted)
                 {
                     d = d.Next();
                 }
                 else
                 {
                     d = d.Previous();
                 }
             }
         }
     }
 }
Exemplo n.º 8
0
 public static new Camp Load(BinaryReader reader)
 {
     return(Instantiate((Camp)TriIsleland.GetBuildingPrefabs((int)BuildingType.HALL, (int)HallType.BASE, 0)));
 }
Exemplo n.º 9
0
 public static new Farmland Load(BinaryReader reader)
 {
     return(Instantiate((Farmland)TriIsleland.GetBuildingPrefabs((int)BuildingType.WORKSITE, (int)WorkType.FARMLAND, 0)));
 }
Exemplo n.º 10
0
    public new static Tree Load(BinaryReader reader)
    {
        Tree ret = Instantiate((Tree)TriIsleland.GetNaturalPrefabs((int)NaturalType.TREE, 0));

        return(ret);
    }
Exemplo n.º 11
0
 public static new Tent Load(BinaryReader reader)
 {
     return(Instantiate((Tent)TriIsleland.GetBuildingPrefabs((int)BuildingType.INN, (int)InnType.TENT, 0)));
 }
Exemplo n.º 12
0
    public new static Processor Load(BinaryReader reader)
    {
        Processor ret = (Processor)Instantiate(TriIsleland.GetBuildingPrefabs((int)BuildingType.COMPANY, (int)CompType.PROCESSOR, 0));

        return(ret);
    }
Exemplo n.º 13
0
    public new static WareHouse Load(BinaryReader reader)
    {
        WareHouse ret = (WareHouse)Instantiate(TriIsleland.GetBuildingPrefabs((int)BuildingType.COMPANY, (int)CompType.WAREHOUSE, 0));

        return(ret);
    }