예제 #1
0
 public bool curObjEaten(LemonPoint loc)
 {
     if (loc == null)
     {
         return(false);
     }
     if (loc.lemonloc == -1)
     {
         return(false);
     }
     return(!Orchard[loc.tree].isGrown[loc.spot]);
 }
예제 #2
0
 // 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);
         }
     }
 }
예제 #3
0
    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);
        }
    }
예제 #4
0
 public void destroy()
 {
     curObj   = null;
     unlocked = true;
 }