Example #1
0
 private List <GameObject> GenerarObjetosAleatorios(List <GameObject> listObjeto, TypeOfPoints tipoDeObjeto, string tagObjeto, int cantidadASpawnear)
 {
     //Asigna la cantidad a recoger en el texto
     if (tipoDeObjeto == TypeOfPoints.Recogible)
     {
         int posicion = botInventory.GetPositionTypeOfPickUpObject(tagObjeto);
         botInventory.cantidadObjetosARecoger[posicion].cantidadARecoger = cantidadASpawnear;
         botInventory.cantidadObjetosARecoger[posicion].cantidadActual   = 0;
     }
     //Debug.Log($"//======================= Type {tagObjeto}, Size {cantidadASpawnear}, objType {tipoDeObjeto} =============================//");
     for (int i = 0; i < cantidadASpawnear; i++)
     {
         int           posicionTipoDeObjeto = GetPositionTypeOfPoint(tipoDeObjeto);
         PuntosDeAncla tempPointOfSpawn     = puntosDeSpawn[posicionTipoDeObjeto].puntos[UnityEngine.Random.Range(0, puntosDeSpawn[posicionTipoDeObjeto].puntos.Count - 1)];
         Vector3       tempPosition         = tempPointOfSpawn.point.position;
         if (!tempPointOfSpawn.isFull)
         {
             tempPointOfSpawn.isFull = true;
             listObjeto.Add(ObjectPooler.Instance.SpawnFromPool(tagObjeto, tempPosition));
         }
         else
         {
             i--;
         }
     }
     return(listObjeto);
 }
Example #2
0
    private int GetPositionTypeOfPoint(TypeOfPoints tipoDePuntoABuscar)
    {
        int position = -1;

        for (int i = 0; i < puntosDeSpawn.Count; i++)
        {
            if (puntosDeSpawn[i].tipoDePunto == tipoDePuntoABuscar)
            {
                position = i;
                break;
            }
        }
        return(position);
    }
Example #3
0
    private int GetPositionTypeOfObjectToSpawn(TypeOfPoints tipoDePuntoABuscar)
    {
        int position = -1;

        for (int i = 0; i < objetosASpawnear.Count; i++)
        {
            if (objetosASpawnear[i].tipoDeObjeto == tipoDePuntoABuscar)
            {
                position = i;
                break;
            }
        }
        return(position);
    }
Example #4
0
    /*public  void ObjetoRecogido(string tagName, int amount){
     *  int posicion=GetPositionTypeOfPickUpObject(tagName);
     *  cantidadObjetosARecoger[posicion].cantidadActual+=amount;
     *  //cantidadObjetosARecoger[posicion].textoCantidad.text=""+cantidadObjetosARecoger[posicion].cantidadActual+"/"+carry_capacity;
     *  PickUp(tagName,cantidadObjetosARecoger[posicion].cantidadActual,carry_capacity);
     *  if(cantidadObjetosARecoger[posicion].cantidadActual>=cantidadObjetosARecoger[posicion].cantidadARecoger){
     *      contadorTareasHechas++;
     *      if(contadorTareasHechas>=3) {
     *
     *      }
     *  }
     * }*/
    //Busca y asigna los puntos de spawn
    private PointsOfSpawn BuscarYObtenerPuntosDeSpawn(string tag, TypeOfPoints tipoDePunto)
    {
        GameObject[]  tempObjects       = GameObject.FindGameObjectsWithTag(tag);
        PointsOfSpawn tempPointsOfSpawn = new PointsOfSpawn();

        tempPointsOfSpawn.tipoDePunto = tipoDePunto;
        for (int i = 0; i < tempObjects.Length; i++)
        {
            PuntosDeAncla tempPuntosDeAncla = new PuntosDeAncla();
            tempPuntosDeAncla.point = tempObjects[i].transform;
            tempPointsOfSpawn.puntos.Add(tempPuntosDeAncla);
        }
        return(tempPointsOfSpawn);
    }