コード例 #1
0
    MapSection GenerateSection(int id)
    {
        GlobalSectionCell section    = sectionPositioner.DefineSection(id);
        MapSection        NewSection = new MapSection(id, section);

        return(NewSection);
    }
コード例 #2
0
    public GlobalSectionCell DefineSection(int SectionId)
    {
        GlobalSectionCell definedSection = new GlobalSectionCell(Vector3.zero, 0, 0);

        if (SectionId == 1)
        {
            definedSection.Xsize = _mapData.StartingSecionSize;
            definedSection.Ysize = _mapData.StartingSecionSize;
        }

        else
        {
            definedSection.Xsize = UnityEngine.Random.Range(_mapData.MinSectionSize, _mapData.MaxSectionSize + 1);
            definedSection.Ysize = UnityEngine.Random.Range(_mapData.MinSectionSize, _mapData.MaxSectionSize + 1);
        }

        Vector2 localNewPosition  = FindNearestLocalPlace();
        MapCell localSectionPivot = new MapCell((int)localNewPosition.x, (int)localNewPosition.y);

        definedSection.Position = ConvertLocalToGlobal(localNewPosition);
        LocallSectionCell definedLocalSection = new LocallSectionCell(localSectionPivot, definedSection.Xsize, definedSection.Ysize);

        definedSection = BuildLocalSection(SectionId, definedLocalSection);

        ClearUpPlaces();

        return(definedSection);
    }
コード例 #3
0
ファイル: MapSection.cs プロジェクト: PakonAges/IdleTD
 public MapSection(int id, GlobalSectionCell section)
 {
     SectionId         = id;
     PivotPosition     = section.Position;
     Xsize             = section.Xsize;
     Ysize             = section.Ysize;
     SectionTopography = new TileType[Xsize, Ysize];
 }