public override void Update() { if (Input.KeyPressed(Key.D)) { var search = new DFS <NearbyTiles, MoveAction>(_graphSearch); Game.SwitchScene(new LabyrinthScene <NearbyTiles, MoveAction>(_problem, search, _graphSearch)); } else if (Input.KeyPressed(Key.B)) { var graphSearchBFS = new GraphSearchBFS <NearbyTiles, MoveAction>(); var search = new BFS <NearbyTiles, MoveAction>(graphSearchBFS); Game.SwitchScene(new LabyrinthScene <NearbyTiles, MoveAction>(_problem, search, graphSearchBFS)); } else if (Input.KeyPressed(Key.G)) { var search = new GreedySearch <NearbyTiles, MoveAction>(_graphSearch, node => Math.Abs(21 - node.State.Center.X) + Math.Abs(20 - node.State.Center.Y)); Game.SwitchScene(new LabyrinthScene <NearbyTiles, MoveAction>(_problem, search, _graphSearch)); } else if (Input.KeyPressed(Key.A)) { var search = new AStarSearch <NearbyTiles, MoveAction>(_graphSearch, node => Math.Abs(21 - node.State.Center.X) + Math.Abs(20 - node.State.Center.Y)); Game.SwitchScene(new LabyrinthScene <NearbyTiles, MoveAction>(_problem, search, _graphSearch)); } }
//-----------------------------// void Awake() { // Set up references. anim = GetComponent <Animator> (); playerRigidbody = GetComponent <Rigidbody> (); //AStar script reference gs = GetComponent <GreedySearch> (); aS = GetComponent <AStar> (); ps = transform.Find("GunBarrelEnd").GetComponent <PlayerShooting> (); }
GreedySearch gs; //Greedy search script reference void Start() { // Set up the references. player = GameObject.FindGameObjectWithTag("Player").transform; playerHealth = GameObject.FindObjectOfType <PlayerHealth> (); enemyHealth = GetComponent <EnemyHealth> (); nav = GetComponent <UnityEngine.AI.NavMeshAgent> (); gs = GetComponent <GreedySearch> (); }
public void Setup() { g = new Graph("graph_matrix.txt", "heuristic_data.txt"); br = new Model.BidirectionalSearch(); gs = new GreedySearch(); }