// Update is called once per frame void FixedUpdate() { timeUntilRadar -= Time.deltaTime; if (timeUntilRadar <= 0) { timeUntilRadar = maxTimeBetweenRadar; for (int iStatIndex = 0; iStatIndex < levelGen.islandStats.Count; iStatIndex++) { IslandStats iStat = levelGen.islandStats[iStatIndex]; for (int iIndex = 0; iIndex < iStat.islands.Count; iIndex++) { IslandGen i = iStat.islands[iIndex]; if (Vector3.Distance(transform.position, i.transform.position) >= maxDistance) { i.SetFar(true); } else { i.SetFar(false); } } } } }
// Use this for initialization void Awake() { islandGen = GetComponent <IslandGen> (); timeUntilItemSpawn = Random.Range(0, maxTimeUntilItemSpawn); items = new List <GameObject> (); itemDatabase = GameObject.Find("Main").GetComponent <ItemDatabase> (); }
// Use this for initialization void Start () { vikingsInc = 10; sheepInc = 10; vikingsNum = 20; sheepNum = 20; vikingsPer = 10; incTime = Time.time; incTimeVal = 20; townNum = 0; farmNum = 0; dockNum = 0; maxThings = 5; Texture2D texture = new IslandGen(1024, 256, 1.5f).texture; this.renderer.material.mainTexture = texture; texture.Apply(); dockPos[0] = (new Vector3(this.transform.localScale.x * 4,0,0)); dockPos[1] = (new Vector3(-this.transform.localScale.x * 5,0,0)); dockPos[2] = (new Vector3(0,0,-this.transform.localScale.x * 4)); dockPos[3] = (new Vector3(0,0,this.transform.localScale.x * 4)); dockPos[4] = (new Vector3(this.transform.localScale.x * 3,0,this.transform.localScale.x * 3)); dockRot[0] = new Vector3(0,0,0); dockRot[1] = new Vector3(0,180,0); dockRot[2] = new Vector3(0,90,0); dockRot[3] = new Vector3(0,-90,0); dockRot[4] = new Vector3(0,-45,0); farmGrid[0] = new Vector3(-10,0,-4); farmGrid[1] = new Vector3(-10,0,-2); farmGrid[2] = new Vector3(-10,0,0); farmGrid[3] = new Vector3(-10,0,2); farmGrid[4] = new Vector3(-10,0,4); townGrid[0] = new Vector3(-12,0,-4); townGrid[1] = new Vector3(-12,0,-2); townGrid[2] = new Vector3(-12,0,0); townGrid[3] = new Vector3(-12,0,2); townGrid[4] = new Vector3(-12,0,4); addFarm(); sheepNum+=farmPrice; addTown(); sheepNum+=farmPrice; }
public void GenerateIsland(int rings, float radius, float A, IslandStats i) { GameObject tempObject = (GameObject)GameObject.Instantiate(islandPrefab); tempObject.transform.parent = this.transform; IslandGen tempIsland = tempObject.GetComponent <IslandGen>(); tempIsland.rings = rings; tempIsland.size = rings * 2 - 1; tempIsland.radius = radius; tempIsland.bringInTime = tempIsland.maxBringInTime; tempIsland.transform.rotation = Quaternion.Euler(new Vector3(Random.Range(0, 360), Random.Range(0, 360), Random.Range(0, 360))); //tempIsland.iStats = i; tempIsland.iStatsIndex = islandStats.IndexOf(i); //tempIsland.SetBaseHeight (i.baseLayerHeight); i.islands.Add(tempIsland); allIslands.Add(tempIsland); i.areaUsed += A; tempIsland.randomSeed = (int)System.DateTime.Now.Ticks; NetworkServer.Spawn(tempIsland.gameObject); }
void Awake() { Texture2D texture = new IslandGen(1024, 256, 1.5f).texture; this.renderer.material.mainTexture = texture; texture.Apply(); }
public void AddOneIsland(IslandGen i) { allIslands.Add(i); }
static void Main(string[] args) { var island = new IslandGen(); // create an island class island.InteractiveMapCreation(32, 32, .5f, 5, 2, false); }