// Update is called once per frame async void Start() { MapGenerate mapGenerate = new MapGenerate(width, length, heigh); ////礦物 //for (int i = 0; i < y; ++i) //{ // IList<(Vector3 pos, float perlinNoise)> stonePoints = mapGenerate.CreateSurfacePositions(x, z, densityRefinement, 0, 0, 1); // foreach (var stonePoint in stonePoints) // { // if (stonePoint.perlinNoise * Mathf.Pow(densityRefinementDiminishing, i + 1) >= stoneDensity) // { // TileDetail tileDetail = tileDetails[(int)stonePoint.pos.x, i, (int)stonePoint.pos.z]; // if (tileDetail.tileType != eTileType.None && i + 1 < y && tileDetails[(int)stonePoint.pos.x, i + 1, (int)stonePoint.pos.z].tileType != eTileType.None) // tileDetails[(int)stonePoint.pos.x, i, (int)stonePoint.pos.z].tileType = eTileType.Stone; // } // } //} ////水 //for (int i = 0; i < x; ++i) // for (int j = 0; j < y; ++j) // for (int k = 0; k < z; ++k) // { // //海拔以下,正上方為空 // if (j <= altitude && tileDetails[i, j, k].tileType != eTileType.None && j + 1 < y && tileDetails[i, j + 1, k].tileType == eTileType.None) // tileDetails[i, j, k].tileType = eTileType.Water; // } await mapDrawer.DrawMap(mapGenerate.Generate()); }
// Use this for initialization void Start() { HPBar = GameObject.FindGameObjectWithTag("HPBar"); HP = maxHP; rb2D = GetComponent <Rigidbody2D>(); spr2D = GetComponent <SpriteRenderer>(); mg = GameObject.FindGameObjectWithTag("Map Generator").GetComponent <MapGenerate>(); distToGround = bc2D.bounds.extents.y * 1.5f; minPositionY = Camera.main.ViewportToWorldPoint(new Vector2(0, 0)).y; maxPositionY = Camera.main.ViewportToWorldPoint(new Vector2(0, 1)).y; portalPos1 = mg.pos1; portalPos2 = mg.pos2; normsize = bc2D.size; fallsize = new Vector2(normsize.x * 1.3f, normsize.y * 1.3f); originalJumpSpeed = jumpSpeed; isMine = photonView.isMine; if (!isMine) { GetComponent <Rigidbody2D>().isKinematic = true; } else { StartCoroutine(Invin()); GetMyEmoji(); photonView.RPC("setName", PhotonTargets.All, PhotonNetwork.playerName); HPBar.GetComponent <HPController> ().show(maxHP); } }
public override void OnInspectorGUI() { base.OnInspectorGUI(); MapGenerate map = target as MapGenerate; map.GenerateMap(); }
void InitialiseDungeon() { int sizemultiplier = tileSize * roomSize; // Initialise dungeon layout dungeon = new Room[gridSize, gridSize]; // Populate dungeon array for (int iZ = 0; iZ < dungeon.GetLength(1); iZ++) { for (int iX = 0; iX < dungeon.GetLength(0); iX++) { dungeon[iX, iZ] = new Room(); } } // Start runnin' and populate array with basic dungeon if (runnersKnowDirection == true) // runner knows it's previous direction { for (int i = 0; i < runners; i++) { dungeon = MapGenerate.RunnerNoBacktrack(dungeon, new Vector2(gridSize / 2, gridSize / 2), Random.Range(5, maxDistance + 1), MapGenerate.RandomDirVector()); } } else { for (int i = 0; i < runners; i++) // runner doesnt know it's previous direction { dungeon = MapGenerate.RunnerBasic(dungeon, new Vector2(gridSize / 2, gridSize / 2), Random.Range(5, maxDistance + 1)); } } // Add extra Rooms to array MapGenerate.PlaceStart(dungeon); MapGenerate.PlaceSpecial(dungeon); // Assign Room Assets RoomFunctions.AssignRoomTypes(dungeon, roomSet); // Place Placeholders if (!drawBasic) { roomsList = DungeonSpawner.DrawLayout(dungeon, this.transform.position, this.transform, drawEmptyRooms, emptyTile); } else { roomsList = DungeonSpawner.DrawBasic(dungeon, tile, this.transform.position, sizemultiplier, this.transform, drawEmptyRooms, emptyTile); } //Generating Start Room //Instantiate(tile, new Vector3(gridsizeX / 2, 0, gridsizeZ / 2), Quaternion.identity); }
void Start() { DungeonInfo = GameObject.Find("MapGenerator"); dungeon = DungeonInfo.GetComponent <MapGenerate>(); firstSet = true; pathCount = 0; energyCountAll = 0; CountManager = GameObject.Find("CountManager"); variousCount = CountManager.GetComponent <VariousCount>(); MainCamera = GameObject.Find("MainCamera"); playerController = MainCamera.GetComponent <PlayerController>(); }
void Start() { // 自分のRigidbodyを取ってくる m_Rigidbody = GetComponent <Rigidbody>(); //振り返るボタンの表示非表示をするため取得 LookBackButton = GameObject.Find("LookBackButton"); //マップ内で壁か通路かを確認するために取得 //開始時の正面が壁じゃないようにするためにやってみた DungeonInfo = GameObject.Find("MapGenerator"); mapGenerateScript = DungeonInfo.GetComponent <MapGenerate>(); player = new BGMPlayer("Nyonnyonyomo"); player.playBGM(); }
void MapGens(GameObject InstaMaps, StageComp Comps) { int Length = 0, Height = 0; Player = GameObject.Find("Player"); Player.GetComponent <Rigidbody2D>().velocity = new Vector2(0, 0); MapGenerate[] Maps = Comps.Map; int i = 0; currentMap = new MapGenerate[Maps.Length]; //生成するマップを現在マップに設定。 for (i = 0; i < Maps.Length; i++) { MapGenerate Map = Maps[i]; if (Map.gameObject.GetComponent <CsvReader>() != null) { MapData = Map.gameObject.GetComponent <CsvReader>(); } MapData.CsvResource = Map.MapResourceCSS; MapData.ReadData(); Length = MapData.csvDatas[0].Length; Debug.Log("X : " + MapData.csvDatas[0].Length); Height = MapData.csvDatas.ToArray().Length; Debug.Log("Y : " + MapData.csvDatas.ToArray().Length); baseSprite = Map.DefaultTile.GetComponent <SpriteRenderer>().sprite; InstMap = Instantiate(Map.gameObject); currentMap[i] = InstMap.GetComponent <MapGenerate>(); } MapLength = Length; MapHeight = Height; Vector2 TransitWorldpos = new Vector2((TransitTo.x - Length / 2f) * baseSprite.bounds.size.x, (Height / 2f - TransitTo.y) * baseSprite.bounds.size.y); Player.transform.position = TransitWorldpos; Debug.Log("Instaned"); }
private void Awake() { Instance = this; }