November 2018
Beginner
246 pages
5h 23m
English
The Node class will handle each tile object in our 2D grid and will be, used to represent the maps shown in the Node.cs file:
using UnityEngine;
using System.Collections;
using System;
public class Node : IComparable {
public float nodeTotalCost;
public float estimatedCost;
public bool bObstacle;
public Node parent;
public Vector3 position;
public Node() {
this.estimatedCost = 0.0f;
this.nodeTotalCost = 1.0f;
this.bObstacle = false;
this.parent = null;
}
public Node(Vector3 pos) {
this.estimatedCost = 0.0f;
this.nodeTotalCost = 1.0f;
this.bObstacle = false;
this.parent = null;
this.position = pos;
}
public void MarkAsObstacle() {
this.bObstacle = true;
}
The Node class stores properties such as the cost from the starting point and the ...
Read now
Unlock full access