// Use this for initialization void Start() { target = GameObject.FindGameObjectWithTag("Player"); gridManager = GameObject.FindGameObjectWithTag("GridManager").GetComponent<SceneGridManager>(); CircleCollider2D collider = this.gameObject.GetComponent<CircleCollider2D>(); gridManager.registerObject(this.gameObject, collider.transform.position.x, collider.transform.position.y, collider.radius * 2, collider.radius * 2, 5); rb2d = GetComponent<Rigidbody2D>(); algorithms = this.gameObject.GetComponent<NavigationAlgorithms>(); effectiveSpeed = speed + Random.Range(-speedRandFactor, speedRandFactor); }
void Start() { gridManager = GameObject.FindGameObjectWithTag("GridManager").GetComponent<SceneGridManager>(); BoxCollider2D collider = this.gameObject.GetComponent<BoxCollider2D>(); gridManager.registerObject(this.gameObject, collider.transform.position.x, collider.transform.position.y, collider.size.x, collider.size.y, 5); }
// Use this for initialization void Start() { gridManager = GameObject.FindGameObjectWithTag("GridManager").GetComponent<SceneGridManager>(); //private Cell[] moves = {{1, 1}, {1, 0}, {1, -1}, {0, -1}, {0, 1}, {-1, -1}, {-1, 0}, {-1, 1}}; neighbourCells[0] = new Cell { x = 1, y = 1}; neighbourCells[1] = new Cell { x = 1, y = 0}; neighbourCells[2] = new Cell { x = 1, y = -1}; neighbourCells[3] = new Cell { x = 0, y = 1}; neighbourCells[4] = new Cell { x = 0, y = -1}; neighbourCells[5] = new Cell { x = -1, y = 1}; neighbourCells[6] = new Cell { x = -1, y = 0}; neighbourCells[7] = new Cell { x = -1, y = -1}; }
void Start() { rb2d = GetComponent<Rigidbody2D>(); gridManager = GameObject.FindGameObjectWithTag("GridManager").GetComponent<SceneGridManager>(); BoxCollider2D collider = this.gameObject.GetComponent<BoxCollider2D>(); gridManager.registerPlayer(this.gameObject, collider.transform.position.x, collider.transform.position.y, collider.size.x, collider.size.y, -100); }