public void ResetGameLevel() { swarm.ResetAllPools(); mazeHolder = new MazeHolder(game_plane_width, game_plane_height); swarm.PopulateMazeObjects(mazeHolder.Mazes); kills_counter = 0; GAME_LEVEL = 0; SendMessage(new OnHeroLevelUP { achievedLevel = GAME_LEVEL, NextLevelTargetKills = GAME_LEVELUP_KILLS }); }
// Use this for initialization void Start () { // Генерирует Plane в осях: width => X, heigth => Z, перпендикуляр (высота) => Y plane_obj = GameFieldGenerator.GenPlane(game_plane_width, game_plane_height, cellSize, plane_material);//new GameObject();//GameObject.CreatePrimitive(PrimitiveType.Plane); plane_obj.layer = LayerMask.NameToLayer("enviorment"); var bxc=plane_obj.AddComponent<BoxCollider>(); plane_obj.transform.localPosition = Vector3.zero; bxc.material = earthPhysMaterial; outer_plane = GameFieldGenerator.GenOuterPlane(game_plane_width, game_plane_height, cellSize, outer_plane_material, 1); outer_plane.transform.SetParent(plane_obj.transform, true); mazeHolder = new MazeHolder(game_plane_width, game_plane_height); swarm.StartIniBlocks(mazeHolder.Mazes); kills_counter = 0; //notifications ini var nc = FindObjectOfType<NotificationCenter>(); nc.SetUpSubscriber(this); SetUpSubscriber(nc); }
public void FromTopLeftPathFind() { //Arrange MazeHolder mzh = new MazeHolder(10, 10); mzh.Mazes[7, 9].type = MazeObjectType.Block; mzh.Mazes[7, 8].type = MazeObjectType.Block; mzh.Mazes[6, 7].type = MazeObjectType.Block; mzh.Mazes[6, 6].type = MazeObjectType.Block; Vector3 aim = new Vector3(5, 0, 5); Vector3 start = new Vector3(10, 0, 9); Vector3 dir = Vector3.one; //Act mzh.CalculateToPointDirection(start, aim, ref dir); //Assert Assert.Less(dir.x, 0); Assert.LessOrEqual(dir.y, 0); }
public void OutOfBoundsStart() { //Arrange MazeHolder mzh = new MazeHolder(10, 10); mzh.Mazes[7, 9].type = MazeObjectType.Block; mzh.Mazes[7, 8].type = MazeObjectType.Block; mzh.Mazes[6, 7].type = MazeObjectType.Block; mzh.Mazes[6, 6].type = MazeObjectType.Block; Vector3 aim = new Vector3(6, 0, 6); Vector3 start = new Vector3(15, 0, 11); Vector3 dir = Vector3.one; //Act mzh.CalculateToPointDirection(start, aim, ref dir); //Assert Assert.Fail(); }
public void FromBootmRightPathFind() { //Arrange MazeHolder mzh = new MazeHolder(10, 10); mzh.Mazes[3, 0].type = MazeObjectType.Block; mzh.Mazes[3, 1].type = MazeObjectType.Block; mzh.Mazes[3, 2].type = MazeObjectType.Block; mzh.Mazes[3, 3].type = MazeObjectType.Block; Vector3 aim = new Vector3(5, 0, 5); Vector3 start = new Vector3(0, 0, 1); Vector3 dir = Vector3.one; //Act mzh.CalculateToPointDirection(start, aim, ref dir); //Assert Assert.Greater(dir.x, 0); Assert.GreaterOrEqual(dir.y, 0); }