Exemple #1
0
 public void AgregarAzulejo(int idAzulejo, Vector3Int posicion)
 {
     AdministradorAzulejos.Instanciar().ObtenerAzulejo(ClaseAzulejo.Arbol, idAzulejo);
     if (PosicionValida(posicion))
     {
         Azulejo azulejo = new Azulejo();
         mapaArboles.AgregarAzulejo(azulejo, posicion);
     }
 }
Exemple #2
0
        public void AgregarRecurso(int idRecurso, Vector3Int posicion, Vector2 ini, Vector2 fin)
        {
            if (PosicionValida(posicion))
            {
                posicion.y = posicion.y + 1;
                if (!mapaVoxel.ExisteVoxel(posicion))
                {
                    RecursosPlantilla rp = AdministradorRecursos.Instanciar().ObtenerRecurso(idRecurso);


                    bool flag = false;
                    for (int x = (int)ini.x; x <= (int)fin.x; x++)
                    {
                        for (int z = (int)ini.y; z <= (int)fin.y; z++)
                        {
                            if (!mapaPosiciones.PosicionLibre(new Vector3Int(x, posicion.y, z)))
                            {
                                return;
                            }
                            flag = true;
                        }
                    }
                    if (flag)
                    {
                        Entity ent = AdministradorRecursos.Instanciar().CrearRecurso(idRecurso, new Unity.Mathematics.float3(posicion.x - 1, posicion.y, posicion.z - 1));

                        mapaRecursos.AgregarAzulejo(ent, new Vector3Int(posicion.x, posicion.y - 1, posicion.z));
                        for (int x = (int)ini.x; x <= (int)fin.x; x++)
                        {
                            for (int z = (int)ini.y; z <= (int)fin.y; z++)
                            {
                                mapaPosiciones.AgregarAzulejo(1, new Vector3Int(x, posicion.y, z));
                            }
                        }
                    }
                }
            }
        }