public PathNode(PFGrid <PathNode> grid, int x, int y) { this.grid = grid; this.x = x; this.y = y; isWalkable = true; }
public static MvcHtmlString BuildGrid(this HtmlHelper htmlHelper, Action <PFGrid> action = null) { var component = new PFGrid(); if (action != null) { action(component); } return(component.Html(htmlHelper)); }
void RoomEventSpawner() { // get a current snapshot of the player's health for calculating the DDA healthSnapshot = GameObject.FindGameObjectWithTag("GameController").GetComponent <GameController>().currentHealth; // play a sound effect to alert the player that the room event has started audioSource.clip = roomEventStartSound; audioSource.volume = 0.4f * GameController.sfxVolume; audioSource.Play(); // get an instance of the room spawner's parent room = transform.parent.transform; // instantiate the grid grid = Instantiate(physicalGrid, gridSpawnPoint.transform.position, Quaternion.identity, room); gridPoints = grid.GetComponent <PFGrid>(); GameController.currentLootDropPoint = gridPoints.grid[gridPoints.gridSizeX / 2, gridPoints.gridSizeY / 2]; // this will get rid of a game object that is no longer needed Destroy(gridSpawnPoint, 2.0f); // create the player sphere playerSphere.position = player.position; // Spawn enemies // First, determine how many enemies will spawn numberOfMelee = Random.Range(1, 4); numberOfRanged = Random.Range(0, 3); int enemyCount = numberOfMelee + numberOfRanged; // this will set the value of the room to determine what level of loot is available after the room event is over switch (enemyCount) { case (1): roomValue = 4; break; case (2): roomValue = 6; break; case (3): roomValue = 8; break; case (4): roomValue = 9; break; case (5): roomValue = 10; break; default: break; } startTime = Time.time; // spawn in the melee enemies in random positions in the room (as long as the area is spawnable. Invoke("SpawnEnemies", 1.0f); }
public PathFinding(int width, int height) { grid = new PFGrid <PathNode>(width, height, 10f, Vector3.zero, (PFGrid <PathNode> grid, int x, int y) => new PathNode(grid, x, y)); }
private void Awake() { // linking the grid to the grid script grid = GetComponent <PFGrid>(); requestManager = GetComponent <PathRequestManager>(); }
void Awake() { _grid = GetComponent <PFGrid>(); }
private void Awake() { _pfGrid = GetComponent <PFGrid>(); }