public static void LoadLevel(LevelType level) { Data.CurrentLevel = level; Pool.Reset(); switch (level) { case LevelType.Level1: Level_1.Load(); break; } }
/// <summary> /// Constructeur astar /// </summary> /// <param name="Level"></param> /// <param name="width"></param> /// <param name="height"></param> public astar(Level_1 Level, int width, int height, string GhostName) { this.Level = Level; this.width = width; this.height = height; IsPathFound = false; this.GhostName = GhostName; openList = new List <Node>(); closedList = new List <Node>(); ListPath = new List <Vector2>(); }
public static void LoadLevel(uint index) { Pool.Reset(); switch (index) { case 0: Level_0.Load(); break; case 1: Level_1.Load(); break; case 2: Level_2.Load(); break; } Data.CurrentLevel = index; PutCameraOnPlayer(); }
private void Start() { timeDelegate = new TimeDelegate(StartTime); time = timeTxt.GetComponent <Text>(); levels[0] = new Level_0(); levels[1] = new Level_1(); levels[2] = GetComponent <Level_2>(); levels[3] = GetComponent <Level_3>(); levels[4] = GetComponent <Level_4>(); newLevel.InstMemory("void", 6, 1); newLevel[1, 0] = (p) => { if (MessageSystemGameBlock.GameTime >= timeToNewLevel[0]) { nextLevel.SetActive(true); time.text = "0"; level = 5; OpenNewLevel(); } }; newLevel[2, 0] = (p) => { if (MessageSystemGameBlock.GameTime >= timeToNewLevel[1]) { nextLevel.SetActive(true); time.text = "0"; level = 5; OpenNewLevel(); } }; newLevel[3, 0] = (p) => { if (MessageSystemGameBlock.GameTime >= timeToNewLevel[2]) { nextLevel.SetActive(true); time.text = "0"; level = 5; OpenNewLevel(); } }; newLevel[0, 0] = (p) => { }; newLevel[4, 0] = (p) => { }; newLevel[5, 0] = (p) => { if (NextLevel.IsPressed) { NextLevel.IsPressed = false; MessageSystemGameBlock.LEVEL++; MessageSystemGameBlock.GameTime = 0; level = MessageSystemGameBlock.LEVEL; TapToLevel.SetNumberLevel(); } }; printTime.InstMemory("void", 6, 1); printTime[0, 0] = (p) => time.text = Cut(MessageSystemGameBlock.GameTime).ToString(); printTime[1, 0] = (p) => time.text = Cut((timeToNewLevel[0] - MessageSystemGameBlock.GameTime)).ToString(); printTime[2, 0] = (p) => time.text = Cut((timeToNewLevel[1] - MessageSystemGameBlock.GameTime)).ToString(); printTime[3, 0] = (p) => time.text = Cut((timeToNewLevel[2] - MessageSystemGameBlock.GameTime)).ToString(); printTime[4, 0] = (p) => time.text = Cut(MessageSystemGameBlock.GameTime).ToString(); printTime[5, 0] = (p) => { }; }
/// <summary> /// Méthode GoToCible /// Permet d'atteindre le Goal de la recherche /// </summary> /// <param name="Level"></param> /// <param name="HashDirSprite"></param> /// <returns></returns> public int GoToCible(Level_1 _Level, List <Vector2> listNextNodesSprite) { int HashDirSprite = 0; for (int col = 0; col < width; col++) { for (int row = 0; row < height; row++) { Vector2 nodeNextUp = new Vector2(listNextNodesSprite[0].X, listNextNodesSprite[0].Y); Vector2 nodeNextDown = new Vector2(listNextNodesSprite[2].X, listNextNodesSprite[2].Y); Vector2 nodeNextLeft = new Vector2(listNextNodesSprite[3].X, listNextNodesSprite[3].Y); Vector2 nodeNextRight = new Vector2(listNextNodesSprite[1].X, listNextNodesSprite[1].Y); switch (GhostName) { case "Inky": if (_Level.Maze2D[col, row].Position == nodeNextUp && _Level.Maze2D[col, row].IsPathInky) { HashDirSprite = 64; _Level.Maze2D[col, row].IsPathInky = false; } else if (_Level.Maze2D[col, row].Position == nodeNextRight && _Level.Maze2D[col, row].IsPathInky) { HashDirSprite = 128; _Level.Maze2D[col, row].IsPathInky = false; } else if (_Level.Maze2D[col, row].Position == nodeNextDown && _Level.Maze2D[col, row].IsPathInky) { HashDirSprite = 256; _Level.Maze2D[col, row].IsPathInky = false; } else if (_Level.Maze2D[col, row].Position == nodeNextLeft && _Level.Maze2D[col, row].IsPathInky) { HashDirSprite = 32; _Level.Maze2D[col, row].IsPathInky = false; } break; case "Pinky": if (_Level.Maze2D[col, row].Position == nodeNextUp && _Level.Maze2D[col, row].IsPathPinky) { HashDirSprite = 64; _Level.Maze2D[col, row].IsPathPinky = false; } else if (_Level.Maze2D[col, row].Position == nodeNextRight && _Level.Maze2D[col, row].IsPathPinky) { HashDirSprite = 128; _Level.Maze2D[col, row].IsPathPinky = false; } else if (_Level.Maze2D[col, row].Position == nodeNextDown && _Level.Maze2D[col, row].IsPathPinky) { HashDirSprite = 256; _Level.Maze2D[col, row].IsPathPinky = false; } else if (_Level.Maze2D[col, row].Position == nodeNextLeft && _Level.Maze2D[col, row].IsPathPinky) { HashDirSprite = 32; _Level.Maze2D[col, row].IsPathPinky = false; } break; case "Blinky": if (_Level.Maze2D[col, row].Position == nodeNextUp && _Level.Maze2D[col, row].IsPathBlinky) { HashDirSprite = 64; _Level.Maze2D[col, row].IsPathBlinky = false; } else if (_Level.Maze2D[col, row].Position == nodeNextRight && _Level.Maze2D[col, row].IsPathBlinky) { HashDirSprite = 128; _Level.Maze2D[col, row].IsPathBlinky = false; } else if (_Level.Maze2D[col, row].Position == nodeNextDown && _Level.Maze2D[col, row].IsPathBlinky) { HashDirSprite = 256; _Level.Maze2D[col, row].IsPathBlinky = false; } else if (_Level.Maze2D[col, row].Position == nodeNextLeft && _Level.Maze2D[col, row].IsPathBlinky) { HashDirSprite = 32; _Level.Maze2D[col, row].IsPathBlinky = false; } break; case "Klyde": if (_Level.Maze2D[col, row].Position == nodeNextUp && _Level.Maze2D[col, row].IsPathKlyde) { HashDirSprite = 64; _Level.Maze2D[col, row].IsPathKlyde = false; } else if (_Level.Maze2D[col, row].Position == nodeNextRight && _Level.Maze2D[col, row].IsPathKlyde) { HashDirSprite = 128; _Level.Maze2D[col, row].IsPathKlyde = false; } else if (_Level.Maze2D[col, row].Position == nodeNextDown && _Level.Maze2D[col, row].IsPathKlyde) { HashDirSprite = 256; _Level.Maze2D[col, row].IsPathKlyde = false; } else if (_Level.Maze2D[col, row].Position == nodeNextLeft && _Level.Maze2D[col, row].IsPathKlyde) { HashDirSprite = 32; _Level.Maze2D[col, row].IsPathKlyde = false; } break; } } } return(HashDirSprite); }