public void LoadBox(List <Vector3> emptySpace, int randomNumber, Level level) { LoadObject loadboxx = new LoadObject(); GameObject cubebox = loadboxx.LoadBox(); WaysPlayer waysPlayer = new WaysPlayer(); Vector3 vectorPlayZ = new Vector3(0, 0, 11); Vector3 vectorPlayX = new Vector3(11, 0, 0); Vector3 vectorPlayLocal = emptySpace[randomNumber]; int numberEmptyCall; emptySpace.RemoveAt(randomNumber); waysPlayer.SearchWayzPlayer(ref emptySpace, vectorPlayLocal, vectorPlayZ, vectorPlayX, Operation.Add); waysPlayer.SearchWayzPlayer(ref emptySpace, vectorPlayLocal, vectorPlayZ, vectorPlayX, Operation.Compute); waysPlayer.SearchWayzPlayer(ref emptySpace, vectorPlayLocal, vectorPlayX, vectorPlayZ, Operation.Add); waysPlayer.SearchWayzPlayer(ref emptySpace, vectorPlayLocal, vectorPlayX, vectorPlayZ, Operation.Compute); numberEmptyCall = emptySpace.Count; int numberBox = numberEmptyCall * level.GetHashCode() / 100; for (int i = 0; i < numberBox; i++) { int ii = emptySpace.Count; int ranNumber = Random.Range(0, ii - 1); Instantiate(cubebox, emptySpace[ranNumber], Quaternion.identity); emptySpace.RemoveAt(ranNumber); } foreach (Vector3 vector in WaysPlayer.Костылек) { Field.emptySpace.Add(vector); } }
public void StartLoadField(int widthX, int lengthY, Level level) { LoadObject loadObject = new LoadObject(); GameObject plane = loadObject.LoadPlane(); GameObject wall = loadObject.LoadCube(); GameObject cylinder = loadObject.LoadCylinder(); GameObject cubebox = loadObject.LoadBox(); GameObject player = loadObject.LoadPlayer(); //List<Vector3> emptySpace = new List<Vector3>(); int width = widthX; int length = lengthY; int indexX = 0; int indexZ = 0; LoadWall(wall, emptySpace, width, length, ref indexX, ref indexZ); int numberEmpty = emptySpace.Count; LoadField(plane, width, length, indexX, indexZ); int randomNumber = Random.Range(0, numberEmpty - 1); Instantiate(player, emptySpace[randomNumber], Quaternion.identity); /* EnemyControl enemy = new EnemyControl(); * enemy.LoadEnemy(emptySpace);*/ TestMoveEnemy enemy = new TestMoveEnemy(); enemy.LoadEnemy(emptySpace); Box Box = new Box(); Box.LoadBox(emptySpace, randomNumber, level); Gains gains = new Gains(); gains.LoadGains(emptySpace); }