public void CalculatePath() { if (GameManager.instance.setupComplete) { MazeController mazeController = GameManager.instance.mazeController; GameObject playerGameObject = GameManager.instance.playerGameObject; (int x, int y)playerCord = mazeController.WorldCordToMazeCord(playerGameObject.transform.position); (int x, int y)enemyCord = mazeController.WorldCordToMazeCord(gameObject.transform.position); path = AStar.RunAStar( mazeController.GetMazeCell(enemyCord.x, enemyCord.y), mazeController.GetMazeCell(playerCord.x, playerCord.y) ); pathIndex = 1; /* * string pathString = ""; * foreach (MazeCell mazeCell in path) { * pathString += mazeCell.name + " => "; * } * Debug.Log(pathString); */ } }
public void MazeRunnerMain(string[] args) { Console.WriteLine("Welcome to Maze Runner. select your level"); //get input selection from gui int levelSelection = 0; string[] mazeArgs; switch (levelSelection) { case 0: mazeArgs = new string[] { "0" }; break; default: mazeArgs = new string[] { "0" }; break; } theMaze = MazeController.getMaze(); // Maze(MazeSize, mazeArgs); theMaze.SetPlayerLocation(theMaze.GetEntrance().x, theMaze.GetEntrance().y); Play(); }
public BFSsolver(MazeController m, Grid g, Location l, Location target) : base(m, g, l) { this.Target = target; this.CurrentMinions = new List <BFSminion>(); this.RecruitMinions = new List <BFSminion>(); this.Cells = new List <BFScell>(); }
public void BeginGameWithOptionsApplied() { GetGameOptions(); MazeController mazeController = new MazeController(MazeModel); mazeController.CreateMaze(); }
/// <summary> /// sends the opponent of the calling client that the calling client /// moved in the direction of num. /// </summary> /// <param name="num"> int - a numer that represent a move in the game </param> public void Play(int num) { string opponent = MazeController.GetOpponent(Context.ConnectionId); //Play move in given direction. Clients.Client(opponent).play(num); }
public void SetUp(MazeController mazeController, SnakeConfig config, int numSegments) { base.SetUp(mazeController); this.Visible = false; this.Dead = false; this.trail = new SnakeTrail(); this.sinusoidalMotion = new SinusoidalMotion(this.trail); if (config.Player) { this.Side = Side.Player; } this.config = config; this.initialLength = numSegments; for (int i = 0; i < numSegments; ++i) { AddSegment(); } if (config.Player) { this.Controller = new PlayerSnakeController(this, mazeController); } else { this.Controller = new AISnakeController(this, mazeController); } }
private async Task <IActionResult> InvokeMethod(ActionContext actionContext, MazeController controller) { controller.MazeContext = actionContext.Context; var parameterBindingInfo = GetParameterBindingInfo(actionContext.Context.RequestServices .GetRequiredService <IModelBinderFactory>()); var arguments = new object[Parameters.Count]; var parameterBinding = new ParameterBinder(); var valueProvider = new CompositeValueProvider(new List <IValueProvider> { new QueryStringValueProvider(BindingSource.Query, actionContext.Context.Request.Query, CultureInfo.InvariantCulture), new RouteValueProvider(BindingSource.Path, actionContext.RouteData) }); for (var i = 0; i < Parameters.Count; i++) { var parameterDescriptor = Parameters[i]; var bindingInfo = parameterBindingInfo[i]; var result = await parameterBinding.BindModelAsync(actionContext, bindingInfo.ModelBinder, valueProvider, parameterDescriptor, bindingInfo.ModelMetadata, value : null); if (result.IsModelSet) { arguments[i] = result.Model; } } return(await _executor.Execute(_objectMethodExecutor, controller, arguments, Metadata)); }
public void SetUp(MazeController mazeController) { this.mazeController = mazeController; // default side is enemy this.Side = Side.Enemy; }
// 0 = upper, 1 = right, 2 = lower, 3 = left void Start() { maze = transform.parent.GetComponent <MazeController>(); global = GameObject .FindWithTag("GameController") .GetComponent <GameController>(); visited = false; }
public void OnTriggerEnter(Collider other) { Debug.Log("MazeEnd() being called due to maze completion"); ExperimentSettings _instance = ExperimentSettings.GetInstance(); _instance.MazeSettings.ReachedEnd = true; MazeController.MazeEnd(); }
public void SetUp(GameManager gameManager, MazeController mazeController) { base.SetUp(mazeController); this.Dead = false; this.frogController = new FrogController(this, gameManager, mazeController); this.Controller = this.frogController; }
public MazeConfigForm(MazeController control) { MazePanel panel = new MazePanel(control); this.Padding = new Padding(0); this.FormBorderStyle = FormBorderStyle.Fixed3D; this.AutoSize = true; this.Controls.Add(panel); }
public void CreateMazeCharactersTest() { var controller = new MazeController(); foreach (var mazeId in mazeIds) { MazeModel model = controller.CreateMazeCharacters(mazeId); Assert.True(model.GameState.StateResult == StateResult.SuccesfullyCreated); } }
public MazePanel(MazeController control) { this.Width = CELL_SIZE * control.Maze.Width; this.Height = CELL_SIZE * control.Maze.Height; this.Margin = new Padding(0); this.SetStyle(ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer, true); this.control = control; control.OnChange += new MazeController.ChangeHandler(maze_OnChange); }
/// <summary> /// Checks if username is in the database and if it does, the function calss /// MazeController.StartGame(Context.ConnectionId, name, rows, cols, username). /// </summary> /// <param name="name"> string - the generated maze name </param> /// <param name="rows"> int - the number of rows in the generated maze </param> /// <param name="cols"> int - the number of cols in the generated maze </param> /// <param name="username"> string - The requesting client username(he has to be signed in) </param> public void StartGame(string name, int rows, int cols, string username) { // check that the username exists UsersController db = new UsersController(); if (db.UserExists(username)) { // Start the game. MazeController.StartGame(Context.ConnectionId, name, rows, cols, username); } db.TearDown(); }
void Awake() { if (!Instance) { Instance = this; } else { Debug.Log("Only one world controller allowed per scene. Destroying duplicate."); Destroy(this); } }
protected virtual void OnTrackingFound() { // Get the MazeController component if (mazeController == null) { mazeController = GetComponentInChildren <MazeController>(); } // Show the maze if (mazeController != null) { mazeController.Show(); } }
/// <summary> /// The function checks if username is in the database and if it does, /// the function joins the client to the multiplayer game named name. /// Then, this function sends the two game players the game. /// </summary> /// <param name="name"> The existing multiplayer game </param> /// <param name="username"> string - The requesting client username(he has to be signed in) </param> public void JoinGame(string name, string username) { // check that the username exists UsersController db = new UsersController(); if (db.UserExists(username)) { GameInfo game = MazeController.JoinGame(Context.ConnectionId, name, username); //Send to first client and second client the maze. Clients.Client(game.FirstClient).getMaze(game.Maze); Clients.Client(game.SecondClient).getMaze(game.Maze); } db.TearDown(); }
// Use this for initialization void Start() { mcont = this; enemy = new Enemy[maxEnemies]; group = new Group[maxGroups]; for (byte i = 0; i < maxEnemies; i++) { GameObject o = Instantiate(Resources.Load(ENEMY_PREFAB), new Vector3(-1, -1, 0), Quaternion.identity) as GameObject; enemy[i] = o.GetComponent <Enemy>(); enemy[i].trans = o.transform; enemy[i].parent = o; enemy[i].trans.parent = this.transform; enemy[i].id = i; o.SetActive(false); } for (int i = 0; i < maxGroups; i++) { group[i] = new Group(); group[i].speed = speed; } enemyTable = new EnemyArrayTable(maxEnemies, maxGroups); flame = new Flame[6]; for (int i = 0; i < 6; i++) { GameObject o = Instantiate(Resources.Load(FLAME_PREFAB)) as GameObject; flame[i] = o.GetComponent <Flame>(); flame[i].trans = o.transform; flame[i].parent = o; flame[i].trans.parent = this.transform; flame[i].mcont = this; o.SetActive(false); } for (int i = 0; i < 11; i++) { door[i] = Instantiate(Resources.Load(DOOR_PREFAB)) as GameObject; door[i].SetActive(false); doortrans[i] = door[i].transform; doortrans[i].parent = this.transform; } MapGen(mapSeed); }
void Start() { endMenu.SetActive(false); script = this; Time.timeScale = 1; mg = FindObjectOfType <MazeGenerator>(); setBannerState(0); //StartCoroutine(startRun()); int randQ = Random.Range(0, quips.Length); quipText.text = quips[randQ]; int s = Random.Range(0, frameJumps.Length); player.GetComponent <VideoPlayer>().frame = frameJumps[s]; }
private void Awake() { if (instance == null) { instance = this; DontDestroyOnLoad(gameObject); lastMap = null; SceneManager.sceneLoaded += OnSceneLoaded; } else { Destroy(gameObject); } }
private void Awake() { if (instance == null) { instance = this; } mazeControllerGameObject.transform.localScale = new Vector3( mazeWidth / 10f, 1, mazeHeight / 10f ); mazeController = mazeControllerGameObject.GetComponent <MazeController>(); mazeController.GenerateMaze(mazeWidth, mazeHeight); }
private void btnSolve_Click(object sender, EventArgs e) {// metodo utilizando pilha para resolver List <MazeNode> path = new List <MazeNode>(); SolveController solver = new SolveController(nodes); btnSolve.Enabled = false; if (solver.Solve(ref path)) { Bitmap bitmap = new Bitmap(picMaze.Image); picMaze.Image = MazeController.DisplayPath(path, CellSize, bitmap, resultColor); } else { MessageBox.Show("Impossivel resolver o Labirinto!"); } }
public LevelState(string name, int startLevel) : base(name) { Camera = new FirstPersonCamera(); Camera.BoundingRadius = 2.0f; Camera.UpdateBoundingVolumes(); YnG.ShowMouse = (GameConfiguration.EnabledMouse ? true : false); YnG.AudioManager.SoundEnabled = GameConfiguration.EnabledSound; YnG.AudioManager.MusicVolume = GameConfiguration.MusicVolume; groundPlayerBoundingSphere = new BoundingSphere(Camera.Position, Camera.BoundingRadius); _mazeLevel = new MazeLevel(startLevel); Add(_mazeLevel); _gameHUD = new GameHUD(); timeTimer = new MazeTimer(); score = new Score(startLevel); gameState = MazeGameState.Playing; elapsedPartyTime = 0; soundTimer = new YnTimer(1000, 0); if (YnG.AudioManager.SoundEnabled) { soundTimer.Completed += (s, e) => YnG.AudioManager.SoundEnabled = true; } else { soundTimer.Completed += (s, e) => { } }; control = new MazeController(Camera); Scene.SceneLight.AmbientIntensity = 0.85f; Scene.SceneLight.DirectionalLights[0].Enabled = true; Scene.SceneLight.DirectionalLights[0].Direction = new Vector3(-1, 0.75f, -1); Scene.SceneLight.DirectionalLights[0].DiffuseColor = Color.WhiteSmoke.ToVector3(); Scene.SceneLight.DirectionalLights[0].DiffuseIntensity = 1.0f; Scene.SceneLight.DirectionalLights[0].SpecularColor = new Vector3(233, 33, 33); }
public void MoveCharacterTest() { var controller = new MazeController(); foreach (var mazeId in mazeIds) { foreach (string possibleMove in allPossibleMoves) { var message = controller.MoveCharacters(mazeId, new MoveCharactersInMazeModel { Direction = possibleMove }); Assert.True(message.State == State.Active); } } Assert.True(true); }
public void Init() { controller = new MazeController(); controller.Request = new HttpRequestMessage(); controller.Configuration = new HttpConfiguration(); mazeIds = new List <Guid>(); allPossibleMoves = new List <string> { DIRECTION_STAY, DIRECTION_NORTH, DIRECTION_SOUTH, DIRECTION_EAST, DIRECTION_WEST }; difficultiesModels = new List <MazeInitModel>(); MazeInitModel initModel = new MazeInitModel() { Difficulty = DifficultiesEnum.Difficulty.Godlike, MazeHeight = 15, MazeWidth = 20, PlayerName = "Fluttershy" }; difficultiesModels.Add(initModel); initModel = new MazeInitModel() { Difficulty = DifficultiesEnum.Difficulty.Masochistic, MazeHeight = 15, MazeWidth = 20, PlayerName = "Fluttershy" }; difficultiesModels.Add(initModel); initModel = new MazeInitModel() { Difficulty = DifficultiesEnum.Difficulty.Tourist, MazeHeight = 15, MazeWidth = 20, PlayerName = "Fluttershy" }; difficultiesModels.Add(initModel); }
protected virtual void OnTrackingLost() { Renderer[] rendererComponents = GetComponentsInChildren <Renderer>(true); // Disable rendering: foreach (var component in rendererComponents) { component.enabled = false; } // Get the MazeController component if (mazeController == null) { mazeController = GetComponentInChildren <MazeController>(); } // Show the maze if (mazeController != null) { mazeController.Hide(); } }
private void btnCriar_Click(object sender, EventArgs e) { //DESENHO DO LABIRINTO int wid = int.Parse(numLargura.Text); int hgt = int.Parse(numAltura.Text); CellSize = int.Parse(numTamanhoBlc.Text); Xmin = (picMaze.ClientSize.Width - wid * CellSize) / 2; Ymin = (picMaze.ClientSize.Height - hgt * CellSize) / 2; // Construtor dos nós do labirinto. nodes = MazeController.MazeNodes(wid, hgt, Ymin, Xmin, CellSize); // Inicializa o kruskal Algorithm (Spanning TREE) MazeController.FindSpanningTree(ref nodes[0, 0]); // Mostra o Maze picMaze.Image = MazeController.DisplayMaze(nodes, picMaze.ClientSize.Width, picMaze.ClientSize.Height, CellSize, backgroundColor, lineCap, lineWid); btnSolve.Visible = true; btnSolve.Enabled = true; }
private bool First = true;//Used to fill the Grid on first step. public DFSgener(MazeController m, Grid g, Location l) : base(m, g, l) { }
public MazeReporter(MazeController control) { this.control = control; }
void Awake() { if (singleton == null) { singleton = this; } mazeWidth = nodeWidth * 2 + 1; mazeHeight = nodeHeight * 2 + 1; colorsOff = false; }