Example #1
0
 //Constructor
 public Frame()
 {
     trama = new List<byte>();
     estadoActual = estado.Waiting_Delimiter;
     frameLength = 0;
     datosLength = 0;
 }
 public List<estado> Filtrar(estado estado)
 {
     return repositoryestado.ObterPorFiltros(b => (
         (estado.ID == Guid.Empty || b.ID == estado.ID) &&
         (estado.nome == null || b.nome.ToUpper().Contains(estado.nome)) &&
         (estado.codigo == null || b.codigo.ToUpper().Contains(estado.codigo)) &&
         (estado.empresaID == Guid.Empty || b.empresaID == estado.empresaID)
         )).ToList();
 }
Example #3
0
        public void ModificarTest()
        {
            RepositorioBase <estado> repositorio = new RepositorioBase <estado>();
            bool   paso = false;
            estado p    = repositorio.Buscar(1);

            p.varchar = "sdfsf";
            paso      = repositorio.Modificar(p);
            Assert.AreEqual(true, paso);
        }
Example #4
0
 public ActionResult Edit([Bind(Include = "idEstado,nombre")] estado estado)
 {
     if (ModelState.IsValid)
     {
         db.Entry(estado).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(estado));
 }
Example #5
0
        public IHttpActionResult Getestado(int id)
        {
            estado estado = db.estado.Find(id);

            if (estado == null)
            {
                return(NotFound());
            }

            return(Ok(estado));
        }
Example #6
0
        public async Task <ActionResult> Edit([Bind(Include = "Id_Estado,Estado1")] estado estado)
        {
            if (ModelState.IsValid)
            {
                db.Entry(estado).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(estado));
        }
Example #7
0
        public ActionResult Create([Bind(Include = "id,descricao")] estado estado)
        {
            if (ModelState.IsValid)
            {
                db.estado.Add(estado);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(estado));
        }
Example #8
0
        public async Task <IActionResult> Create([Bind("idestado,nombre_estado")] estado estado)
        {
            if (ModelState.IsValid)
            {
                _context.Add(estado);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(estado));
        }
        //--------------
        public void init()
        {
            initializeGajo();//super

            if (isWalkingAgent)
            {
                if (walker.Navigation.agent.isOnNavMesh)
                {
                    walker.target = basePositionTr.position;
                    walker.Navigation.startWalking();
                }
            }
            /*Override*/
            animator = GetComponent <Animator>();
            animator.runtimeAnimatorController = Resources.Load("EasyPopulation/Animators/Mercadeiro") as RuntimeAnimatorController;
            if (animator.runtimeAnimatorController == null)
            {
                Debug.LogError("Please do not delete Mercadeiro controller from Resources/Characters folder!");
            }
            AnimatorOverrideController myCurrentOverrideController = new AnimatorOverrideController(animator.runtimeAnimatorController);

            string nome_animacao = "state";

            nome_animacao += classe_animacao;
            myCurrentOverrideController[nome_animacao] = animationProduction;

            if (type == Profession.ProfessionType.Two_States)
            {
                nome_animacao = "state9";
                //nome_animacao += classe_animacao;
                myCurrentOverrideController[nome_animacao] = animationTransaction;
            }
            animator.runtimeAnimatorController = myCurrentOverrideController;

            animator.Update(0.0f);
            /*communicate animation state*/
            state = estado.BASE;
            GetComponent <Animator>().SetInteger("Animation_State", 1);
            GetComponent <Animator>().SetInteger("Num_Mercadeiro", classe_animacao);

            /*DNA*/
            originalRotation = gameObject.transform.rotation;
            originalPosition = gameObject.transform.position;
            //Type of resources being produced by this guy
            gameObject.AddComponent <DNA>();
            _dna = gameObject.GetComponent <DNA>();
            for (int i = 0; i < _dna.dna.Length; i++)
            {
                _dna.dna[i] = 0;
            }

            isReady = true;
        }
Example #10
0
        public async Task <ActionResult> Create([Bind(Include = "Id_Estado,Estado1")] estado estado)
        {
            if (ModelState.IsValid)
            {
                db.estado.Add(estado);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            return(View(estado));
        }
 public Veículo(string cor, int ano, string categoria, int quilometragem, Modelo modelo)
 {
     this.Cor           = cor;
     this.Ano           = ano;
     this.Categoria     = categoria;
     this.Quilometragem = quilometragem;
     this.Modelo        = modelo;
     this.status        = estado.Disponível;
     this.Estado        = SerializarEstado();
     this.Histórico     = new Histórico(this, new List <Manutenção>(), new List <Locação>());
     this.Modelo.Veículo.Add(this);
 }
Example #12
0
 public void actualizarestado()
 {
     if (player.transform.position.x < this.gameObject.transform.position.x)
     {
         lado       = -1;
         tipoestado = estado.izquierda;
     }
     if (player.transform.position.x > this.gameObject.transform.position.x)
     {
         lado       = 1;
         tipoestado = estado.derecha;
     }
 }
Example #13
0
        private int ObtenerEstado(estado estado)
        {
            switch (estado)
            {
            case estado.Activo:
                return(1);

            case estado.Inactivo:
                return(0);

            default:
                return(1);
            }
        }
Example #14
0
        private int CambiarEstado(estado estado)
        {
            switch (estado)
            {
            case estado.Activo:
                return(0);

            case estado.Inactivo:
                return(0);

            default:
                return(0);
            }
        }
 public void setLocado(Funcionário permitidor, Cliente locador, DateTime horario)
 {
     if (this.status == estado.Disponível)
     {
         this.status = estado.Locado;
         this.Estado = SerializarEstado();
         using (var ctx = new DadosContainer())
         {
             Locação l = new Locação(horario, this.Histórico, permitidor, locador);
             //ctx.AddToLocaçãoSet(l);
             ctx.SaveChanges();
         }
     }
 }
Example #16
0
        // GET: estadoes/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            estado estado = db.estado.Find(id);

            if (estado == null)
            {
                return(HttpNotFound());
            }
            return(View(estado));
        }
Example #17
0
    public void SPO2_gui()
    {
        if ((puerto = Lectura.iniciarPuerto()) != null)
        {
            tiempoInicial = Time.time;
            barra.habilitar();
            Mensaje.text = "Calculando SPO2. Por favor, espere...";
            estado_puerto = estado.CALCULANDO;
            Empezar.interactable = false;

            Thread oThread = new Thread(new ThreadStart(SPO2_comando));
            oThread.Start();
        }
    }
Example #18
0
    public void SPO2_gui()
    {
        if ((puerto = Lectura.iniciarPuerto()) != null)
        {
            tiempoInicial = Time.time;
            barra.habilitar();
            Mensaje.text         = "Calculando SPO2. Por favor, espere...";
            estado_puerto        = estado.CALCULANDO;
            Empezar.interactable = false;

            Thread oThread = new Thread(new ThreadStart(SPO2_comando));
            oThread.Start();
        }
    }
Example #19
0
        // GET: estadoes/Delete/5
        public async Task <ActionResult> Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            estado estado = await db.estado.FindAsync(id);

            if (estado == null)
            {
                return(HttpNotFound());
            }
            return(View(estado));
        }
Example #20
0
        public IHttpActionResult Deleteestado(int id)
        {
            estado estado = db.estado.Find(id);

            if (estado == null)
            {
                return(NotFound());
            }

            db.estado.Remove(estado);
            db.SaveChanges();

            return(Ok(estado));
        }
Example #21
0
 // Update is called once per frame
 void Update()
 {
     if (estado_puerto == estado.CALCULANDO)
     {
         barra.progreso = (Time.time - tiempoInicial) / 10.0f;
     }
     if (estado_puerto == estado.CALCULADO)
     {
         PlayerPrefs.SetInt(Estado.GLU, GLUv);
         barra.progreso       = 1.0f;
         estado_puerto        = estado.NO_ACTIVIDAD;
         Empezar.interactable = true;
         Mensaje.text         = "GLU = " + GLUv;
     }
 }
        public ActionResult DeleteConfirmed(int id)
        {
            estado estado = db.estado.Find(id);

            try
            {
                db.estado.Remove(estado);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            catch
            {
                ViewBag.Error = "No se puede eliminar debido a que existen datos asociados";
            }
            return(View(estado));
        }
Example #23
0
    void Update()
    {
        switch (est)
        {
        case estado.parado:
            if (activar == true)
            {
                est = estado.movimiento;
            }
            break;

        case estado.movimiento:
            Movement();
            break;
        }
    }
Example #24
0
        public estado GetById(int id, ArtexConnection dbContext = null)
        {
            estado consulta = null;

            try
            {
                dbContext = dbContext != null ? dbContext : new ArtexConnection();

                consulta = dbContext.estado.Where(e => e.ID == id).FirstOrDefault();
            }
            catch (Exception e)
            {
            }

            return(consulta);
        }
 public void setManutenção(Login funcionárioQueMandou)
 {
     if (this.status == estado.Disponível)
     {
         this.status = estado.Manutenção;
         this.Estado = SerializarEstado();
         using (var ctx = new DadosContainer())
         {
             ctx.Attach(funcionárioQueMandou);
             var        hist = ctx.HistóricoSet.Where(h => h.Id == this.Histórico.Id).First();
             Manutenção m    = new Manutenção(DateTime.Now, "", funcionárioQueMandou.Funcionário, hist);
             //ctx.AddToManutençãoSet(m);
             ctx.SaveChanges();
         }
     }
 }
Example #26
0
        public List <estado> ObtenerSig(int id)
        {
            List <estado> lista = new List <estado>();
            estado        entidad;

            try
            {
                AbrirConexion();
                StringBuilder CadenaSql = new StringBuilder();

                SqlCommand comandoSelect = new SqlCommand();

                comandoSelect.Connection  = Conexion;
                comandoSelect.CommandType = CommandType.StoredProcedure;
                comandoSelect.CommandText = "DML_Estado";
                comandoSelect.Parameters.AddWithValue("@Sentencia", "Filter");
                comandoSelect.Parameters.AddWithValue("@IdEstado", id);
                using (var dr = comandoSelect.ExecuteReader())
                {
                    while (dr.Read())
                    {
                        entidad           = new estado();
                        entidad.id_estado = int.Parse(dr["id_estado"].ToString());
                        entidad.nombre    = dr["nombre"].ToString();
                        lista.Add(entidad);
                    }
                }
            }
            catch (InvalidCastException ex)
            {
                ApplicationException excepcion = new ApplicationException("Se genero un error de conversión de tipos con el siguiente mensaje: " + ex.Message, ex);
                excepcion.Source = "Insertar estado";
                throw excepcion;
            }
            catch (Exception ex)
            {
                ApplicationException excepcion = new ApplicationException("Se genero un error de aplicación con el siguiente mensaje: " + ex.Message, ex);
                excepcion.Source = "Insertar estado";
                throw excepcion;
            }
            finally
            {
                CerrarConexion();
            }
            return(lista);
        }
Example #27
0
 // Update is called once per frame
 void Update()
 {
     if (estado_puerto == estado.CALCULANDO)
     {
         barra.progreso = (Time.time - tiempoInicial) / 10.0f;
     }
     if (estado_puerto == estado.CALCULADO)
     {
         PlayerPrefs.SetInt(Estado.SPO2, SPO2v);
         PlayerPrefs.SetInt(Estado.RITMOCARDIACO, RITMOCARDIACOv);
         barra.progreso       = 1.0f;
         estado_puerto        = estado.NO_ACTIVIDAD;
         Empezar.interactable = true;
         Mensaje.text         = "SPO2 = " + SPO2v + "\n" +
                                "Ritmo Cardiaco = " + RITMOCARDIACOv;
     }
 }
Example #28
0
 private void inicializa()
 {
     aveServ    = new AveriaServicio(tallerEnt);
     pieServ    = new Pieza_averiaServicio(tallerEnt);
     listaAver  = new ListCollectionView(aveServ.getAll().ToList());
     empServ    = new ServicioGenerico <empleado>(tallerEnt);
     clieServ   = new ServicioGenerico <cliente>(tallerEnt);
     vehServ    = new ServicioGenerico <vehiculo>(tallerEnt);
     tipoServ   = new ServicioGenerico <tipoaveria>(tallerEnt);
     estadoServ = new ServicioGenerico <estado>(tallerEnt);
     producServ = new ServicioGenerico <productos>(tallerEnt);
     pieAveServ = new ServicioGenerico <piezas_averia>(tallerEnt);
     aveNueva   = new averia();
     piNueva    = new piezas_averia();
     tipoAve    = new tipoaveria();
     estadoAve  = new estado();
 }
Example #29
0
        public void SetState(string s)//Establece el estado de la partida segun el string que recibe como parámetro
        {
            switch (s)
            {
            case ("preparacion"):
                this.state = estado.Preparacion;
                break;

            case ("listo"):
                this.state = estado.Listo;
                break;

            default:
                this.state = estado.Jugando;
                break;
            }
        }
Example #30
0
        public void GuardarTest()
        {
            RepositorioBase <estado> db = new RepositorioBase <estado>();
            estado p = new estado();

            p.idestado    = 1;
            p.fechafin    = DateTime.Now;
            p.fechainicio = DateTime.Now;
            p.varchar     = "var";

            RepositorioBase <estado> repositorio = new RepositorioBase <estado>();

            bool paso = false;

            paso = repositorio.Guardar(p);

            Assert.AreEqual(true, paso);
        }
        public static void Initialize(ActividadesComplementariasContext context)
        {
            context.Database.EnsureCreated();
            if (context.estado.Any())
            {
                return;
            }
            var estado = new estado[]
            {
                //
            };

            foreach (estado a in estado)
            {
                context.estado.Add(a);
            }
            context.SaveChanges();
        }
        public ActionResult Create([Bind(Include = "id,fecha,causa,animal_id")] muerte muerte)
        {
            if (ModelState.IsValid)
            {
                var anim = db.animal.Where(a => a.id == muerte.animal_id).FirstOrDefault();
                if (anim.fec_nac == null)
                {
                    int sag = muerte.animal_id;

                    animal ani = db.animal.Where(a => a.id == sag).FirstOrDefault();
                    estado est = db.estado.Where(e => e.nombre == "MUERTO").FirstOrDefault();

                    ani.estado = est;

                    db.muerte.Add(muerte);
                    db.SaveChanges();


                    return(RedirectToAction("Index"));
                }
                else
                {
                    if (anim.fec_nac > muerte.fecha)
                    {
                        ViewBag.Error = "Fecha de muerte no debe ser antes de la fecha de nacimiento del animal";
                    }
                    else
                    {
                        int sag = muerte.animal_id;

                        animal ani = db.animal.Where(a => a.id == sag).FirstOrDefault();
                        estado est = db.estado.Where(e => e.nombre == "MUERTO").FirstOrDefault();

                        ani.estado = est;
                        db.muerte.Add(muerte);
                        db.SaveChanges();
                        return(RedirectToAction("Index"));
                    }
                }
            }

            ViewBag.animal_id = new SelectList(db.animal, "id", "codigo_sag", muerte.animal_id);
            return(View(muerte));
        }
Example #33
0
    // Update is called once per frame
    void Update()
    {
        switch (est)
        {
        case estado.parado:
            if (DetectaJugador())
            {
                est = estado.cayendo;
            }
            break;

        case estado.cayendo:
            anim.SetBool("Activo", true);
            if (m < movVertical)
            {
                bat.Translate(new Vector2(0, -0.2f));
                m = m + 0.2f;
            }
            else
            {
                est = estado.mov;
            }
            break;

        case estado.mov:
            iTween.MoveAdd(gameObject, iTween.Hash("y", speedY, "easeType", "easeinOutSine", "loopType", "pingPong"));
            est = estado.movimiento;
            break;

        case estado.movimiento:
            Movement();
            break;
        }
        if (speedX < 0)
        {
            gameObject.GetComponent <SpriteRenderer> ().flipX = false;
        }
        else
        {
            gameObject.GetComponent <SpriteRenderer> ().flipX = true;
        }
    }
Example #34
0
    private void SPO2_lectura()
    {
        Debug.Log("Empezando a leer bloque SPO2...");

        int command_opcode = Lectura.leer(puerto, "Command Opcode: ");
        if (command_opcode == Lectura.POX_MEASUREMENT_COMPLETE_OK)
        {
            int length = Lectura.leer(puerto, "LENGTH: ");

            // leer desde el dato 0 hasta el dato n
            int[] bloque = Lectura.leerBloque(puerto, length);

            Debug.Log("Datos: " + Lectura.ArrayToString(bloque));

            if (length == 2)
            {
                Debug.Log("SPO2: " + bloque[0]);
                Debug.Log("Heart Rate: " + bloque[1]);
                SPO2v = bloque[0];
                RITMOCARDIACOv = bloque[1];

                estado_puerto = estado.CALCULADO;

                Lectura.cerrarPuerto(puerto);
        //                StartCoroutine(SPO2_DB(10, 1, bloque[0]));
        //                StartCoroutine(SPO2_DB(10, 2, bloque[1]));
            }
        }
    }
Example #35
0
    private void GLU_lectura()
    {
        Debug.Log("Empezando a leer bloque GLU...");

        int ind = Lectura.leer(puerto, "IND: ");
        int m_ready = Lectura.leer(puerto, "M READY: ");
        if (ind == Lectura.IND && m_ready == Lectura.GLU_BLOOD_DETECTED)
        {
            int length = Lectura.leer(puerto, "LENGTH: ");

            ind = Lectura.leer(puerto, "IND: ");
            m_ready = Lectura.leer(puerto, "M READY: ");
            length = Lectura.leer(puerto, "LENGTH: ");

            // leer desde el dato 0 hasta el dato n
            int[] bloque = Lectura.leerBloque(puerto, length);

            Debug.Log("Datos: " + Lectura.ArrayToString(bloque));

            if (length == 2)
            {
                Debug.Log("GLU: " + bloque[1]);
                GLUv = bloque[1];

                estado_puerto = estado.CALCULADO;

                Lectura.cerrarPuerto(puerto);
            }
        }
    }
Example #36
0
        //Metodo que recibe bytes y los agrega a trama[]
        public void CargarBytes(byte[] frame_bytes)
        {
            bool ready = false;

            foreach (byte dato in frame_bytes)
            {
                switch (EstadoActual)
                {
                    case estado.Waiting_Delimiter:
                        if (frame_bytes[0] == 0x7E)
                        {
                            trama.Add(dato);
                            estadoActual = estado.Waiting_MSB;
                        }
                        break;

                    case estado.Waiting_MSB:
                        trama.Add(dato);
                        estadoActual = estado.Waiting_LSB;
                        break;

                    case estado.Waiting_LSB:
                        trama.Add(dato);
                        LSB = dato;
                        estadoActual = estado.Waiting_Data;
                        frameLength = (ushort)(MSB << 8);
                        frameLength = LSB;
                        break;

                    case estado.Waiting_Data:
                        trama.Add(dato);
                        datosLength += 1;
                        if (frameLength == datosLength)
                            estadoActual = estado.Waiting_Checksum;
                        break;

                    case estado.Waiting_Checksum:
                        trama.Add(dato);
                        estadoActual = estado.Ready;
                        ready = true;
                        break;
                }

                if (ready)
                    break;
            }
        }
Example #37
0
 //Metodo para borra contenido de trama[];
 public void BorrarTrama()
 {
     trama.Clear();
     estadoActual = estado.Waiting_Delimiter;
     frameLength = 0;
     MSB = 0;
     LSB = 0;
     datosLength = 0;
 }
        public override Dictionary<string, int> LeerArchivo(bool cargaTipo)
        {
            try
            {
                if (File.Exists(pathFile))
                {
                    using (StreamReader sr = new StreamReader(pathFile))
                    {
                        string s = sr.ReadLine();
                        int cantidadLineas=0;
                        while (s != null)
                        {
                            cantidadLineas++;
                            string[] split = s.Split('=');

                            switch (split[0])
                            {
                                case "IP":
                                    direccionIp = split[1];
                                    nameIp = direccionIp.Split(':')[1];
                                    break;
                                case "IP2":
                                    direccionIp2 = split[1];
                                    nameIp2 = direccionIp2.Split(':')[1];
                                    break;
                                case "PUERTO":
                                    puerto = split[1];
                                    break;
                                case "PATH1":
                                    pathGuardadoInfo1 = split[1];
                                    break;
                                case "PATH2":
                                    pathGuardadoInfo2 = split[1];
                                    break;
                                case "MODO":
                                    modoApertura = (modo)(Convert.ToInt32(split[1]));
                                    break;
                                case "MYSQLTIMEOUT":
                                    mysqlTimeOut = split[1];
                                    break;
                                case "FILTROFECHA":
                                    filtroFecha = (Fecha)(Convert.ToInt32(split[1]));
                                    break;
                                case "NROBOBINA":
                                    nroBobina = split[1];
                                    break;
                                case "FILTROESTADO":
                                    filtroEstado = (estado)(Convert.ToInt32(split[1]));
                                    break;
                                case "IDEESTADO":
                                    Estado = split[1];
                                    break;
                                case "FILTROMAQUINISTA":
                                    filtroMaquinista = (Maquinista)(Convert.ToInt32(split[1]));
                                    break;
                                case "IDMAQUINISTA":
                                    maquinista = split[1];
                                    break;
                                case "FILTROTIPOPAPEL":
                                    filtroTipoPapel = (TipoPapel)(Convert.ToInt32(split[1]));
                                    break;
                                case "IDTIPOPAPEL":
                                    tipoPapel = split[1];
                                    break;
                                case "FILTROCLIENTE":
                                    filtroCliente = (Cliente)(Convert.ToInt32(split[1]));
                                    break;
                                case "IDCLIENTE":
                                    cliente = split[1];
                                    break;
                                case "CAMPOFECHA":
                                    CampoFecha = (campoFecha)(Convert.ToInt32(split[1]));
                                    break;
                                case "PORCENTAJEREMITO":
                                    porcentaje = split[1];
                                    break;
                            }
                            s = sr.ReadLine();
                        }

                        if (cantidadLineas != lineasArchivoDefault)
                        {
                            this.BorrarArchivo();
                            this.armarArchivoDefault();
                            this.guardarFiltros(filtroFecha, nroBobina, filtroEstado, Estado, filtroMaquinista, maquinista, filtroTipoPapel, tipoPapel, filtroCliente, cliente, CampoFecha, porcentaje);
                        }
                    }
                }
                else
                {
                    this.armarArchivoDefault();
                    this.guardarFiltros(filtroFecha, nroBobina, filtroEstado, Estado, filtroMaquinista, maquinista, filtroTipoPapel, tipoPapel, filtroCliente, cliente, CampoFecha, porcentaje);
                }
            }
            catch (Exception e)
            {
                this.BorrarArchivo();
                this.armarArchivoDefault();
                this.guardarFiltros(filtroFecha, nroBobina, filtroEstado, Estado, filtroMaquinista, maquinista, filtroTipoPapel, tipoPapel, filtroCliente, cliente, CampoFecha, porcentaje);
            }
            return null;
        }
 public void guardarFiltros(Fecha filtroFechaParam,string nroBobinaParam,estado filtroEstadoParam,string EstadoParam ,Maquinista filtroMaquinistaParam,string maquinistaParam,TipoPapel filtroTipoPapelParam,string tipoPapelParam,Cliente filtroClienteParam,string clienteParam,campoFecha CampoFechaParam,string porcentajeParam)
 {
     //FILTROS
     this.GuardarArchivo("FILTROFECHA=" + (Convert.ToInt32(filtroFechaParam)).ToString());
     this.GuardarArchivo("NROBOBINA=" + nroBobinaParam);
     this.GuardarArchivo("FILTROESTADO=" + (Convert.ToInt32(filtroEstadoParam)).ToString());
     this.GuardarArchivo("IDEESTADO=" + EstadoParam);
     this.GuardarArchivo("FILTROMAQUINISTA=" + (Convert.ToInt32(filtroMaquinistaParam)).ToString());
     this.GuardarArchivo("IDMAQUINISTA=" + maquinistaParam);
     this.GuardarArchivo("FILTROTIPOPAPEL=" + (Convert.ToInt32(filtroTipoPapelParam)).ToString());
     this.GuardarArchivo("IDTIPOPAPEL=" + tipoPapelParam);
     this.GuardarArchivo("FILTROCLIENTE=" + (Convert.ToInt32(filtroClienteParam)).ToString());
     this.GuardarArchivo("IDCLIENTE=" + clienteParam);
     this.GuardarArchivo("CAMPOFECHA=" + (Convert.ToInt32(CampoFechaParam)).ToString());
     this.GuardarArchivo("PORCENTAJEREMITO=" + porcentajeParam);
 }
Example #40
0
        private void cartelMuerte(TgcD3dInput input)
        {
            GuiController.Instance.Drawer2D.beginDrawSprite();
            fondoMenu.render();

            if ( GuiController.Instance.D3dInput.keyDown(Microsoft.DirectX.DirectInput.Key.M))
            {
                estadoJuego = estado.menu;
            }
            GuiController.Instance.Drawer2D.endDrawSprite();
            textoPerdiste.render();
            player.stop();
        }
Example #41
0
 // Update is called once per frame
 void Update()
 {
     if (estado_puerto == estado.CALCULANDO)
         barra.progreso = (Time.time - tiempoInicial) / 10.0f;
     if (estado_puerto == estado.CALCULADO)
     {
         PlayerPrefs.SetInt(Estado.GLU, GLUv);
         barra.progreso = 1.0f;
         estado_puerto = estado.NO_ACTIVIDAD;
         Empezar.interactable = true;
         Mensaje.text = "GLU = " + GLUv;
     }
 }
Example #42
0
        private void cartelGanador(TgcD3dInput input)
        {
            GuiController.Instance.Drawer2D.beginDrawSprite();
            fondoMenu.render();

            if ( GuiController.Instance.D3dInput.keyDown(Microsoft.DirectX.DirectInput.Key.M))
            {
                puntajeRecord = Int32.Parse(System.IO.File.ReadAllText(alumnoMediaFolder + "\\record.txt"));
                textoPuntajeRecord.Text = "Tu puntaje record es: " + puntajeRecord.ToString();
                estadoJuego = estado.menu;
            }
            GuiController.Instance.Drawer2D.endDrawSprite();
            textoPuntajeFinal.render();
            textoGanaste.render();
            player.stop();
        }
 public List<estado> FiltrarEstado(estado estado)
 {
     return serviceEstado.Filtrar(estado);
 }
Example #44
0
 private void verInstrucciones()
 {
     camaraQ3.LockCam = true;
     GuiController.Instance.Drawer2D.beginDrawSprite();
     fondoMenu.render();
     instrucciones.render();
     GuiController.Instance.Drawer2D.endDrawSprite();
     if (GuiController.Instance.D3dInput.keyDown(Microsoft.DirectX.DirectInput.Key.Back) || GuiController.Instance.D3dInput.keyDown(Microsoft.DirectX.DirectInput.Key.M))
     {
         estadoJuego = estado.menu;
     }
 }
Example #45
0
        /// <summary>
        /// Método que se llama una sola vez,  al principio cuando se ejecuta el ejemplo.
        /// Escribir aquí todo el código de inicialización: cargar modelos, texturas, modifiers, uservars, etc.
        /// Borrar todo lo que no haga falta
        /// </summary>
        public override void init()
        {
            //GuiController.Instance: acceso principal a todas las herramientas del Framework

            //Device de DirectX para crear primitivas
            d3dDevice = GuiController.Instance.D3dDevice;

            rand = new Random();

            //Carpeta de archivos Media del alumno
            alumnoMediaFolder = GuiController.Instance.AlumnoEjemplosMediaDir;

            effect = TgcShaders.loadEffect(alumnoMediaFolder + "Shaders\\viento.fx");

            Control focusWindows = GuiController.Instance.D3dDevice.CreationParameters.FocusWindow;
            mouseCenter = focusWindows.PointToScreen(
                new Point(
                    focusWindows.Width / 2,
                    focusWindows.Height / 2)
                    );

            inicializarTerreno();

            pathMusica = GuiController.Instance.AlumnoEjemplosMediaDir + "Sonidos\\Stayin_alive.mp3";
            GuiController.Instance.Mp3Player.closeFile();
            GuiController.Instance.Mp3Player.FileName = pathMusica;

            player = GuiController.Instance.Mp3Player;

            //player.play(true);

            //Crear Sprite
            mira = new TgcSprite();
            mira.Texture = TgcTexture.createTexture(alumnoMediaFolder + "\\mira.png");
            miraActivada = false;
            mira_zoom = new TgcSprite();
            mira_zoom.Texture = TgcTexture.createTexture(alumnoMediaFolder + "\\mira_zoom3.png");

            arma = new TgcSprite();
            arma.Texture = TgcTexture.createTexture(alumnoMediaFolder + "\\arma.png");

            fuegoArma = new TgcAnimatedSprite(
                GuiController.Instance.ExamplesMediaDir + "\\Texturas\\Sprites\\Explosion.png", //Textura de 256x256
                new Size(64, 64), //Tamaño de un frame (64x64px en este caso)
                16, //Cantidad de frames, (son 16 de 64x64px)
                10 //Velocidad de animacion, en cuadros x segundo
                );

            //Sonidos
            disparo = new TgcStaticSound();
            disparo.loadSound(alumnoMediaFolder + "\\Sonidos\\disparo.wav");

            headshot = new TgcStaticSound();
            headshot.loadSound(alumnoMediaFolder + "\\Sonidos\\Headshot.wav");

            golpe = new TgcStaticSound();
            golpe.loadSound(alumnoMediaFolder + "\\Sonidos\\punch.wav");

            explosion = new TgcStaticSound();
            explosion.loadSound(alumnoMediaFolder + "\\Sonidos\\explosion.wav");

            muerte = new TgcStaticSound();
            muerte.loadSound(alumnoMediaFolder + "\\Sonidos\\gameover.wav");

            ganador = new TgcStaticSound();
            ganador.loadSound(alumnoMediaFolder + "\\Sonidos\\ganador.wav");

            sorpresa = new TgcStaticSound();
            sorpresa.loadSound(alumnoMediaFolder + "\\Sonidos\\sorpresa.wav");

            //Ubicarlo centrado en la pantalla
            screenSize = GuiController.Instance.Panel3d.Size;
            Size textureSize = mira.Texture.Size;
            mira.Scaling = new Vector2(0.6f, 0.6f);
            mira.Position = new Vector2(FastMath.Max(screenSize.Width / 2 - (textureSize.Width * 0.6f) / 2, 0), FastMath.Max(screenSize.Height / 2 - (textureSize.Height * 0.6f) / 2, 0));

            mira_zoom.Scaling = new Vector2((float)screenSize.Width / mira_zoom.Texture.Size.Width, (float)screenSize.Height / mira_zoom.Texture.Size.Height);
            mira_zoom.Position = new Vector2(0, 0);

            Size armaSize = arma.Texture.Size;
            float escalaAncho = (screenSize.Width / 2f) / armaSize.Width;

            arma.Scaling = new Vector2(escalaAncho, escalaAncho);
            arma.Position = new Vector2(screenSize.Width - (armaSize.Width * escalaAncho), screenSize.Height - (armaSize.Height * escalaAncho));

            posicionArmaDisparo = new Vector2(arma.Position.X + 5f, arma.Position.Y + 5f);
            posicionArmaOriginal = arma.Position;

            fuegoArma.Position = arma.Position + new Vector2(22f,28f);

            inicializarArboles();
            inicializarPasto();
            inicializarPiedras();

            totales = new List<TgcMesh>();
            totales.AddRange(arboles);
            totales.AddRange(pasto);
            totales.AddRange(piedras);

            qt = new Quadtree();
            qt.create(totales, bbSkyBox);
            qt.createDebugQuadtreeMeshes();

            //Crear texto vida, básico
            vida = new TgcText2d();
            vida.Text = "100";
            vida.Color = Color.White;
            vida.Size = new Size(300, 100);
            vida.changeFont(new System.Drawing.Font("BankGothic Md BT", 25, FontStyle.Bold));
            vida.Position = new Point(-60, 0);

            barraVida = new TgcSprite();
            barraVida.Texture = TgcTexture.createTexture(alumnoMediaFolder + "\\barra_vida.png");
            barraVida.Position = new Vector2((float)vida.Position.X + 175f, (float)vida.Position.Y);
            barraVida.Scaling = new Vector2(0.3f, 0.3f);

            textoPuntaje = new TgcText2d();
            textoPuntaje.Text = "Puntos: 0";
            textoPuntaje.Color = Color.White;
            textoPuntaje.Size = new Size(300, 100);
            textoPuntaje.changeFont(new System.Drawing.Font("BankGothic Md BT", 25, FontStyle.Bold));
            textoPuntaje.Position = new Point(screenSize.Width - 300, 0);

            TgcSceneLoader loaderLogo = new TgcSceneLoader();
            logoTgc = loaderLogo.loadSceneFromFile(GuiController.Instance.ExamplesMediaDir + "ModelosTgc\\LogoTGC\\LogoTGC-TgcScene.xml").Meshes[0];
            logoTgc.move(new Vector3(0f, 1900f, 0f));
            logoTgc.Scale = new Vector3(14f, 14f, 14f);

            //Cargar Shader de PhongShading
            logoTgc.Effect = GuiController.Instance.Shaders.TgcMeshPhongShader;
            logoTgc.Technique = GuiController.Instance.Shaders.getTgcMeshTechnique(logoTgc.RenderType);
            //Cargar variables shader
            logoTgc.Effect.SetValue("ambientColor", ColorValue.FromColor(Color.Gray));
            logoTgc.Effect.SetValue("diffuseColor", ColorValue.FromColor(Color.LightBlue));
            logoTgc.Effect.SetValue("specularColor", ColorValue.FromColor(Color.White));
            logoTgc.Effect.SetValue("specularExp", 20f);
            logoTgc.Effect.SetValue("lightPosition", lightPos);
            reproducirSorpresa = false;

            //////VARIABLES DE FRUSTUM

            aspectRatio = (float)GuiController.Instance.Panel3d.Width / GuiController.Instance.Panel3d.Height;

            ruedita = 0f;

            //Inicializo angulo de FOV
            anguloFov = FastMath.ToRad(45.0f);

            GuiController.Instance.D3dDevice.Transform.Projection = Matrix.PerspectiveFovLH(anguloFov, aspectRatio, 1f, 50000f);

            ///////////////USER VARS//////////////////
            /*
            //Crear una UserVar
            GuiController.Instance.UserVars.addVar("variablePrueba");

            //Cargar valor en UserVar
            GuiController.Instance.UserVars.setValue("variablePrueba", 5451);
            */

            ///////////////MODIFIERS//////////////////

               /*
            //Crear un modifier para un valor FLOAT
            GuiController.Instance.Modifiers.addFloat("valorFloat", -50f, 200f, 0f);

            //Crear un modifier para un ComboBox con opciones
            string[] opciones = new string[] { "opcion1", "opcion2", "opcion3" };
            GuiController.Instance.Modifiers.addInterval("valorIntervalo", opciones, 0);

            //Crear un modifier para modificar un vértice
            GuiController.Instance.Modifiers.addVertex3f("valorVertice", new Vector3(-100, -100, -100), new Vector3(50, 50, 50), new Vector3(0, 0, 0));
            */

            ///////////////CONFIGURAR CAMARA ROTACIONAL//////////////////
            //Es la camara que viene por default, asi que no hace falta hacerlo siempre
            //GuiController.Instance.RotCamera.Enable = true;
            //Configurar centro al que se mira y distancia desde la que se mira
            //GuiController.Instance.RotCamera.setCamera(new Vector3(0, 0, 0), 300);
            Vector3 posicion = new Vector3(0f, 150f, 0f);
            /*GuiController.Instance.FpsCamera.Enable = true;
            GuiController.Instance.FpsCamera.setCamera(new Vector3(0,120,0), new Vector3(1, 0, 1));
            //GuiController.Instance.FpsCamera.LookAt(new Vector3(0,120,0));
            GuiController.Instance.FpsCamera.JumpSpeed = 0;
            GuiController.Instance.FpsCamera.MovementSpeed *= 10;*/

            GuiController.Instance.FpsCamera.Enable = false;
            GuiController.Instance.RotCamera.Enable = false;

            camaraQ3 = new Q3FpsCamera();
            camaraQ3.setCamera(posicion, posicion + new Vector3(1.0f, 0.0f, 0.0f));
            camaraQ3.RotationSpeed = velocidadAngular;
            camaraQ3.MovementSpeed = velocidadMov;
            camaraQ3.LockCam = false;

            ultimaPosCamara = camaraQ3.getPosition();
            Vector3 posBound = new Vector3(camaraQ3.getPosition().X, camaraQ3.getPosition().Y + 30, camaraQ3.getPosition().Z);
            boundingCamara = new TgcBoundingBox();
            boundingCamScale = new Vector3(1f, 1f, 1f);
            boundingCamara.scaleTranslate(posBound, boundingCamScale);

            personaje = TgcBox.fromSize(new Vector3(30f, 60f, 30f), Color.Red);
            personaje.Position = camaraQ3.getPosition();
            personaje.move(new Vector3(0f, -30f, 0f));

            //ENEMIGOS
            instanciasEnemigos = new List<Enemigo>();
            //El ultimo parametro es el radio
            inicializarEnemigos(4, 4, instanciasEnemigos, 3.4f, 200.0f);

            crearEsferaExplosion();
            inicializarBarriles();

            //Para disparo
            col = new Vector3(0f, 0f, 0f);
            huboDisparo = false;
            disparoBarril = false;
            unaBala = new Bala();
            puntoDisparo = TgcBox.fromSize(new Vector3(10f, 10f, 10f), Color.Red);

            #region menu
            //Defino el estado inicial como menu
            estadoJuego = estado.menu;

            //Sprites para menu
            fondoMenu = new TgcSprite();
            fondoMenu.Texture = TgcTexture.createTexture(alumnoMediaFolder + "\\fondo_menu.jpg");

            titulo = new TgcSprite();
            titulo.Texture = TgcTexture.createTexture(alumnoMediaFolder + "\\Menu\\titulo.png");
            titulo.Scaling = new Vector2(0.5f, 0.5f);
            titulo.Position = new Vector2((screenSize.Width / 2) - titulo.Texture.Width / 4, (titulo.Texture.Height / 2)-50f);

            instrucciones = new TgcSprite();
            instrucciones.Texture = TgcTexture.createTexture(alumnoMediaFolder + "\\Menu\\instrucciones.png");
            instrucciones.Scaling = new Vector2(0.4f, 0.5f);
            instrucciones.Position = new Vector2((screenSize.Width / 2) - (instrucciones.Texture.Width*0.4f) / 2, (instrucciones.Texture.Height / 2) - instrucciones.Texture.Height / 2);

            creditos = new TgcSprite();
            creditos.Texture = TgcTexture.createTexture(alumnoMediaFolder + "\\Menu\\creditos.png");
            creditos.Scaling = new Vector2(0.5f, 0.5f);
            creditos.Position = new Vector2((screenSize.Width / 2) - creditos.Texture.Width / 4, (creditos.Texture.Height / 2) - creditos.Texture.Height / 2);

            botonJugar = new TgcSprite();
            botonJugar.Texture = TgcTexture.createTexture(alumnoMediaFolder + "\\Menu\\boton_jugar.png");
            botonJugar.Scaling = new Vector2(0.5f, 0.5f);
            sizeJugar = botonJugar.Texture.Size;
               // sizeJugar.Width = sizeJugar.Width / 2;
            botonJugar.Position = new Vector2((screenSize.Width / 2)-sizeJugar.Width/4, (screenSize.Height / 2)-sizeJugar.Height/4);

            botonInstrucciones = new TgcSprite();
            botonInstrucciones.Texture = TgcTexture.createTexture(alumnoMediaFolder + "\\Menu\\boton_instrucciones.png");
            botonInstrucciones.Scaling = new Vector2(0.5f, 0.5f);
            sizeInstrucciones = botonInstrucciones.Texture.Size;
            //sizeInstrucciones.Width = sizeInstrucciones.Width / 2;
            botonInstrucciones.Position = new Vector2((screenSize.Width / 2) - sizeInstrucciones.Width / 4, (screenSize.Height / 2) - sizeInstrucciones.Height / 4 + 85f);

            botonCreditos = new TgcSprite();
            botonCreditos.Texture = TgcTexture.createTexture(alumnoMediaFolder + "\\Menu\\boton_creditos.png");
            botonCreditos.Scaling = new Vector2(0.5f, 0.5f);
            sizeCreditos = botonCreditos.Texture.Size;
            //sizeCreditos.Width = sizeCreditos.Width / 2;
            botonCreditos.Position = new Vector2((screenSize.Width / 2) - sizeCreditos.Width / 4, (screenSize.Height / 2) - sizeCreditos.Height / 4 + sizeInstrucciones.Height + 50f);

            textoPerdiste = new TgcText2d();
            textoPerdiste.Text = "Game over";
            textoPerdiste.Align = TgcText2d.TextAlign.CENTER;
            textoPerdiste.Color = Color.Black;
            textoPerdiste.Size = new Size(600, 100);
            textoPerdiste.Position = new Point((screenSize.Width / 2) - textoPerdiste.Size.Width / 2, (screenSize.Height / 2) - textoPerdiste.Size.Height / 2);
            textoPerdiste.changeFont(new System.Drawing.Font("BankGothic Md BT", 50, FontStyle.Bold));

            textoGanaste = new TgcText2d();
            textoGanaste.Text = "Ganaste!";
            textoGanaste.Align = TgcText2d.TextAlign.CENTER;
            textoGanaste.Color = Color.Black;
            textoGanaste.Size = new Size(600, 100);
            textoGanaste.Position = new Point((screenSize.Width / 2) - textoGanaste.Size.Width / 2, (screenSize.Height / 2) - textoGanaste.Size.Height / 2);
            textoGanaste.changeFont(new System.Drawing.Font("BankGothic Md BT", 50, FontStyle.Bold));

            textoPuntajeFinal = new TgcText2d();
            textoPuntajeFinal.Color = Color.Black;
            textoPuntajeFinal.changeFont(new System.Drawing.Font("BankGothic Md BT", 25, FontStyle.Bold));
            textoPuntajeFinal.Size = new Size(800, 100);
            textoPuntajeFinal.Position = new Point((screenSize.Width / 2) - textoPuntajeFinal.Size.Width / 2, (screenSize.Height / 2) - textoPuntajeFinal.Size.Height/2 + textoGanaste.Size.Height);

            textoPuntajeRecord = new TgcText2d();
            textoPuntajeRecord.Color = Color.Black;
            textoPuntajeRecord.Size = new Size(400, 60);
            textoPuntajeRecord.changeFont(new System.Drawing.Font("BankGothic Md BT", 15, FontStyle.Bold));
            textoPuntajeRecord.Position = new Point((screenSize.Width - textoPuntajeRecord.Size.Width),(screenSize.Height-textoPuntajeRecord.Size.Height/2));
            puntajeRecord = Int32.Parse(System.IO.File.ReadAllText(alumnoMediaFolder + "\\record.txt"));
            textoPuntajeRecord.Text = "Tu puntaje record es: " + puntajeRecord.ToString();

            primeraVez = true;
            #endregion menu
        }
 public Result SalvarEstado(estado estado)
 {
     Result retorno = serviceEstado.Salvar(estado);
     return retorno;
 }
 public void setIndicesFiltro(int indexTipoAnioParam, int indexTipoNombreParam, int indexTipoEstadoParam, string dayParam, string monthParam, string yearParam, string dayParam2, string monthParam2, string yearParam2, int idNombreParam, int idEstadoParam, int nroBobinaParam, int indexTipoClienteParam,int indexTipoPapelParam, int tipocampoFechaParam,int idTipoPapelParam,int idClienteParam)
 {
     indexTipoAnio = (Fecha)indexTipoAnioParam;
     indexTipoNombre = (Maquinista)indexTipoNombreParam;
     indexTipoEstado = (estado)indexTipoEstadoParam;
     idEstado = idEstadoParam;
     day = dayParam;
     month = monthParam;
     year = yearParam;
     day2 = dayParam2;
     month2 = monthParam2;
     year2 = yearParam2;
     idNombre = idNombreParam;
     nroBobina = nroBobinaParam;
     indexTipoCliente = (Cliente)indexTipoClienteParam;
     indexTipoPapel = (TipoPapel)indexTipoPapelParam;
     tipocampoFecha = (campoFecha)tipocampoFechaParam;
     idTipoPapel = idTipoPapelParam;
     idCliente= idClienteParam;
 }
        public Result Salvar(estado estado)
        {
            Result retorno = new Result();

            try
            {
                if (estado.ID == Guid.Empty)
                {
                    estado.ID = Guid.NewGuid();
                    repositoryestado.Adicionar(estado);
                }
                else
                {
                    repositoryestado.Alterar(estado);
                }

                context.SaveChanges();

                retorno.Ok("Cadastro realizado com sucesso.");
            }
            catch (Exception erro)
            {
                retorno.Erro(erro.Message);
            }

            return retorno;
        }
Example #49
0
        private void jugar(TgcD3dInput input, float t)
        {
            camaraQ3.LockCam = true;
            camaraQ3.updateCamera();

            // Cargar variables de shader, por ejemplo el tiempo transcurrido.
            effect.SetValue("time", time);

            //El personaje es una caja, uso su bounding box para detectar colisiones
            personaje.Position = camaraQ3.getPosition();
            personaje.move(new Vector3(0f, -30f, 0f));
            //personaje.render();
            //personaje.BoundingBox.render();

            foreach (TgcBoundingBox item in obtenerListaZona(ultimaPosCamara))
            {
                if (TgcCollisionUtils.testAABBAABB(personaje.BoundingBox, item))
                {
                    camaraQ3.setPosition(ultimaPosCamara);
                    //camaraQ3.setCamera(ultimaPosCamara, camaraQ3.getLookAt() + ultimaPosCamara);
                }
            }

            if (GuiController.Instance.D3dInput.keyDown(Microsoft.DirectX.DirectInput.Key.C))
            {
                velocidadEnemigos = velocidadEnemigos + 0.4f;
                if (velocidadEnemigos >= 0f)
                {
                    velocidadEnemigos = 0f;
                }
            }
            if (GuiController.Instance.D3dInput.keyDown(Microsoft.DirectX.DirectInput.Key.V))
            {
                velocidadEnemigos = velocidadEnemigos - 0.4f;
            }

            ajustarZoom();
            ajustarVelocidad();

            renderizarBarriles(t);
            renderizarPiedras();

            //Renderizar suelo y skybox
            piso.render();
            //terreno.render();
            skyBox.render();

            //Emitir un disparo
            if (input.buttonPressed(TgcD3dInput.MouseButtons.BUTTON_LEFT))
            {
                posicionRayBala = camaraQ3.getPosition();
                unaBala.velocidadVectorial = camaraQ3.getLookAt() - camaraQ3.getPosition();
                unaBala.ray = new TgcRay(posicionRayBala, unaBala.velocidadVectorial);
                huboDisparo = true;
                disparo.SoundBuffer.SetCurrentPosition(0);
                disparo.play(false);
            }
            //Reviso si colisiono contra un barril si hubo disparo
            if (huboDisparo)
            {
                foreach (Barril b in barriles)
                {
                    if (!b.fueDisparado && TgcCollisionUtils.intersectRayAABB(unaBala.ray, b.mesh.BoundingBox, out col))
                    {

                        boundingBarril = new TgcBoundingSphere(b.mesh.BoundingBox.calculateBoxCenter(), 400f);
                        disparoBarril = true;
                        barrilDisparado = b;
                        b.fueDisparado = true;
                        if (barriles.TrueForAll(fueDisparado))
                        {
                            reproducirSorpresa = true;
                        }
                        explosion.SoundBuffer.SetCurrentPosition(0);
                        explosion.play(false);
                        huboDisparo = false;
                        break;
                    }
                }
                if (barrilDisparado!=null)
                {
                    //barriles.Remove(barrilDisparado);
                    barrilDisparado = null;
                }
            }

            //Se dibuja siempre al principio, habria que hacer instancias y dibujarlas cada vez que se disparo a un barril en esa posicion

            //Renderizar original e instancias (no dibujo original, solo instancias)
            foreach (Enemigo enemigo in instanciasEnemigos)
            {
                enemigo.meshEnemigo.animateAndRender();
                if (enemigo.estaVivo)
                {
                    rotarMesh(enemigo.meshEnemigo);
                    enemigo.meshEnemigo.moveOrientedY(velocidadEnemigos);
                    enemigo.ultimaPosicion = enemigo.meshEnemigo.Position;
                    foreach (Barril item in barriles)
                    {
                        if (TgcCollisionUtils.testAABBAABB(enemigo.meshEnemigo.BoundingBox, item.mesh.BoundingBox))
                        {
                            enemigo.meshEnemigo.rotateY(FastMath.PI_HALF);
                            enemigo.meshEnemigo.moveOrientedY(velocidadEnemigos);
                        }
                    }
                    foreach (TgcBoundingBox bb in obtenerListaZona(enemigo.meshEnemigo.Position))
                    {
                        if (TgcCollisionUtils.testAABBAABB(enemigo.meshEnemigo.BoundingBox, bb))
                        {
                            enemigo.meshEnemigo.rotateY(FastMath.PI_HALF);
                            enemigo.meshEnemigo.moveOrientedY(velocidadEnemigos);
                        }
                    }

                    //enemigo colisiona contra personaje
                    if(TgcCollisionUtils.classifyBoxBox(enemigo.meshEnemigo.BoundingBox,personaje.BoundingBox) != TgcCollisionUtils.BoxBoxResult.Afuera)
                    {
                        //golpe.SoundBuffer.SetCurrentPosition(0);
                        golpe.play(false);
                        enemigo.meshEnemigo.moveOrientedY(-velocidadEnemigos*5);
                        camaraQ3.setPosition(ultimaPosCamara);
                        numVida -= 20f * t;
                        barraVida.Scaling = new Vector2(0.3f*0.01f * numVida, 0.3f);
                        //Muerte del personaje
                        if (numVida<=0)
                        {
                            camaraQ3.LockCam = false;
                            muerte.SoundBuffer.SetCurrentPosition(0);
                            muerte.play(false);
                            player.stop();
                            //player.closeFile();
                            estadoJuego = estado.muerto;
                        }
                    }

                    if (huboDisparo || disparoBarril)
                    {
                        if (disparoBarril)
                        {
                            if (TgcCollisionUtils.testSphereAABB(boundingBarril,enemigo.meshEnemigo.BoundingBox))
                            {
                                matarEnemigo(enemigo);
                            }
                        }
                        if (TgcCollisionUtils.intersectRayAABB(unaBala.ray, enemigo.meshEnemigo.BoundingBox, out col))
                        {
                            Vector3 p = enemigo.meshEnemigo.BoundingBox.calculateBoxCenter();
                            p.Y = 0f;
                            TgcBoundingBox cuerpoChico = enemigo.meshEnemigo.BoundingBox.clone();
                            cuerpoChico.scaleTranslate(p, new Vector3(1.8f, 3.2f, 1.8f));
                            //se evalua si la bala dio contra el enemigo
                            if (TgcCollisionUtils.intersectRayAABB(unaBala.ray, cuerpoChico, out col))
                            {
                                TgcBoundingBox head = enemigo.meshEnemigo.BoundingBox.clone();
                                head.scaleTranslate(enemigo.meshEnemigo.BoundingBox.calculateBoxCenter() + new Vector3(0.0f, 60f, 5.0f), new Vector3(0.5f, 0.5f, 0.5f));
                                //se evalua si fue un headshot
                                if (TgcCollisionUtils.intersectRayAABB(unaBala.ray, head, out col))
                                {
                                    headshot.SoundBuffer.SetCurrentPosition(0);
                                    headshot.play(false);
                                    puntaje += 20; //el headshot me da 20 puntos mas que un disparo normal
                                }
                                matarEnemigo(enemigo);
                                huboDisparo = false;
                            }
                        }

                    }
                }
                else
                {
                    enemigo.tiempo += t;
                    enemigo.efecto.SetValue("time", enemigo.tiempo);
                }

            }
            huboDisparo = false;
            disparoBarril = false;

            if (instanciasEnemigos.TrueForAll(estaMuerto))
            {
                if (puntaje > Int32.Parse(System.IO.File.ReadAllText(alumnoMediaFolder + "\\record.txt")))
                {
                    textoPuntajeFinal.Text = "Nuevo Record! Tu puntaje fue: " + puntaje.ToString();
                    System.IO.File.WriteAllText(alumnoMediaFolder + "\\record.txt", puntaje.ToString());
                    //textoPuntajeRecord.Text = "Tu puntaje record es: " + puntaje.ToString();
                }
                else
                {
                    textoPuntajeFinal.Text = "Tu puntaje fue: " + puntaje.ToString();
                }
                player.stop();
                camaraQ3.LockCam = false;
                ganador.SoundBuffer.SetCurrentPosition(0);
                ganador.play(false);
                player.stop();
                estadoJuego = estado.ganador;

            }

            //enemigoEffect.SetValue("time", time);

            //Renderizar instancias
            //renderizarTodosLosArboles();
            //renderizarPasto();
            qt.render(GuiController.Instance.Frustum, false);
            ultimaPosCamara = camaraQ3.getPosition();

            //DIBUJOS 2D
            renderSprites(input);
        }
Example #50
0
 private void verCreditos()
 {
     GuiController.Instance.Drawer2D.beginDrawSprite();
     fondoMenu.render();
     creditos.render();
     GuiController.Instance.Drawer2D.endDrawSprite();
     if (GuiController.Instance.D3dInput.keyDown(Microsoft.DirectX.DirectInput.Key.Back) || GuiController.Instance.D3dInput.keyDown(Microsoft.DirectX.DirectInput.Key.M))
     {
         estadoJuego = estado.menu;
     }
 }
Example #51
0
        private void menu(TgcD3dInput input)
        {
            camaraQ3.LockCam = true;
            GuiController.Instance.Drawer2D.beginDrawSprite();

            //Dibujo menu
            fondoMenu.render();
            titulo.render();
            botonJugar.render();
            botonInstrucciones.render();
            botonCreditos.render();

            //Hago click para empezar a jugar
            if (GuiController.Instance.D3dInput.keyDown(Microsoft.DirectX.DirectInput.Key.J))
            {
                if (!primeraVez)
                {
                    barraVida.Scaling = new Vector2(0.3f, 0.3f);
                    velocidadEnemigos = -5f;
                    instanciasEnemigos.Clear();
                    instanciasEnemigos = new List<Enemigo>();
                    barriles.Clear();
                    //loader.loadAnimationFromFile(originalEnemigo, mediaPath + "\\Animations\\Walk-TgcSkeletalAnim.xml");
                    inicializarEnemigos(4, 4, instanciasEnemigos, 3.4f, 200.0f);
                    inicializarBarriles();
                }
                primeraVez = false;
                player.closeFile();
                player.play(true);
                puntaje = 0;
                numVida = 100;
                estadoJuego = estado.jugar;
            }
            if (GuiController.Instance.D3dInput.keyDown(Microsoft.DirectX.DirectInput.Key.I))
            {
                estadoJuego = estado.instrucciones;
            }
            if (GuiController.Instance.D3dInput.keyDown(Microsoft.DirectX.DirectInput.Key.C))
            {
                estadoJuego = estado.creditos;
            }
            GuiController.Instance.Drawer2D.endDrawSprite();
            textoPuntajeRecord.render();
        }
Example #52
0
 //    private int RITMOCARDIACOv = -1;
 // Use this for initialization
 void Start()
 {
     Mensaje.text = "Presione boton empezar...";
     barra.deshabilitar();
     estado_puerto = estado.NO_ACTIVIDAD;
 }
Example #53
0
 // Update is called once per frame
 void Update()
 {
     if (estado_puerto == estado.CALCULANDO)
         barra.progreso = (Time.time - tiempoInicial) / 10.0f;
     if (estado_puerto == estado.CALCULADO)
     {
         PlayerPrefs.SetInt(Estado.SPO2, SPO2v);
         PlayerPrefs.SetInt(Estado.RITMOCARDIACO, RITMOCARDIACOv);
         barra.progreso = 1.0f;
         estado_puerto = estado.NO_ACTIVIDAD;
         Empezar.interactable = true;
         Mensaje.text = "SPO2 = " + SPO2v + "\n" +
                        "Ritmo Cardiaco = " + RITMOCARDIACOv;
     }
 }