예제 #1
0
파일: Townv2.cs 프로젝트: Xenation/ProcGen
 public bool HasLinkTo(Townv2 to)
 {
     foreach (TownLink lnk in links)
     {
         if (lnk.IsLinkingTown(to))
         {
             return(true);
         }
     }
     return(false);
 }
예제 #2
0
파일: TownGen.cs 프로젝트: Xenation/ProcGen
 private void CreateTowns()
 {
     for (int i = 0; i < townDensity; i++)
     {
         Vector3    townPosition = new Vector3(Random.Range(0f, terrainGen.chunkSize.x * terrainGen.chunksX), 0f, Random.Range(0f, terrainGen.chunkSize.y * terrainGen.chunksZ));
         RaycastHit hit;
         if (terrainGen.DownRaycast(townPosition, out hit) && hit.point.y > terrainGen.waterLevel + terrainGen.shoreHeight && Vector3.Dot(Vector3.up, hit.normal) > townSlopeThreashold)
         {
             townPosition.y = hit.point.y;
             towns.Add(Townv2.CreateNew(this, townContainer.transform, townPosition, null));
         }
     }
 }
예제 #3
0
파일: Townv2.cs 프로젝트: Xenation/ProcGen
        public static Townv2 CreateNew(TownGen gen, Transform parent, Vector3 position, GameObject debug)
        {
            GameObject go = new GameObject("Town");

            go.transform.SetParent(parent);
            go.transform.position = position;
            if (debug != null)
            {
                Instantiate(debug, go.transform).transform.localPosition = Vector3.zero;
            }
            Townv2 town = go.AddComponent <Townv2>();

            town.Init(gen);
            return(town);
        }
예제 #4
0
 public Townv2 Other(Townv2 t)
 {
     return((t == town1) ? town2 : town1);
 }
예제 #5
0
 public bool IsLinkingTown(Townv2 town)
 {
     return(town1 == town || town2 == town);
 }
예제 #6
0
 public TownLink(Townv2 t1, Townv2 t2)
 {
     town1       = t1;
     town2       = t2;
     RoadCreated = false;
 }