Exemplo n.º 1
0
 public bool DropDownPlanet()
 {
     if (currentPlanet != null)
     {
         if (stacks [currentStack].planets.Count == 0)
         {
             currentPlanet.DropDown();
             stacks [currentStack].planets.Add(currentPlanet);
             stacks [currentStack].nextDropLongtitude += currentPlanet.diameter;
             currentPlanet.CurrentStack = currentStack;
             currentPlanet = null;
             theScore++;
             return(true);
         }
         if (currentPlanet.weight < stacks [currentStack].GetTopPlanet().weight)
         {
             currentPlanet.DropDown();
             stacks [currentStack].planets.Add(currentPlanet);
             stacks [currentStack].nextDropLongtitude += currentPlanet.diameter;
             Debug.Log("CHESES" + stacks[currentStack].nextDropLongtitude);
             currentPlanet.CurrentStack = currentStack;
             currentPlanet = null;
             theScore++;
             return(true);
         }
     }
     if (overideProtocol)
     {
         stacks [CurrentStack].planets.Add(currentPlanet);
         stacks [currentStack].nextDropLongtitude += currentPlanet.diameter;
         currentPlanet.CurrentStack = currentStack;
         currentPlanet = null;
         theScore++;
         return(true);
     }
     return(false);
 }
Exemplo n.º 2
0
 public void dynamicTransfer(List <Stack <PlanetController> > nestedPlanets, int startStack, int endStack, int total)
 {
     if (total == 1)
     {
         PlanetController planet = nestedPlanets [startStack].Pop();
         nestedPlanets [endStack].Push(planet);
         bool isExist = stacks [endStack].planets.Any(x => x.name == planet.name);
         if (!isExist)
         {
             stacks [endStack].planets.Add(planet);
         }
         planet.MoveUp();
         planet.MoveTo(endStack);
         planet.DropDown();
     }
     else
     {
         int aux = 3 - startStack - endStack;
         dynamicTransfer(nestedPlanets, startStack, aux, total - 1);
         dynamicTransfer(nestedPlanets, startStack, endStack, 1);
         dynamicTransfer(nestedPlanets, aux, endStack, total - 1);
     }
 }