/// <summary> /// 1. 创建墙 /// 2. 创建砖 /// 3. 创建草 /// 4. 创建河 /// </summary> private void CreateRandomMap() { int grassCount = Random.Range(15, 20); int wallCount = Random.Range(40, 60); int barrierCount = Random.Range(15, 30); int riverCount = Random.Range(15, 20); for (int i = 0; i < barrierCount; i++) { Vector3 pos = CreateRandomPosition(); MapFactory.CreateMapItem(GameConst.BarrierPrefab, pos, transform); } for (int i = 0; i < riverCount; i++) { Vector3 pos = CreateRandomPosition(); MapFactory.CreateMapItem(GameConst.RiverPrefab, pos, transform); } for (int i = 0; i < grassCount; i++) { Vector3 pos = CreateRandomPosition(); MapFactory.CreateMapItem(GameConst.GrassPrefab, pos, transform); } for (int i = 0; i < wallCount; i++) { Vector3 pos = CreateRandomPosition(); MapFactory.CreateMapItem(GameConst.WallPrefab, pos, transform); } }
private void CreateHome() { MapFactory.CreateMapItem(GameConst.HomePrefab, GameConst.HomeVector3, transform); MapFactory.CreateMapItem(GameConst.WallPrefab, GameConst.HomeVector3 - new Vector3(-1, 0, 0), transform); MapFactory.CreateMapItem(GameConst.WallPrefab, GameConst.HomeVector3 - new Vector3(1, 0, 0), transform); MapFactory.CreateMapItem(GameConst.WallPrefab, GameConst.HomeVector3 + new Vector3(0, 1, 0), transform); MapFactory.CreateMapItem(GameConst.WallPrefab, GameConst.HomeVector3 + new Vector3(1, 1, 0), transform); MapFactory.CreateMapItem(GameConst.WallPrefab, GameConst.HomeVector3 + new Vector3(-1, 1, 0), transform); }
private void CreatePlayer2() { MapFactory.CreateMapItem(GameConst.BornPrefab2, GameConst.Player2BornVector3, transform); }