public bool curObjEaten(LemonPoint loc) { if (loc == null) { return(false); } if (loc.lemonloc == -1) { return(false); } return(!Orchard[loc.tree].isGrown[loc.spot]); }
// Update is called once per frame void Update() { if (isReady && stack.Count != 0) { goToWayPoint(); } else if (oc.hasNextLemon() && unlocked || oc.curObjEaten(curObj)) { LemonPoint t = oc.nextLemon(); if (t != null) { unlocked = false; curObj = t; getShortestPath(t.lemonloc); } } }
public LemonPoint nextLemon() { if (lemonQueue.Count != 0) { LemonPoint p = lemonQueue.Dequeue(); while (!Orchard[p.tree].isGrown[p.spot]) { if (lemonQueue.Count == 0) { return(null); } p = lemonQueue.Dequeue(); } int[] coords = Orchard[p.tree].getCoord(p.spot); p.lemonloc = coords[0] + coords[1] * 9; return(p); } else { return(null); } }
public void destroy() { curObj = null; unlocked = true; }