void Start() { if (this._sequence == null || this._sequence.Length == 0) { this._sequence = FindObjectsOfType <GoalCellSensor>(); Array.Sort(this._sequence, (g1, g2) => g1.OrderIndex.CompareTo(g2.OrderIndex)); } Array.Reverse(this._sequence); this._goal_stack = new Stack <GoalCellSensor>(this._sequence); this.CurrentGoalCell = this.PopGoal(); }
/// <summary> /// /// </summary> public override void PreSetup() { var xs = this._grid_size.X; var ys = this._grid_size.Y; var zs = this._grid_size.Z; this._grid = this.GenerateRandomGrid(xs: xs, ys: ys, zs: zs, min_empty_cells_percentage: this._min_empty_cells_percentage); this._goal_cell_observer = this.gameObject.GetComponent <GoalCellSensor>(); //this.Setup(); var dominant_dimension = Mathf.Max(xs, ys, zs); this._camera.orthographicSize = dominant_dimension / 2f + 1f; this._camera.transform.position = new Vector3(0, y: ys / 2f + 1f, z: 0); }
public GoalCellSensor PopGoal() { this.CurrentGoalCell = this._goal_stack.Pop(); return(this.CurrentGoalCell); }