public static int actualizarPersonaje(string xNombre, int xptosAtaque, int xptosDef, int xptosVida,
                                              int xptosEnergia, int xptosExp, int xNivel, string xCasco, string xPechera, string xPant,
                                              string xGuantes, string xBotas, string xArmaIzq, string xArmaDer, Usuario xUsuario, string xTipo,
                                              Mundo xMundo, int xCoordX, int xCoordY, int xCtdLibreInv, NpgsqlConnection con)
        {
            int res = 0;

            NpgsqlCommand comando = new NpgsqlCommand(string.Format("UPDATE personajes " +
                                                                    "SET perpuntosataque ={1}, perpuntosdefensa ={2}," +
                                                                    "perpuntosvitalidad ={3}, perpuntosenergia ={4}, perexperiencia ={5}, pernivel ={6}," +
                                                                    "percasco ={7}, perpechera ={8}, perpantalon ={9}, perguantes ={10}, perbotas ={11}, " +
                                                                    "perarmaizquierda ={12}, perarmaderecha ={13}, " +
                                                                    "permundo ={16}, percoordx ={17}, percoordy ={18}, percantidadlibreinventario ={19} " +
                                                                    "WHERE  pernombre={0} AND pertipo={15} AND perusuario={14}",
                                                                    xNombre, xptosAtaque, xptosDef, xptosVida, xptosEnergia, xptosExp, xNivel, xCasco, xPechera, xPant,
                                                                    xGuantes, xBotas, xArmaIzq, xArmaDer, xUsuario.NombreUsuario, xTipo, xMundo.Nombre, xCoordX, xCoordY, xCtdLibreInv), con);

            try
            {
                res = comando.ExecuteNonQuery();
            }
            catch (NpgsqlException e)
            {
                MessageBox.Show("No se puede actualizar el personaje.\n" + e);
            }

            return(res);
        }
示例#2
0
 /// <summary>
 /// Verifica se o comando é para criar um filho
 /// Adiciona ou removo filhos ao pai.
 /// </summary>
 /// <param name="command"></param>
 /// <param name="mundo"></param>
 /// <returns></returns>
 public IState Perform(Command command, Mundo mundo)
 {
     if (command.Equals(Command.MOUSE_MOVE))
     {
         var hover = PolygonSelector.GetSelected(mundo.polygons, Mouse.X, Mouse.Y);
         if (hover != this.parent)
         {
             mundo.polygonSelected = hover;
         }
     }
     else if (command.Equals(Command.CLICK))
     {
         var selected = PolygonSelector.GetSelected(mundo.polygons, Mouse.X, Mouse.Y);
         if (selected != null && selected != this.parent)
         {
             mundo.RemovePolygon(selected);
             this.parent.children.Add(selected);
             mundo.polygonSelected = this.parent;
             return(new MainState());
         }
     }
     else if (command.Equals(Command.ESCAPE))
     {
         return(new MainState());
     }
     return(this);
 }
        public static int insertarPersonaje(string xNombre, int xptosAtaque, int xptosDef, int xptosVida,
                                            int xptosEnergia, int xptosExp, int xNivel, string xCasco, string xPechera, string xPant,
                                            string xGuantes, string xBotas, string xArmaIzq, string xArmaDer, Usuario xUsuario, string xTipo,
                                            Mundo xMundo, int xCoordX, int xCoordY, int xCtdLibreInv, NpgsqlConnection con)
        {
            int res = 0;

            NpgsqlCommand comando = new NpgsqlCommand(string.Format("INSERT INTO personajes (pernombre, perpuntosataque, perpuntosdefensa, perpuntosvitalidad," +
                                                                    "perpuntosenergia, perexperiencia, pernivel, percasco, perpechera," +
                                                                    "perpantalon, perguantes, perbotas, perarmaizquierda, perarmaderecha," +
                                                                    "perusuario, pertipo, permundo, percoordx, percoordy, percantidadlibreinventario) VALUES ({0},{1},{2},{3},{4},{5},{6},{7},{8},{9},{10},{11},{12},{13},{14},{15},{16},{17},{18},{19})",
                                                                    xNombre, xptosAtaque, xptosDef, xptosVida, xptosEnergia, xptosExp, xNivel, xCasco, xPechera, xPant,
                                                                    xGuantes, xBotas, xArmaIzq, xArmaDer, xUsuario.NombreUsuario, xTipo, xMundo.Nombre, xCoordX, xCoordY, xCtdLibreInv), con);

            try
            {
                if (Helpers.validarInsPersonaje(xNombre, xUsuario.NombreUsuario, con) == 0)
                {
                    res = comando.ExecuteNonQuery();
                }
                else
                {
                    MessageBox.Show("No puedes tener personajes con el mismo nombre.\nPor favor cambialo.");
                }
            }
            catch (NpgsqlException e)
            {
                MessageBox.Show("No se puede insertar el personaje.\n" + e);
            }

            return(res);
        }
 void Awake()
 {
     mundo       = FindObjectOfType <Mundo>();
     gameManager = FindObjectOfType <GameManager>();
     agent       = transform.GetComponent <NavMeshAgent>();
     animator    = transform.GetComponent <Animator>();
 }
    static void Main(string[] args)
    {
        Mundo window = Mundo.GetInstance(800, 800);

        window.Title = "Meinkraft";
        window.Run(1.0 / 60.0);
    }
示例#6
0
        private void ChecaPorMonstros(Localizacao localizacao)
        {
            // Does the location have a monster?
            if (localizacao.MonstroMorandoAqui != null)
            {
                rtbMessages.Text += "You see a " + localizacao.MonstroMorandoAqui.Nome + Environment.NewLine;

                // Make a new monster, using the values from the standard monster in the World.Monster list
                Monstro standardMonster = Mundo.MonstroPorID(localizacao.MonstroMorandoAqui.ID);

                _monstroAtual = new Monstro(standardMonster.ID, standardMonster.Nome, standardMonster.MaximumDamage,
                                            standardMonster.RecompensaDeExperiencia, standardMonster.RecompensaDeOuro, standardMonster.HitPointsAtual, standardMonster.HitPointsMaximo);

                foreach (ItemDeLoot lootItem in standardMonster.tabelaDeLoot)
                {
                    _monstroAtual.tabelaDeLoot.Add(lootItem);
                }

                cboWeapons.Visible   = true;
                cboPotions.Visible   = true;
                btnUseWeapon.Visible = true;
                btnUsePotion.Visible = true;
            }
            else
            {
                _monstroAtual = null;

                cboWeapons.Visible   = false;
                cboPotions.Visible   = false;
                btnUseWeapon.Visible = false;
                btnUsePotion.Visible = false;
            }
        }
示例#7
0
        /// <summary>
        /// Contrutor sava o ultimo estado da bbox.
        /// </summary>
        /// <param name="mundo"></param>
        public TranslatePolygonState(Mundo mundo)
        {
            var bbox = mundo.polygonSelected.GetBBox();

            this.lastX = bbox.centerX;
            this.lastY = bbox.centerY;
        }
示例#8
0
    static Fase GerarFaseSobrevivencia(int dif)
    {
        Mundo mundo = CarregarFaseDeArquivo.CarregarDificuldade(dif);

        int n = Random.Range(0, mundo.fases.Count);

        return(mundo.fases[n]);
    }
示例#9
0
 void Start()
 {
     mundo        = GameObject.FindWithTag("Player").GetComponent <Mundo>();
     damageReqest = GameObject.FindWithTag("UI").GetComponent <DamageRequest>();
     knife        = GetComponent <Rigidbody>();
     knife.AddRelativeForce(Vector3.forward * 12, ForceMode.Impulse);//设置发射技能的力
     m_Transform = GetComponent <Transform>();
     InvokeRepeating("Rotation", 0, 0.01f);
     Destroy(gameObject, 0.6f);
 }
示例#10
0
 public Chunk(Vector3 position, SpatialMaterial m)
 {
     chunk = new Spatial
     {
         Name = Mundo.MontaNomeDoChunk(position)
     };
     Name = chunk.Name;
     chunk.Translation = position;
     material          = m;
     BuildChunk();
 }
示例#11
0
        public SuperAdventure()
        {
            InitializeComponent();

            _jogador = new Jogador(10, 10, 20, 0, 5, 3, 3, 100, 1);
            MovePara(Mundo.LocalizacaoPorID(Mundo.LOCALIZACAO_ID_CASA));
            _jogador.Inventario.Add(new ItemNoInventario(Mundo.ItemPorID(Mundo.ITEM_ID_ESPADA_VELHA), 1));

            lblHitPoints.Text  = _jogador.HitPointsAtual.ToString();
            lblGold.Text       = _jogador.Ouro.ToString();
            lblExperience.Text = _jogador.PontosDeExperiencia.ToString();
            lblLevel.Text      = _jogador.Level.ToString();
        }
示例#12
0
    /// <summary>
    /// Función que crea las plantas y las instancia en el mundo.
    /// </summary>
    /// <param name="numeroComida"> Número de plantas que se tienen que crear </param>
    public void Initialize(byte numeroComida)
    {
        instance = this;

        comida = new List <Planta>();

        for (int i = 0; i < numeroComida; i++)
        {
            Planta planta = new Planta();
            comida.Add(planta);

            comida[i] = Instantiate(prefabComida);
            comida[i].Initialize();
        }
    }
示例#13
0
    public override void OnEvent(EventData eventData)
    {
        spriteslider = GetComponent <Spriteslider>();
        mundo        = GameObject.FindWithTag("Player").GetComponent <Mundo>();

        string cloneAccount  = (string)DictTool.GteValue <byte, object>(eventData.Parameters, (byte)ParameterCode.Account);
        string cloneUserName = (string)DictTool.GteValue <byte, object>(eventData.Parameters, (byte)ParameterCode.Username);

        //Debug.Log(cloneAccount);
        Trigger.SetActive(true);
        spriteslider.NameSetOther(PosCode.R, cloneUserName);
        gameStart = GameObject.FindWithTag("GameStart").GetComponent <GameStart>();
        gameStart.Clone(gameStart.R, gameStart.Rq);
        GameObject.FindWithTag("Player").transform.SetPositionAndRotation(gameStart.L, gameStart.Lq);
        mundo.GameSetup();
    }
        public static int modificarBicho(string xCod, string xTipo, Mundo xMundo, int xCoordX, int xCoordY, NpgsqlConnection con)
        {
            int           res     = 0;
            NpgsqlCommand comando = new NpgsqlCommand(string.Format("UPDATE bichos SET bchtipo={0}, bchmundo={1} bchcoordx={2} bchcoordy={3} WHERE bchcodigo={4}", xTipo, xMundo.Nombre, xCoordX, xCoordY, xCod), con);

            try
            {
                res = comando.ExecuteNonQuery();
            }
            catch (NpgsqlException e)
            {
                MessageBox.Show("No puedes modificar el bicho.\n" + e);
            }

            return(res);
        }
        public static int modificarNPC(string xCod, string xNombre, Mundo xMundo, int xCoordX, int xCoordY, NpgsqlConnection con)
        {
            int           res     = 0;
            NpgsqlCommand comando = new NpgsqlCommand(string.Format("UPDATE npc SET npcnombre={0}, npcmundo={1}, npccoordx={2}, npccoordy={3} WHERE npccodigo = {4}", xNombre, xMundo.Nombre, xCoordX, xCoordY, xCod), con);

            try
            {
                res = comando.ExecuteNonQuery();
            }
            catch (NpgsqlException e)
            {
                MessageBox.Show("No puedes modificar el NPC.\n" + e);
            }

            return(res);
        }
        public static int modificarEntrada(string xCod, string xNombre, Mundo xMundoTel, Mundo xMundo, int xCoordX, int xCoordY, NpgsqlConnection con)
        {
            int           res     = 0;
            NpgsqlCommand comando = new NpgsqlCommand(string.Format("UPDATE entradas SET entnombre ={0}, entmundoteletransporta ={1}, entmundo ={2}, entcoordx ={3}, entcoordy ={4} WHERE entcodigo = {5}", xNombre, xMundoTel.Nombre, xMundo.Nombre, xCoordX, xCoordY, xCod), con);

            try
            {
                res = comando.ExecuteNonQuery();
            }
            catch (NpgsqlException e)
            {
                MessageBox.Show("No puedes modificar la entrada.\n" + e);
            }

            return(res);
        }
        public static int crearNPC(string xNombre, Mundo xMundo, int xCoordX, int xCoordY, NpgsqlConnection con)
        {
            int res = 0;

            NpgsqlCommand comando = new NpgsqlCommand(string.Format("INSERT INTO npc (npcnombre, npcmundo, npccoordx, npccoordy) VALUES ({0},{1},{2},{3})", xNombre, xMundo.Nombre, xCoordX, xCoordY), con);

            try
            {
                res = comando.ExecuteNonQuery();
            }
            catch (NpgsqlException e)
            {
                MessageBox.Show("No se puede insertar el NPC.\n" + e);
            }

            return(res);
        }
        public static int crearEntrada(string xNombre, Mundo xMundoTel, Mundo xMundo, int xCoordX, int xCoordY, NpgsqlConnection con)
        {
            int res = 0;

            NpgsqlCommand comando = new NpgsqlCommand(string.Format("INSERT INTO entradas (entnombre, entmundoteletransporta, entmundo, entcoordx, entcoordy) VALUES ({0},{1},{2},{3},{4})",
                                                                    xNombre, xMundoTel.Nombre, xMundo.Nombre, xCoordX, xCoordY), con);

            try
            {
                res = comando.ExecuteNonQuery();
            }
            catch (NpgsqlException e)
            {
                MessageBox.Show("No se puede insertar la entrada.\n" + e);
            }

            return(res);
        }
        public static int insertarBicho(string xTipo, Mundo xMundo, int xCoordX, int xCoordY, NpgsqlConnection con)
        {
            int res = 0;

            NpgsqlCommand comando = new NpgsqlCommand(string.Format("INSERT INTO bichos (bchtipo, bchmundo, bchcoordx, bchcoordy) VALUES ({0},{1},{2},{3})", xTipo, xMundo.Nombre, xCoordX, xCoordY), con);

            try
            {
                res = comando.ExecuteNonQuery();
            }
            catch (NpgsqlException e)
            {
                MessageBox.Show("No se puede insertar el bicho.\n" + e);
            }


            return(res);
        }
示例#20
0
    public bool HasSolidNeighbour(int x, int y, int z)
    {
        //var teste = (int)parent.GetNode("Mundo").;
        //GD.Print(teste);

        //Block[,,] chunks = (Block[,,]) parent.GetNode("chunkData");

        //chunks = owner.chunkData;

        Block[,,] chunks;
        if (x < 0 || x >= Mundo.chunkSize ||
            y < 0 || y >= Mundo.chunkSize ||
            z < 0 || z >= Mundo.chunkSize)
        {
            Vector3 neighbourChunkpos = parent.Translation + new Vector3((x - (int)position.x) * Mundo.chunkSize,
                                                                         (y - (int)position.y) * Mundo.chunkSize,
                                                                         (z - (int)position.z) * Mundo.chunkSize);
            string nName = Mundo.MontaNomeDoChunk(neighbourChunkpos);
            int    x1 = x; int y1 = y; int z1 = z;
            x = ConvertBlockIndexToLocal(x);
            y = ConvertBlockIndexToLocal(y);
            z = ConvertBlockIndexToLocal(z);
            Chunk nChunk;
            if (Mundo.chunks.TryGetValue(nName, out nChunk))
            {
                chunks = nChunk.chunkData;
            }
            else
            {
                return(false);
            }
        }
        else
        {
            chunks = Owner.chunkData;
        }
        try
        {
            return(chunks[x, y, z].isSolid);
        }
        catch (System.IndexOutOfRangeException) { }
        return(false);
    }
示例#21
0
    void Update()
    {
        if (jugador != null)
        {
            camaraDelJuego.transform.position = new Vector3(camaraDelJuego.transform.position.x, camaraDelJuego.transform.position.y, camaraDelJuego.transform.position.z);
        }

        while (jugador != null && pJuego < jugador.transform.position.z + lugarseguro)
        {
            int indiceMundo = Random.Range(0, mundoPrefab.Length - 1);

            if (pJuego < 0)
            {
                indiceMundo = 2;
            }

            GameObject ObjetoMundo = Instantiate(mundoPrefab[indiceMundo]);
            ObjetoMundo.transform.SetParent(this.transform);
            Mundo mundo = ObjetoMundo.GetComponent <Mundo>();
            ObjetoMundo.transform.position = new Vector3(0, 0, pJuego + mundo.tamaño / 2);
            pJuego += mundo.tamaño;
        }
    }
示例#22
0
 /// <summary>
 /// Verifica se o comando é para transladar o poligono
 /// </summary>
 /// <param name="command"></param>
 /// <param name="mundo"></param>
 /// <returns></returns>
 public IState Perform(Command command, Mundo mundo)
 {
     if (command.Equals(Command.MOUSE_MOVE))
     {
         if (mundo.polygonSelected != null)
         {
             var translation = this.GetTranslation();
             mundo.polygonSelected.Translation(translation.Item1, translation.Item2);
         }
         else
         {
             return(new MainState());
         }
     }
     else if (command.Equals(Command.MOVE))
     {
         return(new MainState());
     }
     else if (command.Equals(Command.ESCAPE))
     {
         return(new MainState().Perform(command, mundo));
     }
     return(this);
 }
示例#23
0
        /* Começo btnUsePotion */
        private void MonstroAtacaJogador()
        {
            // Determina quantidade de dano causado ao jogador
            int danoAoJogador = GeradorDeNumeroAleatorio.NumeroEntre(0, _monstroAtual.MaximumDamage);

            // Apresenta mensagem ao jogador
            rtbMessages.Text += $"{_monstroAtual.Nome} causou {danoAoJogador.ToString()} pontos de dano.{Environment.NewLine}";

            // Subtrai dano da vida do jogador
            _jogador.HitPointsAtual -= danoAoJogador;

            // Atualiza UI
            lblHitPoints.Text = _jogador.HitPointsAtual.ToString();

            // Se vida do jogador chegar a 0
            if (_jogador.HitPointsAtual <= 0)
            {
                // Mostra mensagem
                rtbMessages.Text += $"{_monstroAtual.Nome} te matou.{Environment.NewLine}";

                // Move jogador para sua casa
                MovePara(Mundo.LocalizacaoPorID(Mundo.LOCALIZACAO_ID_CASA));
            }
        }
示例#24
0
 public Visor(IEnumerable <Mapa> mundo, int amplitud, int altura)
     : this(amplitud, altura)
 {
     Mundo.AfegirMolts(mundo);
 }
    static Mundo CarregarMundoDoArquivo(string arquivo, int mun)
    {
        string[] linhas = PegarLinhasDeArquivo(arquivo, mun);

        if (linhas == null)
        {
            return(null);
        }

        int   nivel = 1;
        Mundo mundo = null;

        string w  = "";
        string s  = "";
        string sw = "";
        string ss = "";
        string v  = "";
        string d  = "";

        for (int i = 0; i < linhas.Length; i++)
        {
            if (mundo == null && linhas[i].StartsWith("world"))
            {
                mundo = new Mundo();
            }
            else if (mundo != null)
            {
                if (linhas[i].StartsWith("level"))
                {
                    mundo.fases.Add(new Fase());
                    nivel = mundo.totalDeFases;
                    mundo.totalDeFases++;
                    w  = "";
                    s  = "";
                    sw = "";
                    ss = "";
                    v  = "";
                    d  = "";
                }
                else
                {
                    string[] lin = linhas[i].Split('=');

                    switch (lin[0])
                    {
                    case "dif":
                        mundo.fases[nivel].dif =
                            int.Parse(lin[1]);
                        break;

                    case "people":
                        mundo.fases[nivel].people =
                            int.Parse(lin[1]);
                        break;

                    case "waves":
                        mundo.fases[nivel].waves =
                            int.Parse(lin[1]);
                        if (mundo.fases[nivel].waves < 0)
                        {
                            int q          = -mundo.fases[nivel].waves;
                            int totalwaves =
                                mundo.fases[nivel].people / q;
                            int r = mundo.fases[nivel].people % q;

                            for (int j = 0; j < totalwaves; j++)
                            {
                                mundo.fases[nivel].w.Add(q);
                                w += "w:" + q + "\n";
                            }
                            if (r > 0)
                            {
                                mundo.fases[nivel].w.Add(r);
                                w += "w:" + r + "\n";
                            }
                        }
                        break;

                    case "w":
                        mundo.fases[nivel].w.Add(int.Parse(lin[1]));
                        w += "w:" + lin[1] + "\n";
                        break;

                    case "s":
                        mundo.fases[nivel].s.Add(float.Parse(lin[1]));
                        s += "s:" + lin[1] + "\n";
                        break;

                    case "sbridge":
                        if (lin[1].Contains("1") ||
                            lin[1].Contains("true"))
                        {
                            mundo.fases[nivel].sbridge = true;
                        }
                        break;

                    case "speople":
                        mundo.fases[nivel].speople =
                            int.Parse(lin[1]);
                        break;

                    case "swaves":
                        mundo.fases[nivel].swaves =
                            int.Parse(lin[1]);
                        if (mundo.fases[nivel].swaves < 0)
                        {
                            int q          = -mundo.fases[nivel].swaves;
                            int totalwaves =
                                mundo.fases[nivel].speople / q;
                            int r = mundo.fases[nivel].speople % q;

                            for (int j = 0; j < totalwaves; j++)
                            {
                                mundo.fases[nivel].sw.Add(q);
                                sw += "sw:" + q + "\n";
                            }
                            if (r > 0)
                            {
                                mundo.fases[nivel].sw.Add(r);
                                sw += "sw:" + q + "\n";
                            }
                        }
                        break;

                    case "sw":
                        mundo.fases[nivel].sw.Add(int.Parse(lin[1]));
                        sw += "sw:" + lin[1] + "\n";
                        break;

                    case "ss":
                        mundo.fases[nivel].ss.Add(float.Parse(lin[1]));
                        ss += "ss:" + lin[1] + "\n";
                        break;

                    case "boat":
                        mundo.fases[nivel].boat =
                            int.Parse(lin[1]);
                        break;

                    case "wind":
                        mundo.fases[nivel].wind =
                            int.Parse(lin[1]);
                        break;

                    case "wtime":
                        mundo.fases[nivel].wtime =
                            float.Parse(lin[1]);
                        break;

                    case "v":
                        mundo.fases[nivel].v.Add(int.Parse(lin[1]));
                        v += "v:" + lin[1] + "\n";
                        break;

                    case "wdir":
                        mundo.fases[nivel].dir =
                            int.Parse(lin[1]);
                        break;

                    case "dtime":
                        mundo.fases[nivel].dtime =
                            float.Parse(lin[1]);
                        break;

                    case "d":
                        mundo.fases[nivel].d.Add(int.Parse(lin[1]));
                        d += "d:" + lin[1] + "\n";
                        break;

                    case "b":
                        mundo.fases[nivel].bouncers =
                            PegarRebatedores(
                                mundo.fases[nivel].bouncers, lin[1]);
                        break;

                    default:
                        /*
                         * Debug.Log(
                         *      "dif:"+mundo.fases[nivel].dif+"\n"+
                         *      "people:"+mundo.fases[nivel].people+"\n"+
                         *      "waves:"+mundo.fases[nivel].waves+"\n"+
                         *      w+s+
                         *      "sbridge:"+mundo.fases[nivel].sbridge+"\n"+
                         *      "speople:"+mundo.fases[nivel].speople+"\n"+
                         *      "swaves:"+mundo.fases[nivel].swaves+"\n"+
                         *      sw+ss+
                         *      "boat:"+mundo.fases[nivel].boat+"\n"+
                         *      "wind:"+mundo.fases[nivel].wind+"\n"+
                         *      "wtime:"+mundo.fases[nivel].wtime+"\n"+
                         *      v+
                         *      "dir:"+mundo.fases[nivel].dir+"\n"+
                         *      "dtime:"+mundo.fases[nivel].dtime+"\n"+
                         *      d+"\n"
                         *      );
                         * //*/
                        if (lin[0].StartsWith("endworld"))
                        {
                            return(mundo);
                        }
                        else if (lin[0].StartsWith("end"))
                        {
                            continue;
                        }
                        break;
                    }
                }
            }
        }
        return(mundo);
    }
示例#26
0
    static Fase GerarFaseJogorRapido(int dif)
    {
        Mundo mundo = CarregarFaseDeArquivo.CarregarDificuldade(dif);

        int n = Random.Range(0, mundo.fases.Count);

        return(mundo.fases[n]);

        /*
         * Fase f = new Fase();
         *
         * int extrap = Random.Range(0, dif / 3 + 3);
         * int basePassantes = 3;
         * int basePassantes2 = 1;
         *
         * int passantes = basePassantes + dif / 2 + extrap;
         * int ondas = -1;
         *
         * bool ponte2 = false;
         * int passantes2 = basePassantes2 + dif / 3 + extrap;
         * int ondas2 = -1;
         *
         * float velBase = 3;
         * float velMin = 0;
         * float velMax = 1;
         *
         * int barco = 0;
         *
         * int vento = 0;
         * float tvento = 1;
         *
         * int dvento = 0;
         * float dtvento = 1;
         *
         * bool soDaEsquerda = false;
         *
         * int rebCima = 0;
         * int rebMeio = 0;
         * int rebBaixo = 0;
         *
         * if (dif == Dados.jogoRapidoDificuldadeMaxima)
         * {
         *      rebMeio = 2;
         *      rebBaixo = 2;
         *
         *      velMin = 6f;
         *      velMax = 8f;
         *
         *      passantes += 2;
         *      ondas = Random.Range(2,6);
         *
         *      ponte2 = true;
         *      passantes2 += 3;
         *
         *      barco = 3;
         *
         *      vento = Random.Range(6,11) * -1;
         *      tvento = Random.Range(1.5f, 4f);
         *
         *      dvento = Random.Range(6,11) * -1;
         *      dtvento = Random.Range(1.5f, 4f);
         * }
         * else if (dif > Dados.jogoRapidoDificuldadeMaxima * 3 / 4)
         * {
         *      rebCima = Random.Range(0,4);
         *      rebMeio = 1 + Random.Range(0,2);
         *      rebBaixo = 1 + Random.Range(0,2);
         *
         *      velMin = 3f;
         *      velMax = 7f;
         *
         *      passantes += 1;
         *
         *      ponte2 = true;
         *      passantes2 += 1;
         *
         *      barco = 2 + Random.Range(0,2);
         *
         *      vento = Random.Range(2,6) * -1;
         *      tvento = Random.Range(3f,7f);
         *
         *      dvento = Random.Range(2,6) * -1;
         *      dtvento = Random.Range(3f,7f);
         * }
         * else if (dif > Dados.jogoRapidoDificuldadeMaxima / 2)
         * {
         *      rebCima = 1 + Random.Range(0,3);
         *      rebMeio = 1;
         *      rebBaixo = Random.Range(0,2);
         *
         *      velMin = 2f;
         *      velMax = 5f;
         *
         *      ponte2 = true;
         *
         *      barco = 1 + Random.Range(0,2);
         *
         *      int v = Random.Range(2,5);
         *      vento = MeiaChance() ? v : -2;
         *      tvento = Random.Range(5f, 10f);
         *
         *      int d = Random.Range(1,9);
         *      dvento = MeiaChance() ? d : -2;
         *      dtvento = Random.Range(5f, 10f);
         * }
         * else if (dif > Dados.jogoRapidoDificuldadeMaxima / 4)
         * {
         *      rebCima = 3;
         *      rebMeio = 1 + Random.Range(0,2);
         *
         *      velMin = 0.5f;
         *      velMax = 3.5f;
         *
         *      barco = Random.Range(0,2);
         *      if (dif == Dados.jogoRapidoDificuldadeMaxima / 2)
         *      {
         *              rebCima = 2 + Random.Range(0,2);
         *              rebMeio = Random.Range(0,2);
         *              rebBaixo = Random.Range(0,2);
         *
         *              ponte2 = MeiaChance();
         *              barco = 1;
         *      }
         * }
         * else
         * {
         *      if (dif > 1){
         *              rebCima = 1;
         *      }
         *
         *      velMin = 0f;
         *      velMax = 2f;
         *
         *      soDaEsquerda = true;
         * }
         *
         * List<int> w = new List<int>();
         * List<float> s = new List<float>();
         *
         * if (ondas > 0)
         * {
         *      int total = 0;
         *      int dir = 0;
         *      float dec = 0;
         *      float v = 0;
         *
         *      for (int i = 0; i < ondas; i++)
         *      {
         *              int valor = Random.Range(1, passantes / ondas + 1);
         *              w.Add(valor);
         *              dir = MeiaChance() ? 1 : -1;
         *              dec = MeiaChance() ? 0 : 0.9f;
         *              v = velBase + Random.Range(velMin,velMax);
         *              v *= dir;
         *
         *              for (int j = 0; j < valor; j++)
         *              {
         *                      s.Add(v);
         *                      v = v * Random.Range(dec * 0.75f, dec);
         *                      total++;
         *              }
         *      }
         *
         *      if (total < passantes)
         *      {
         *              total = passantes - total;
         *              w.Add(total);
         *              dir = MeiaChance() ? 1 : -1;
         *              dec = MeiaChance() ? 0 : 0.9f;
         *              v = velBase + Random.Range(velMin,velMax);
         *              v *= dir;
         *
         *              for (int j = 0; j < total; j++)
         *              {
         *                      s.Add(v);
         *                      v = v * Random.Range(dec * 0.75f, dec);
         *              }
         *      }
         * }
         * else
         * {
         *      int total = 0;
         *      int dir = 0;
         *      float dec = 0;
         *      float v = 0;
         *
         *      int tondas = -ondas;
         *      if (tondas == 0)
         *      {
         *              tondas = 1;
         *      }
         *
         *      for (int i = 0; i < passantes / tondas; i++)
         *      {
         *              w.Add(tondas);
         *
         *              dir = (MeiaChance() || soDaEsquerda) ? 1 : -1;
         *              dec = MeiaChance() ? 0 : 0.9f;
         *              v = velBase + Random.Range(velMin,velMax);
         *              v *= dir;
         *
         *              for (int j = 0; j < tondas; j++)
         *              {
         *                      s.Add(v);
         *                      v = v * Random.Range(dec * 0.75f, dec);
         *                      total++;
         *              }
         *      }
         *
         *      if (total < passantes)
         *      {
         *              total = passantes - total;
         *              w.Add(total);
         *              dir = (MeiaChance() || soDaEsquerda) ? 1 : -1;
         *              dec = MeiaChance() ? 0 : 0.9f;
         *              v = velBase + Random.Range(velMin,velMax);
         *              v *= dir;
         *
         *              for (int j = 0; j < total; j++)
         *              {
         *                      s.Add(v);
         *                      v = v * Random.Range(dec * 0.75f, dec);
         *              }
         *      }
         * }
         *
         *
         * List<int> w2 = new List<int>();
         * List<float> s2 = new List<float>();
         *
         * if (ponte2)
         * {
         *      if (ondas2 > 0)
         *      {
         *              int total = 0;
         *              int dir = 0;
         *              float dec = 0;
         *              float v = 0;
         *
         *              for (int i = 0; i < ondas2; i++)
         *              {
         *                      int valor = Random.Range(1, passantes2 / ondas2 + 1);
         *                      w2.Add(valor);
         *                      dir = MeiaChance() ? 1 : -1;
         *                      dec = MeiaChance() ? 0 : 0.9f;
         *                      v = velBase + Random.Range(velMin,velMax);
         *                      v *= dir;
         *
         *                      for (int j = 0; j < valor; j++)
         *                      {
         *                              s2.Add(v);
         *                              v = v * Random.Range(dec * 0.75f, dec);
         *                              total++;
         *                      }
         *              }
         *
         *
         *              if (total < passantes2)
         *              {
         *                      total = passantes2 - total;
         *                      w2.Add(total);
         *                      dir = MeiaChance() ? 1 : -1;
         *                      dec = MeiaChance() ? 0 : 0.9f;
         *                      v = velBase + Random.Range(velMin,velMax);
         *                      v *= dir;
         *
         *                      for (int j = 0; j < total; j++)
         *                      {
         *                              s2.Add(v);
         *                              v = v * Random.Range(dec * 0.75f, dec);
         *                      }
         *              }
         *      }
         *      else
         *      {
         *              int total = 0;
         *              int dir = 0;
         *              float dec = 0;
         *              float v = 0;
         *
         *              int tondas2 = -ondas2;
         *              if (tondas2 == 0)
         *              {
         *                      tondas2 = 1;
         *              }
         *
         *              for (int i = 0; i < passantes2 / tondas2; i++)
         *              {
         *                      w2.Add(tondas2);
         *
         *                      dir = (MeiaChance() || soDaEsquerda) ? 1 : -1;
         *                      dec = MeiaChance() ? 0 : 0.9f;
         *                      v = velBase + Random.Range(velMin,velMax);
         *                      v *= dir;
         *
         *                      for (int j = 0; j < tondas2; j++)
         *                      {
         *                              s2.Add(v);
         *                              v = v * Random.Range(dec * 0.75f, dec);
         *                              total++;
         *                      }
         *              }
         *
         *              if (total < passantes2)
         *              {
         *                      total = passantes2 - total;
         *                      w2.Add(total);
         *                      dir = (MeiaChance() || soDaEsquerda) ? 1 : -1;
         *                      dec = MeiaChance() ? 0 : 0.9f;
         *                      v = velBase + Random.Range(velMin,velMax);
         *                      v *= dir;
         *
         *                      for (int j = 0; j < total; j++)
         *                      {
         *                              s2.Add(v);
         *                              v = v - v * Random.Range(dec * 0.75f, dec);
         *                      }
         *              }
         *      }
         * }
         *
         * List<int> ves = new List<int>();
         *
         * if (vento < 0)
         * {
         *      int q = -vento;
         *
         *      for (int i = 0; i < q; i++)
         *      {
         *              ves.Add(Random.Range(1,5));
         *      }
         * }
         *
         * List<int> des = new List<int>();
         *
         * if (dvento < 0)
         * {
         *      int q = -dvento;
         *
         *      for (int i = 0; i < q; i++)
         *      {
         *              des.Add(Random.Range(1,9));
         *      }
         * }
         *
         * f.dif = dif;
         *
         * f.people = passantes;
         * f.waves = ondas;
         * f.w = w;
         * f.s = s;
         *
         * f.sbridge = ponte2;
         * f.speople = passantes2;
         * f.swaves = ondas2;
         * f.sw = w2;
         * f.ss = s2;
         *
         * f.boat = barco;
         *
         * f.wind = vento;
         * f.wtime = tvento;
         * f.v = ves;
         *
         * f.dir = dvento;
         * f.dtime = dtvento;
         * f.d = des;
         *
         * f.bouncers = CriarRebatedores(
         *      rebCima, rebMeio, rebBaixo, soDaEsquerda, dif);
         *
         * return f;
         * //*/
    }
示例#27
0
 // Carregamento do mundo
 void CarregarMundo(int m)
 {
     mundo        = CarregarFaseDeArquivo.CarregarMundo(m);
     mundo.numero = m + 1;
 }
示例#28
0
 void CarregarMundo(string arquivo)
 {
     mundo        = CarregarFaseDeArquivo.CarregarMundo(arquivo, 0);
     mundo.numero = -1;
 }
示例#29
0
        public List <Oferta> GetOfertasByNit(string Nit, int activeOferta = 0)
        {
            List <Oferta> ofertas          = new List <Oferta>();
            var           connectionString = ConfigurationManager.ConnectionStrings["dbComercial"].ConnectionString;

            using (var session = SessionManager.OpenSession(connectionString))
            {
                var ofertasEntity = (from o in session.Query <OfertaEntity>()
                                     join co in session.Query <ClienteOfertaEntity>() on
                                     o.Id equals co.IdOferta
                                     where co.IdCliente.Trim().Equals(Nit.Trim()) &&
                                     DateTime.Now >= o.FechaPublicacion && DateTime.Now <= o.FechaVencimiento
                                     select o).ToList();
                foreach (OfertaEntity ofertaEntity in ofertasEntity)
                {
                    Oferta oferta = new Oferta();
                    oferta.Id               = ofertaEntity.Id;
                    oferta.Nombre           = ofertaEntity.Nombre;
                    oferta.Imagen           = ofertaEntity.Imagen;
                    oferta.NomUser          = ofertaEntity.NomUser;
                    oferta.Tipo             = ofertaEntity.Tipo;
                    oferta.Visible          = ofertaEntity.Visible;
                    oferta.Bodega           = ofertaEntity.Bodega;
                    oferta.Descripcion      = ofertaEntity.Descripcion;
                    oferta.FechaPublicacion = ofertaEntity.FechaPublicacion;
                    oferta.FechaVencimiento = ofertaEntity.FechaVencimiento;

                    oferta.FecUser = ofertaEntity.FecUser;
                    if (oferta.Id == activeOferta)
                    {
                        ReferenciaService rs          = new ReferenciaService();
                        List <Referencia> referencias = rs.GetAllReferenciasByOferta(Nit, ofertaEntity.Id);
                        int TotalReferencia           = referencias.Count();
                        foreach (Referencia referencia in referencias)
                        {
                            Mundo  mundo       = new Mundo();
                            string NombreMundo = Utility.GetMundo(referencia.Plu[0].Genero.ToString(), referencia.Plu[0].Edad.ToString());

                            /*
                             * foreach (Plu plu in referencia.Plu)
                             * {
                             *  NombreMundo = Utility.GetMundo(plu.Genero.ToString(), plu.Edad.ToString());
                             * }
                             * if (oferta.Mundos.Any(item => item.Nombre.Equals(NombreMundo)))
                             * {
                             *  var mundoUpdate = oferta.Mundos.FirstOrDefault(x => x.Nombre == NombreMundo);
                             *  if (mundoUpdate != null)
                             *  {
                             *      mundoUpdate.Cantidad++;
                             *  }
                             * }
                             * else
                             * {
                             *  mundo.Cantidad = 1;
                             *  mundo.Nombre = NombreMundo;
                             *  oferta.Mundos.Add(mundo);
                             * }
                             */
                            if (!oferta.Mundos.Any(item => item.Nombre.Equals(NombreMundo)))
                            {
                                mundo.Nombre = NombreMundo;
                                oferta.Mundos.Add(mundo);
                            }
                        }
                    }
                    ofertas.Add(oferta);
                }
            }
            return(ofertas);
        }
示例#30
0
 /// <summary>
 /// Contrturor salva quem é o pai de poligono
 /// </summary>
 /// <param name="mundo"></param>
 public ChildState(Mundo mundo)
 {
     this.parent           = mundo.polygonSelected;
     mundo.polygonSelected = null;
 }