示例#1
0
 public void Destinar()
 {
     if (control.puntero != null && control.puntero.entity.type == 4 && entity.gatherings.Contains((control.puntero.entity as ResourceSource).gathering) && !ocupado)
     {
         fuente = control.puntero;
         fuente.GetFronterizos();
         if (fuente.fronterizos.Count > 0)
         {
             Nodo des = fuente.NearestFronterizo(transform.position);
             pathfinding.destiny = new Vector3(des.x, des.y, 0);
             pathfinding.pathfinding();
             recolectando = true;
         }
     }
     else if (control.puntero != null && control.puntero.entity.type == 2 && entity.creatives.Contains(database.searchAbility("Build Town Center") as Creative))
     {
         cimientos = control.puntero;
         cimientos.GetFronterizos();
         if (cimientos.fronterizos.Count > 0)
         {
             Nodo des = cimientos.NearestFronterizo(transform.position);
             pathfinding.destiny = new Vector3(des.x, des.y, 0);
             pathfinding.pathfinding();
             construyendo = true;
         }
     }
     else if (!ocupado)
     {
         pathfinding.destiny = myCamera.ScreenToWorldPoint(Input.mousePosition);
         pathfinding.pathfinding();
         recolectando = false;
         construyendo = false;
     }
 }
示例#2
0
    public void Work(Seleccionable selec)
    {
        Token token = selec.entity as Token;

        if (selec.productionAmount < selec.maxProductionAmount - token.productionRate)
        {
            selec.productionAmount += token.productionRate;
        }
        else
        {
            selec.GetFronterizos();
            if (selec.fronterizos.Count > 0)
            {
                Seleccionable sele = MonoBehaviour.Instantiate(unitGO, new Vector3(selec.fronterizos [0].x, selec.fronterizos [0].y, 0), Quaternion.identity).GetComponent <Seleccionable>();
                sele.jugador = selec.jugador;
                selec.productionQueue.RemoveAt(0);
                selec.productionAmount = 0;
                if (selec.productionQueue.Count > 0)
                {
                    selec.maxProductionAmount = (selec.productionQueue[0].entity as Token).productionTime;
                }
                selec.interfaz.UpdateProductionIcons();
            }
        }
    }