Пример #1
0
        public override void update(float elapsedTime, Vida vidaPersona)
        {
            girar();

            Vector3 pos = GuiController.Instance.CurrentCamera.getPosition();
            Vector3 dir_escape = enemigo.mesh.Position - pos;
            float dist = dir_escape.Length();
            dir_escape.Y = 0;

            TgcBoundingBox algo = enemigo.mesh.BoundingBox;
            Vector3 posAnterior = enemigo.mesh.Position;

            enemigo.mesh.playAnimation(enemigo.enemigoAmigacion, true, 20);

            int milisegundosEspera = Juego.Instance.esperaDañoMilisegundos;
            if (Math.Abs(dist) < 100)
            {
                if (Juego.Instance.esperaCorrecta(tiempoDaño, -1, 1, milisegundosEspera))
                {
                    tiempoDaño = DateTime.Now.TimeOfDay;
                    vidaPersona.restaAtaqueEnemigo();
                }
            }
            else
            {
                enemigo.setEstado(new EnemigoPersiguiendo(enemigo));
            }

            enemigo.mesh.updateAnimation();
        }
Пример #2
0
        public override void update(float elapsedTime, Vida vidaPersona)
        {
            girar();

            enemigo.mesh.playAnimation("StandBy", true);

            Vector3 pos = GuiController.Instance.CurrentCamera.getPosition();

            Vector3 dir_escape = enemigo.mesh.Position - pos;
            float dist = dir_escape.Length();
            dir_escape.Y = 0;

            if (Math.Abs(dist) < Juego.getInstance().distanciaParaPerseguir)
            {
                SoundManager.getInstance().playSonidoAviso();
                enemigo.setEstado(new EnemigoPersiguiendo(enemigo));
            }
            else
            {
                enemigo.setPosAnterior(enemigo.mesh.Position);
            }

            enemigo.mesh.updateAnimation();
            enemigo.mesh.updateBoundingBox();
        }
Пример #3
0
        public override void update(float elapsedTime, Vida vidaPersona)
        {
            girar();

            Vector3 pos = GuiController.Instance.CurrentCamera.getPosition();
            Vector3 dir_escape = enemigo.mesh.Position - pos;
            float dist = dir_escape.Length();
            dir_escape.Y = 0;

            TgcBoundingBox algo = enemigo.mesh.BoundingBox;
            Vector3 posAnterior = enemigo.mesh.Position;

            TgcBoundingCylinder cilindroMasCercano = enemigo.escenarioManager.colisionAdistancia(enemigo.enemigoEsfera);
            if (cilindroMasCercano != null)
            {

                Vector3 puntoMasCercano = TgcCollisionUtils.closestPointCylinder(enemigo.enemigoEsfera.Center, cilindroMasCercano);

                Vector3 segmento = puntoMasCercano - enemigo.enemigoEsfera.Center;
                Vector3 tangente = new Vector3(segmento.Z, 0, segmento.X);

                if (Vector3.Cross(segmento, dir_escape).Y <= 0)
                {
                    tangente.Z = tangente.Z * (-1);
                }
                else
                {
                    tangente.X = tangente.X * (-1);
                }

                tangente.Normalize();

                enemigo.mesh.move(tangente * 50 * elapsedTime);
                enemigo.enemigoEsfera.moveCenter(new Vector3(tangente.X * 50 * elapsedTime, 0, tangente.Z * 50 * elapsedTime));
            }
            else
            {
                enemigo.setPosAnterior(enemigo.mesh.Position);
                //Aca se les dice que hagan el movimiento de correr
                enemigo.mesh.move(dir_escape * (-0.4f * elapsedTime));
                enemigo.enemigoEsfera.moveCenter(dir_escape * (-0.4f * elapsedTime));
                enemigo.mesh.playAnimation("Run", true, 20);
                //soundManager.sonidoCaminandoEnemigo();

                //Verificar que no lo golpee tan rapido
                int milisegundosEspera = Juego.getInstance().esperaDañoMilisegundos;
                if (Math.Abs(dist) < 100 && Juego.getInstance().esperaCorrecta(tiempoDaño, -1, 1, milisegundosEspera))
                {
                    enemigo.setEstado(new EnemigoGolpeando(enemigo));
                    //Random rnd = new Random();
                    // Vector3 posNueva = elegirNuevaPosicion(dist, enemigo);
                    //enemigo.setPosicion(new Vector3(-rnd.Next(0, 1000) - 250, 0, -rnd.Next(0, 1000) - 250));
                }
            }

            enemigo.mesh.updateAnimation();
        }
Пример #4
0
        public override void update(float elapsedTime, Vida vidaPersona)
        {
            tiempoMuerto += elapsedTime;
            if (tiempoMuerto <= 3.1415)
            {
                enemigo.sangre = new TgcCylinder(enemigo.sangre.Position, 0, 20 * tiempoMuerto / 2, 0);
                enemigo.sangre.updateValues();
            }

            enemigo.sangre.render();
        }
Пример #5
0
    public GladeApp(Vida vida)
    {
        new GladeApp (args);

                Application.Init();

                Glade.XML gxml = new Glade.XML (null, "soverechatwindow.glade", "windowSovereChat", null);
                gxml.Autoconnect (this);
                button5.Clicked +=  new EventHandler (quit);
                Application.Run();
    }
Пример #6
0
        public override void update(float elapsedTime, Vida vidaPersona)
        {
            tiempoMuerto += elapsedTime;

            if (tiempoMuerto <= 3.1415 / 3)
            {
                float angulo = elapsedTime * 1.5f;
                enemigo.mesh.rotateX(angulo);
            }
            else
            {
                enemigo.setEstado(new EnemigoMuerto(enemigo));
            }
            /*if (tiempoMuerto > 3)
            {
                enemigo.setEstado(new EnemigoMuerto(enemigo));
            }*/
        }
Пример #7
0
    // Use this for initialization
    void Start()
    {
        Animator      animador       = GetComponent <Animator>();
        Vida          vida           = GetComponent <Vida>();
        DetectarRuta  detectorRuta   = GetComponent <DetectarRuta>();
        GeneradoOndas generadorOndas = GetComponentInChildren <GeneradoOndas>();

        este      = GetComponent <Monstruo>();
        este.Rb2D = GetComponent <Rigidbody2D>();
        Cabreo      cabreometro = GetComponentInChildren <Cabreo>();
        Rigidbody2D jugadorP    = GameObject.FindGameObjectWithTag("Player").GetComponent <Rigidbody2D>();

        cabreometro.Iniciar(cabreoMaximo, cabreoUmbral, tasaAumentoDeCabreo, tasaDescensoDeCabreo);
        este.Tipo(TipoMonstruo.Fantasma);

        este.CambiarEstadoMonstruo(estadoInicial);
        este.Comportamiento = () => {
            audioGrito.volume = cabreometro.Nivel();

            este.Rb2D.isKinematic = !(este.EstadoMonstruoActual() == EstadosMonstruo.SiguiendoJugador || este.EstadoMonstruoActual() == EstadosMonstruo.Proyectado);

            switch (este.EstadoMonstruoActual())
            {
            case EstadosMonstruo.Huyendo:
                vida.Invulnerable(true);
                este.Rb2D.velocity = (2 * este.Rb2D.position - cabreometro.JugadorRB().position).normalized * velocidadHuida;
                GiroInstantaneo(este.Rb2D.position - jugadorP.position);
                GameManager.instance.MontruoHuye(TipoMonstruo.Fantasma);
                audioGrito.Stop();
                Destroy(gameObject, 10f);
                break;

            case EstadosMonstruo.Proyectado:
                vida.Invulnerable(true);
                if (Time.time - este.Cronometro > tiempoAturdimiento)
                {
                    este.CambiarEstadoMonstruo(EstadosMonstruo.Quieto);
                }
                break;

            default:
                este.CambiarEstadoMonstruo(cabreometro.CambioCabreo());
                switch (este.EstadoMonstruoActual())
                {
                case EstadosMonstruo.Quieto:
                    Parar();
                    vida.Invulnerable(true);
                    generadorOndas.PararOndas();
                    break;

                case EstadosMonstruo.SiguiendoJugador:
                    vida.Invulnerable(false);
                    MoverseHacia(cabreometro.JugadorRB().position, velocidadPersecucion);
                    generadorOndas.GenerarOndas();
                    break;
                }
                break;
            }
        };

        audioGrito.Play();
        audioGrito.volume = 0f;
        este.Morir        = () =>
        {
            generadorOndas.enabled = false;
            animador.SetTrigger("muriendo");
            GameManager.instance.MonstruoMuerto(TipoMonstruo.Fantasma);
            este.enabled = false;
            este.Rb2D.Sleep();
            este.Rb2D.simulated = false;
            Destroy(generadorOndas.gameObject);
            audioGrito.Stop();
            Destroy(gameObject, 5f);
        };

        este.Atacar = () =>
        {
            animador.SetTrigger("atacando");
            vida.Invulnerable(false);
        };

        este.Atacado = (Jugador a) =>
        {
            if (este.EstadoMonstruoActual() == EstadosMonstruo.SiguiendoJugador)
            {
                este.Empujar(a.transform.position, a.fuerzaEmpujon);
                vida.Danyar(a.Danyo(), TipoMonstruo.Panzudo);
                este.CambiarEstadoMonstruo(EstadosMonstruo.Proyectado);
                cabreometro.Tranquilizar();
            }
        };

        este.FinalAtaque = () =>
        {
            vida.Invulnerable(true);
        };

        este.EntrandoLuz = () =>
        {
            generadorOndas.SumarLuz();
        };

        este.SaliendoLuz = () =>
        {
            generadorOndas.RestarLuz();
        };
    }
Пример #8
0
 void Awake()
 {
     vida = GetComponent <Vida>();
 }
Пример #9
0
    void Update()
    {
        Vector2 currentPosition = new Vector2(transform.position.x, transform.position.y);
        Vector2 newPosition     = currentPosition + velocity * Time.deltaTime;

        Debug.DrawLine(currentPosition, newPosition, Color.green, 30000000000);
        RaycastHit2D[] hits = Physics2D.LinecastAll(currentPosition, newPosition);

        if (hits.Length == 0)
        {
            Invoke("DestroyFireRing", 2);
        }
        else
        {
            CancelInvoke("DestoyProjectile");
            foreach (RaycastHit2D hit in hits)
            {
                GameObject other = hit.collider.gameObject;
                if (other != player)
                {
                    if (other.gameObject.name == "EnemyColliders")
                    {
                        enemyScript = other.transform.parent.gameObject.GetComponent <Vida>();
                        if (other.transform.parent.gameObject.GetComponent <Enemies>() != null)
                        {
                            enemyOther = other.transform.parent.gameObject.GetComponent <Enemies>();
                        }
                        else
                        {
                            Boss = other.transform.parent.gameObject.GetComponent <Boss1>();
                        }
                        if ((other.transform.parent.gameObject.GetComponent <Enemies>() != null && !enemyOther.dead))
                        {
                            enemyScript.TakeDamage(damage);
                            Debug.Log(enemyScript.currentHealth);
                            GameObject explosion = Instantiate(explosionPrefab, transform.position, Quaternion.identity);
                            explosion.GetComponent <AudioSource>().volume = 0.2f;
                            Destroy(explosion, 2.3f);
                            Destroy(gameObject);
                            Debug.Log(other.name);
                        }
                        if (other.transform.parent.gameObject.GetComponent <Boss1>() != null)
                        {
                            enemyScript.TakeDamage(damage);
                            Debug.Log(enemyScript.currentHealth);
                            GameObject explosion = Instantiate(explosionPrefab, transform.position, Quaternion.identity);
                            explosion.GetComponent <AudioSource>().volume = 0.2f;
                            Destroy(explosion, 2.3f);
                            Destroy(gameObject);
                            Debug.Log(other.name);
                        }
                        break;
                    }
                    if (other.CompareTag("TopWalls") || other.CompareTag("BottomWalls") || other.CompareTag("Obstacle"))
                    {
                        Destroy(gameObject);
                        GameObject explosion = Instantiate(explosionPrefab, transform.position, Quaternion.identity);
                        explosion.GetComponent <AudioSource>().volume = 0.2f;
                        Destroy(explosion, 2.3f);
                        Debug.Log(other.name);
                        break;
                    }
                }
            }
        }

        transform.position = newPosition;
    }
Пример #10
0
 public Vida(Vida vida)
 {
     objetoRoca = vida.objetoRoca;
     tablero = vida.tablero;
     especies = vida.especies;
     especiesVegetales = vida.especiesVegetales;
     especiesAnimales = vida.especiesAnimales;
     tiposEdificios = vida.tiposEdificios;
     seres = vida.seres;
     vegetales = vida.vegetales;
     animales = vida.animales;
     edificios = vida.edificios;
     //numMaxTurnos = vida.numMaxTurnos;
     //turnoActual = vida.turnoActual;
     //listadoSeresTurnos = vida.listadoSeresTurnos;
     idActualVegetal = vida.idActualVegetal;
     idActualAnimal = vida.idActualAnimal;
     idActualEdificio = vida.idActualEdificio;
     posicionesColindantes = FuncTablero.calculaPosicionesColindantes();
 }
Пример #11
0
 // Start is called before the first frame update
 void Start()
 {
     vida = GetComponent <Vida>();
     totalLifeText.text = "100";
 }
Пример #12
0
 void Start()
 {
     _turn   = true;
     _vidaP1 = _p1.GetComponent <Vida>();
     _vidaP2 = _p2.GetComponent <Vida>();
 }
Пример #13
0
 private static Vegetal getVegetalNoSerializable(Vida vida, VegetalSerializable veg)
 {
     int idSer = veg.idSer;
     EspecieVegetal especieVeg = getEspecieVegNoSerializable(vida, veg.especie);
     int posX = veg.posX;
     int posY = veg.posY;
     List<GameObject> modelo = new List<GameObject>();
     for (int i = 0; i < 4; i++) {
         modelo.Add(getModeloNoSerializableReal(veg.modelo, vida.posicionAleatoriaVegetal(veg.posX, veg.posY)));
     }
     int indiceHabitat = veg.indiceHabitat;
     int turnosEvolucion = veg.turnosEvolucion;
     int numVeg = veg.numVegetales;
     List<float> habitabilidad = new List<float>();
     for (int i = 0; i < veg.habitabilidad.Count; i++) {
         habitabilidad.Add(veg.habitabilidad[i]);
     }
     return new Vegetal(idSer, especieVeg, posX, posY, habitabilidad, indiceHabitat, modelo, numVeg, turnosEvolucion);
 }
Пример #14
0
 private void Start()
 {
     rgbd   = gameObject.GetComponent <Rigidbody2D>();
     vida   = GetComponent <Vida>();
     sprite = GetComponent <SpriteRenderer>();
 }
 private void Awake()
 {
     vida_ref            = GameObject.Find("Tanque").GetComponent <Vida>();
     tanqueMovimento_ref = GameObject.Find("Tanque").GetComponent <TanqueMovimento>();
 }
Пример #16
0
 private static TipoEdificio getTipoEdifNoSerializable(Vida vida, int tipoEdi)
 {
     return vida.tiposEdificios[tipoEdi];
 }
Пример #17
0
    private void creacionInicial()
    {
        Debug.Log(FuncTablero.formateaTiempo() + ": Iniciando la creacion con textura...");
        //Trabajar con la textura Textura_Planeta y crear el mapa lógico a la vez
        Texture2D texturaBase = objetoRoca.renderer.sharedMaterial.mainTexture as Texture2D;

//		Texture2D texturaBase = texturaRuido;

        Color[] pixels = new Color[texturaBase.width * texturaBase.height];
        FuncTablero.inicializa(texturaBase);
        Debug.Log(FuncTablero.formateaTiempo() + ": Creando y exportando ruido...");
        pixels = FuncTablero.ruidoTextura();                                                                                            //Se crea el ruido para la textura base y normales...
        texturaBase.SetPixels(pixels);
        texturaBase.Apply();
        byte[] bytes = texturaBase.EncodeToPNG();
        File.WriteAllBytes(Application.dataPath + "/ScreenTexturas/01TrasRuido.png", bytes);
        Debug.Log(FuncTablero.formateaTiempo() + ": Completado. Suavizando polos y bordes...");
        pixels = FuncTablero.suavizaBordeTex(pixels, texturaBase.width / 20);                           //Se suaviza el borde lateral...
        texturaBase.SetPixels(pixels);
        texturaBase.Apply();
        bytes = texturaBase.EncodeToPNG();
        File.WriteAllBytes(Application.dataPath + "/ScreenTexturas/02TrasSuavizadoBorde.png", bytes);
        pixels = FuncTablero.suavizaPoloTex(pixels);                                                                            //Se suavizan los polos...
        texturaBase.SetPixels(pixels);
        texturaBase.Apply();
        bytes = texturaBase.EncodeToPNG();
        File.WriteAllBytes(Application.dataPath + "/ScreenTexturas/03TrasSuavizadoPolos.png", bytes);
        Debug.Log(FuncTablero.formateaTiempo() + ": Extruyendo vertices de la roca...");
        float      extrusion = 0.45f;
        MeshFilter Roca      = objetoRoca.GetComponent <MeshFilter>();
        Mesh       meshTemp  = Roca.mesh;

        meshTemp  = FuncTablero.extruyeVerticesTex(meshTemp, texturaBase, extrusion, objetoRoca.transform.position);
        Roca.mesh = meshTemp;
        Debug.Log(FuncTablero.formateaTiempo() + ": Completado. Construyendo collider...");
        //Se añade el collider aqui, para que directamente tenga la mesh adecuada
        objetoRoca.AddComponent <MeshCollider>();
        objetoRoca.GetComponent <MeshCollider>().sharedMesh = meshTemp;
        Debug.Log(FuncTablero.formateaTiempo() + ": Completado. Calculando y extruyendo vertices del oceano...");
        MeshFilter Agua     = objetoOceano.GetComponent <MeshFilter>();
        Mesh       meshAgua = Agua.mesh;

        meshAgua  = FuncTablero.extruyeVerticesValor(meshAgua, FuncTablero.getNivelAgua(), extrusion, objetoOceano.transform.position);
        Agua.mesh = meshAgua;
        Debug.Log(FuncTablero.formateaTiempo() + ": Completado. Rellenando detalles...");
//		//se ajusta la propiedad de nivel de agua del shader
        objetoOceano.renderer.sharedMaterial.SetFloat("_nivelMar", FuncTablero.getNivelAgua());
        objetoOceano.renderer.sharedMaterial.SetFloat("_tamPlaya", FuncTablero.getTamanoPlaya());

        Debug.Log(FuncTablero.formateaTiempo() + ": Terminado. Cargando texturas de habitats...");
//		//obtener la textura de habitats del array de materiales de roca. Habitats esta en la 1ª posicion.
        Texture2D texElems            = objetoRoca.renderer.sharedMaterials[2].mainTexture as Texture2D;
        Texture2D texHabitatsEstetica = objetoRoca.renderer.sharedMaterials[1].mainTexture as Texture2D;
        Texture2D texHabitats         = objetoRoca.renderer.sharedMaterials[1].GetTexture("_FiltroTex") as Texture2D;

        Debug.Log(FuncTablero.formateaTiempo() + ": Terminado. Creando el tablero...");
        Casilla[,] tablero = FuncTablero.iniciaTablero(texturaBase, texHabitats, texHabitatsEstetica, texElems, Roca.mesh, objetoRoca.transform.position);
//		Casilla[,] tablero = FuncTablero.iniciaTablero(texturaBase, texHabitats, texHabitatsEstetica, texElems, Roca.sharedMesh, objetoRoca.transform.position);
        Debug.Log(FuncTablero.formateaTiempo() + ": Terminado. Creando Vida...");
        vida = new Vida(tablero, objetoRoca.transform);
        Debug.Log(FuncTablero.formateaTiempo() + ": Completada la creacion de prueba.");
    }
        /// <summary>
        /// Carrega as farmácias cadastradas na unidade escolhido pelo usuário quando este efetua seu login.
        /// </summary>
        /// <param name="unidade"></param>
        private void CarregaFarmaciasUnidade(Vida.Model.EstabelecimentoSaude unidade)
        {
            //FarmaciaBsn farmaciaBsn = new FarmaciaBsn();
            //IList<Farmacia> farmacias = farmaciaBsn.buscarPorUnidade(unidade.Codigo);
            IFarmacia ifarmacia = Factory.GetInstance<IFarmacia>();
            IList<Vida.Model.Farmacia> farmacias = ifarmacia.BuscarPorEstabelecimentoSaude<Vida.Model.Farmacia>(unidade.Codigo);

            ddlFarmacia.Items.Add(new ListItem("Selecione...", "0"));

            foreach (Vida.Model.Farmacia farmacia in farmacias)
                ddlFarmacia.Items.Add(new ListItem(farmacia.Nome, farmacia.Codigo.ToString()));

            if (farmacias != null && farmacias.Count == 1)
            {
                ddlFarmacia.SelectedValue = farmacias[0].Codigo.ToString();
                ddlFarmacia.Enabled = false;
            }
        }
Пример #19
0
 void Start()
 {
     vidajugador = GameObject.Find("sprite").GetComponent <Vida>();
 }
Пример #20
0
 private void Start()
 {
     vida = GetComponentInParent <Vida>();
 }
 public Hipotecario()
 {
     CoberturasVida = new List<Cobertura>();
     CoberturasVivienda = new List<Cobertura>();
     Saldos = new List<Saldo>();
     vivienda = new Vivienda();
     vida = new Vida();
 }
Пример #22
0
 // Start is called before the first frame update
 void Start()
 {
     jugador = GetComponent <LogicaJugador>();
     vida    = GetComponent <Vida>();
 }
Пример #23
0
 void Update()
 {
     if (TutorialActivo == 1 && (DificultadGameMode != 4 && DificultadGameMode != 3))
     {
         if (GestorPuntos.PuntosGeneral > 0 && PasosTutorial == 0)
         {
             PanelTutorial.SetActive(true);
             _TextoInfo.text    = "¡Bien hecho!, trata de nuevo";
             TextoSuperior.text = "Tutorial Salto";
             PasosTutorial      = 1;
         }
         if (MovimientoBases.ConteoSaltos == 5 && PasosTutorial == 1)//Genero la  primera moneda
         {
             PanelTutorial.SetActive(true);
             _TextoInfo.text    = "Recoge oro durante la partida y utilizalo para desbloquear objetos en la tienda";
             TextoSuperior.text = "Tutorial Oro";
             Oro.SetActive(true);
             BotonB.SetActive(false);
             PasosTutorial = 2;
         }
         if (MovimientoBases.ConteoSaltos == 7 && PasosTutorial == 2)//Genero la primera vida
         {
             PanelTutorial.SetActive(true);
             _TextoInfo.text    = "Recoge vidas durante la partida, si caes en el salto la perderas";
             TextoSuperior.text = "Tutorial Vidas";
             Oro.SetActive(false);
             Vida.SetActive(true);
             PasosTutorial = 3;
             Invoke("CerrarPanel", 5);
         }
         if (GestorPuntos.PuntosGeneral >= 100 && PasosTutorial == 3)//Genera primera piraña
         {
             PanelTutorial.SetActive(true);
             _TextoInfo.text    = "Deshazte de los enemigos presionando(A) para calcular la altura y luego(B) para disparar";
             TextoSuperior.text = "Tutorial Enemigos";
             BotonB2.SetActive(true);
             Vida.SetActive(false);
             PasosTutorial = 4;
             Invoke("CerrarPanel", 5);
         }
         if (GestorPuntos.PuntosGeneral >= 200 && PasosTutorial == 4)//Genera ave
         {
             PanelTutorial.SetActive(true);
             _TextoInfo.text    = "Ten cuidado con las bombas, te pueden impulsar fuera de las bases, puedes dispararles para que caigan antes de tiempo";
             TextoSuperior.text = "Tutorial Bomba";
             Bomba.SetActive(true);
             BotonB2.SetActive(false);
             PasosTutorial = 5;
             Invoke("CerrarPanel", 6);
         }
         if (MovimientoBases.ConteoSaltos == 29 && PasosTutorial == 5)//Genero multipicador
         {
             PanelTutorial.SetActive(true);
             _TextoInfo.text    = "Mientras este activo recibes el doble de puntos por base y el doble de vidas";
             TextoSuperior.text = "Multiplicador";
             Bomba.SetActive(false);
             Multiplicador.SetActive(true);
             PasosTutorial = 6;
             Invoke("CerrarPanel", 6);
         }
         if (MovimientoBases.ConteoSaltos == 49 && PasosTutorial == 6)//Genero especial
         {
             PanelTutorial.SetActive(true);
             _TextoInfo.text    = "Mientras este activo recibes una moneda por cada salto y recibes puntos por cada enemigo que elimines";
             TextoSuperior.text = "Especial";
             Multiplicador.SetActive(false);
             Especial.SetActive(true);
             PasosTutorial = 7;
             Invoke("CerrarPanel", 8);
         }
         if (MovimientoBases.ConteoSaltos == 53 && PasosTutorial == 7)
         {
             PanelTutorial.SetActive(true);
             _TextoInfo.text    = "Llega a 1000 puntos y acaba con el enemigo final, disparando a sus puntos debiles";
             TextoSuperior.text = "Objetivo";
             Especial.SetActive(false);
             Globo.SetActive(true);
             PasosTutorial = 8;
             Invoke("CerrarPanel", 6);
         }
         if (MovimientoBases.ConteoSaltos == 57 && PasosTutorial == 8)//Genero la primera moneda
         {
             PanelTutorial.SetActive(true);
             _TextoInfo.text    = "Puedes volver a activarlo en las configuraciones";
             TextoSuperior.text = "Fin del tutorial";
             PlayerPrefs.SetInt("Tutorial", 0);
             Globo.SetActive(false);
             blue.SetActive(true);
             PasosTutorial = 9;
             Invoke("CerrarPanel", 10);
         }
     }
     else
     {
         if (DificultadGameMode != 4 && DificultadGameMode != 3)
         {
             PanelTutorial.SetActive(false);//Si no esta activo el modo tutorial desactivamos la visibilidad del panel
         }
     }
     if (GestorPuntos.VidasT <= 0 && DificultadGameMode != 4)
     {
         CerrarPanel();
     }
 }
Пример #24
0
    /* Construye un archivo con los datos del tablero Vida a partir de
     * unos datos serializables.
     */
    private static void rehacerVida(ref Vida vida, VidaSerializable vidaSerializable)
    {
        vida.idActualAnimal = vidaSerializable.idActualAnimal;
        vida.idActualEdificio = vidaSerializable.idActualEdificio;
        vida.idActualVegetal = vidaSerializable.idActualVegetal;

        vida.posicionesColindantes = new List<Tupla<int,int>>();
        for (int i = 0; i < vidaSerializable.posicionesColindantes.Count; i++) {
            Tupla<int,int> tupla = new Tupla<int, int>(vidaSerializable.posicionesColindantes[i].e1, vidaSerializable.posicionesColindantes[i].e2);
            vida.posicionesColindantes.Add(tupla);
        }
        rehacerTablero(vidaSerializable.tablero, ref vida.tablero);
    }
Пример #25
0
 // Use this for initialization
 void Start()
 {
     rb2D          = GetComponent <Rigidbody2D>();
     vidaTransform = GameObject.FindGameObjectWithTag("Player").GetComponent <Transform>();
     player        = GameObject.FindWithTag("Player").GetComponent <Vida>();
 }
        public Vida CotizaVidaPRYBE(string Credito, string Plazo, string AnoCredito)
        {
            Vida cotizacion = new Vida();            
            List<Saldo> saldos = new List<Saldo>();

            double tarVida, tasaInteres, mensualidad;

            int i;

            double tmpArriba, tmpAbajo;

            try
            {

                tarVida = Convert.ToDouble(System.Configuration.ConfigurationManager.AppSettings["TarifaVida"].ToString());
                tasaInteres = Convert.ToDouble(System.Configuration.ConfigurationManager.AppSettings["InteresVida"].ToString());
                tasaInteres = (tasaInteres / 100);

                tmpArriba = ((tasaInteres) * Math.Pow(1 + tasaInteres, Convert.ToDouble(Plazo)));
                tmpAbajo = ((Math.Pow(1 + tasaInteres, Convert.ToDouble(Plazo))) - 1);

                mensualidad = (Convert.ToDouble(Credito) * (tmpArriba / tmpAbajo));

                double saldoAnterior = Convert.ToDouble(Credito);

                for (i = 0; i <= (Convert.ToInt32(Plazo)); i++)
                {
                    double saldoInsoluto, cuotaVida, interes, capital;
                    Saldo tmp = new Saldo();

                    if (i == 0)
                    {
                        saldoInsoluto = saldoAnterior;
                        cuotaVida = (saldoInsoluto * tarVida);

                        tmp.Periodo = i;
                        tmp.Pago = mensualidad;
                        tmp.Capital = 0.00;
                        tmp.Interes = 0.00;
                        tmp.SaldoInsoluto = saldoInsoluto;
                        tmp.CuotaVida = cuotaVida;
                    }
                    else
                    {

                        interes = (saldoAnterior * tasaInteres);
                        capital = (mensualidad - interes);
                        saldoInsoluto = (saldoAnterior - capital);
                        cuotaVida = (saldoInsoluto * tarVida);

                        tmp.Periodo = i;
                        tmp.Pago = mensualidad;
                        tmp.Capital = capital;
                        tmp.Interes = interes;
                        tmp.SaldoInsoluto = saldoInsoluto;
                        tmp.CuotaVida = cuotaVida;
                    }
                    saldos.Add(tmp);

                    saldoAnterior = saldoInsoluto;
                }
                               

                cotizacion.HTMLString = GeneraCorridaHTML(saldos);

                int mesInicio, mesFin;
                int noMeses;

                noMeses = ((Convert.ToInt32(AnoCredito) + 1) * 12);

                mesFin = noMeses - 1;
                mesInicio = noMeses - 12;

                double primaTotal, pagoMensual;

                primaTotal = 0.00;
                pagoMensual = 0.00;

                for (i = mesInicio; i <= mesFin; i++)
                {
                    Saldo saldo;

                    saldo = saldos.ElementAt(i);
                    primaTotal += saldo.CuotaVida;

                    saldo.Interes = Math.Round(saldo.Interes, 2);
                    saldo.CuotaVida = Math.Round(saldo.CuotaVida, 2);
                    saldo.Pago = Math.Round(saldo.Pago, 2);
                    saldo.SaldoInsoluto = Math.Round(saldo.SaldoInsoluto, 2);
                    saldo.Capital = Math.Round(saldo.Capital, 2);

                    cotizacion.saldos.Add(saldo);
                }

                pagoMensual = ((primaTotal / 12));

                cotizacion.PrimaTotal = Convert.ToString(primaTotal);
                cotizacion.PagoMensual = Convert.ToString(pagoMensual);

                Cobertura tmp1 = new Cobertura();
                Cobertura tmp2 = new Cobertura();
                Cobertura tmp3 = new Cobertura();
                Cobertura tmp4 = new Cobertura();

                tmp1.Id = "1";
                tmp1.Descripcion = "COBERTURA BASICA";
                tmp1.SumaAseg = "SALDO INSOLUTO";
                cotizacion.coberturas.Add(tmp1);

                tmp2.Id = "2";
                tmp2.Descripcion = "INVALIDEZ TOTAL Y PERMANENTE";
                tmp2.SumaAseg = "AMPARADA";
                cotizacion.coberturas.Add(tmp2);

                tmp3.Id = "3";
                tmp3.Descripcion = "COBERTURA POR DESEMPLEO";
                tmp3.SumaAseg = "AMPARADA";
                cotizacion.coberturas.Add(tmp3);

                tmp4.Id = "4";
                tmp4.Descripcion = "FALLECIMIENTO DEL COACREDITADO";
                tmp4.SumaAseg = "AMPARADA";
                cotizacion.coberturas.Add(tmp4);
            }
                 
            catch (Exception ex)
            {
                cotizacion.ErrorBool = true;
                cotizacion.ErrorDesc = ex.Message;
            }

            return cotizacion;
        }
Пример #27
0
 public static void colocarSeresTablero(ref Vida vida, VidaSerializable vidaSerializable)
 {
     //Variables de Vida
     vida.animales = new List<Animal>();
     for (int i = 0; i < vidaSerializable.animales.Count; i++) {
         vida.animales.Add(getAnimalNoSerializable(vida, vidaSerializable.animales[i]));
     }
     vida.vegetales = new List<Vegetal>();
     for (int i = 0; i < vidaSerializable.vegetales.Count; i++) {
         vida.vegetales.Add(getVegetalNoSerializable(vida, vidaSerializable.vegetales[i]));
     }
     vida.edificios = new List<Edificio>();
     for (int i = 0; i < vidaSerializable.edificios.Count; i++) {
         vida.edificios.Add(getEdificioNoSerializable(vida, vidaSerializable.edificios[i]));
     }
     vida.seres = new List<Ser>();
     //Rehacer metiendole todos los demas seres ya cargados
     for (int i = 0; i < vida.edificios.Count; i++) {
         vida.seres.Add(vida.edificios[i]);
     }
     for (int i = 0; i < vida.vegetales.Count; i++) {
         vida.seres.Add(vida.vegetales[i]);
     }
     for (int i = 0; i < vida.animales.Count; i++) {
         vida.seres.Add(vida.animales[i]);
     }
     recolocarSeresTablero(vida.seres, ref vida.tablero);
 }
Пример #28
0
 void Start()
 {
     vidajugador = GameObject.Find("Player").GetComponent <Vida>();
 }
Пример #29
0
    /* Construye un archivo con los datos de la clase Vida que es serializable
     * a partir de unos datos de Vida no serializables.
     */
    private static void generarVidaSerializable(Vida vida, ref VidaSerializable vidaSerializable)
    {
        vidaSerializable = new VidaSerializable();
        vidaSerializable.animales = new List<AnimalSerializable>();
        for (int i = 0; i < vida.animales.Count; i++) {
            vidaSerializable.animales.Add(getAnimalSerializable(vida.animales[i]));
        }
        vidaSerializable.vegetales = new List<VegetalSerializable>();
        for (int i = 0; i < vida.vegetales.Count; i++) {
            vidaSerializable.vegetales.Add(getVegetalSerializable(vida.vegetales[i]));
        }
        vidaSerializable.edificios = new List<EdificioSerializable>();
        for (int i = 0; i < vida.edificios.Count; i++) {
            vidaSerializable.edificios.Add(getEdificioSerializable(vida.edificios[i]));
        }
        vidaSerializable.idActualAnimal = vida.idActualAnimal;
        vidaSerializable.idActualEdificio = vida.idActualEdificio;
        vidaSerializable.idActualVegetal = vida.idActualVegetal;

        vidaSerializable.posicionesColindantes = new List<Tupla<int,int>>();
        for (int i = 0; i < vida.posicionesColindantes.Count; i++) {
            Tupla<int,int> tupla = new Tupla<int, int>(vida.posicionesColindantes[i].e1, vida.posicionesColindantes[i].e2);
            vidaSerializable.posicionesColindantes.Add(tupla);
        }

        generarTableroSerializable(vida.tablero, ref vidaSerializable.tablero);
    }
Пример #30
0
 private static Animal getAnimalNoSerializable(Vida vida, AnimalSerializable ani)
 {
     int idSer = ani.idSer;
     EspecieAnimal especieAni = getEspecieAniNoSerializable(vida, ani.especie);
     int posX = ani.posX;
     int posY = ani.posY;
     GameObject modelo = getModeloNoSerializableReal(ani.modelo, vida.tablero[ani.posX, ani.posY].coordsVert);
     int res = ani.reserva;
     int repr = ani.turnosParaReproduccion;
     int aguante = ani.aguante;
     tipoEstadoAnimal estado = ani.estado;
     return new Animal(idSer, especieAni, posX, posY, res, repr, modelo, aguante, estado);
 }
Пример #31
0
 private static Edificio getEdificioNoSerializable(Vida vida, EdificioSerializable edi)
 {
     int idSer = edi.idSer;
     TipoEdificio tipoEdif = getTipoEdifNoSerializable(vida, edi.tipo);
     int posX = edi.posX;
     int posY = edi.posY;
     int eneCons = edi.energiaConsumidaPorTurno;
     int compBaCons = edi.compBasConsumidosPorTurno;
     int compAvCons = edi.compAvzConsumidosPorTurno;
     int matBioCons = edi.matBioConsumidoPorTurno;
     int eneProd = edi.energiaProducidaPorTurno;
     int compBaProd = edi.compBasProducidosPorTurno;
     int compAvProd = edi.compAvzProducidosPorTurno;
     int matBioProd = edi.matBioProducidoPorTurno;
     float eficiencia = edi.eficiencia;
     int numMetales = edi.numMetales;
     int matBioSin = edi.matBioSinProcesar;
     int radioAccion = edi.radioAccion;
     List<Tupla<int, int, bool>> matrizRadioAccion = new List<Tupla<int, int, bool>>();
     for (int i = 0; i < edi.matrizRadioAccion.Count; i++) {
         Tupla<int, int, bool> tupla = new Tupla<int, int, bool>();
         tupla.e1 = edi.matrizRadioAccion[i].e1;
         tupla.e2 = edi.matrizRadioAccion[i].e2;
         tupla.e3 = edi.matrizRadioAccion[i].e3;
         matrizRadioAccion.Add(tupla);
     }
     GameObject modelo = getModeloNoSerializableReal(edi.modelo, vida.tablero[edi.posX, edi.posY].coordsVert);
     return new Edificio(idSer, tipoEdif, posX, posY, eficiencia, numMetales, matrizRadioAccion, radioAccion, modelo, eneCons, compBaCons, compAvCons, matBioCons, eneProd, compBaProd, compAvProd, matBioProd, matBioSin);
 }
Пример #32
0
    void Update()
    {
        Vector2 currentPosition = new Vector2(transform.position.x, transform.position.y);
        Vector2 newPosition     = currentPosition + velocity * Time.deltaTime;

        Debug.DrawLine(currentPosition + offset, newPosition + offset, Color.green, 30000000000);

        RaycastHit2D[] hits = Physics2D.LinecastAll(currentPosition + offset, newPosition + offset);

        if (hits.Length == 0)
        {
            Invoke("DestoyProjectile", 2);
        }
        else
        {
            CancelInvoke("DestoyProjectile");
            foreach (RaycastHit2D hit in hits)
            {
                GameObject other = hit.collider.gameObject;
                if (other != player)
                {
                    if (other.gameObject.name == "EnemyColliders")
                    {
                        enemyHealth = other.transform.parent.gameObject.GetComponent <Vida>();
                        if (other.transform.parent.gameObject.GetComponent <Enemies>() != null)
                        {
                            enemyOther = other.transform.parent.gameObject.GetComponent <Enemies>();
                        }
                        else
                        {
                            Boss = other.transform.parent.gameObject.GetComponent <Boss1>();
                        }
                        //realDamage = (iceDamage / enemyHealth.damageReduction);
                        realDamage = iceDamage;
                        if ((other.transform.parent.gameObject.GetComponent <Enemies>() != null && !enemyOther.dead) || (other.transform.parent.gameObject.GetComponent <Boss1>() != null && Boss.vida.currentHealth != 0))
                        {
                            if (gameObject.CompareTag("Iceball"))
                            {
                                if (realDamage > 0 && iceCanDamage)
                                {
                                    if (other.transform.parent.gameObject.GetComponent <Enemies>() != null)
                                    {
                                        enemySpeed       = enemyOther.speed;
                                        enemyOther.speed = (enemyOther.speed / freeze);
                                        Debug.Log("Enemy mv" + enemyOther.speed);
                                    }
                                    enemyHealth.TakeDamage(realDamage);
                                    canHitWall = false;
                                    GameObject explosion = Instantiate(explosionPrefab, transform.position, Quaternion.identity);
                                    Destroy(explosion, 2.3f);

                                    Debug.Log("Damage Dealt: " + realDamage);
                                    Debug.Log(enemyHealth.currentHealth);
                                    Debug.Log(other.name);
                                    StartCoroutine(Freezing());
                                }


                                IEnumerator Freezing()
                                {
                                    iceCanDamage = false;
                                    gameObject.GetComponent <SpriteRenderer>().enabled = false;
                                    yield return(new WaitForSeconds(1));

                                    iceCanDamage = true;
                                    if (other.transform.parent.gameObject.GetComponent <Enemies>() != null)
                                    {
                                        enemyOther.speed = enemySpeed;
                                        Debug.Log("Enemy mv" + enemyOther.speed);
                                    }
                                    Destroy(gameObject);
                                }
                            }
                            else
                            {
                                realDamage = fireDamage;
                                //realDamage = (fireDamage / enemyHealth.damageReduction);
                                enemyHealth.TakeDamage(realDamage);

                                GameObject explosion = Instantiate(explosionPrefab, transform.position, Quaternion.identity);
                                Destroy(gameObject);
                                Destroy(explosion, 2.3f);

                                Debug.Log("Damage Dealt: " + realDamage);
                                Debug.Log(enemyHealth.currentHealth);
                                Debug.Log(other.name);
                            }
                        }
                        break;
                    }
                    if (other.CompareTag("TopWalls"))
                    {
                        if (triggerWall && canHitWall)
                        {
                            GameObject explosion = Instantiate(explosionPrefab, transform.position, Quaternion.identity);
                            Destroy(explosion, 2.3f);
                            Destroy(gameObject);
                            Debug.Log(other.name);
                            break;
                        }
                    }
                    if (canHitWall && (other.CompareTag("BottomWalls") || other.CompareTag("Obstacle")))
                    {
                        GameObject explosion = Instantiate(explosionPrefab, transform.position, Quaternion.identity);
                        Destroy(explosion, 2.3f);
                        Destroy(gameObject);
                        Debug.Log(other.name);
                        break;
                    }
                }
            }
        }
        transform.position = newPosition;
    }
Пример #33
0
 private static EspecieAnimal getEspecieAniNoSerializable(Vida vida, int especieAni)
 {
     return vida.especiesAnimales[especieAni];
 }
Пример #34
0
 public void ModoDios()
 {
     v = GameObject.Find("Jugador").GetComponent <Vida> ();
     v.setVida(99999);
     Truco = "";
 }
Пример #35
0
 private static EspecieVegetal getEspecieVegNoSerializable(Vida vida, int especieVeg)
 {
     return vida.especiesVegetales[especieVeg];
 }
Пример #36
0
 void Start()
 {
     rb2d = GetComponent <Rigidbody2D>();
     hp   = maxHp;
     vida = GameObject.FindObjectOfType <Vida>();
 }
Пример #37
0
 public abstract void update(float elapsedTime, Vida vidaPersona);
 private void Awake()
 {
     canhaoMovimento_ref = GameObject.Find("Canhao").GetComponent <CanhaoMovimento>();
     vida_ref            = GameObject.Find("Tanque").GetComponent <Vida>();
 }
Пример #39
0
        static void Main(string[] args)
        {
            /*   //Asignacion de enumeracion
             #region Def_Vehiculo
             * Tip_vehiculo VehiculoA = Tip_vehiculo.avion;
             * Tip_vehiculo VehiculoB = Tip_vehiculo.coche;
             #endregion
             * /* Def. de pasajeros */
            /*
             #region Def_Pasajero
             * int Pasajero = 0;
             * Pasajero += 4;
             * Console.WriteLine("Hello World!");
             * Console.WriteLine("Pasajero:" + Pasajero);
             *
             * string Vehiculo = "Coche";
             * int Cadena = Vehiculo.Length;
             * string Texto = "EL " + Vehiculo + " TIENE " + Pasajero + " PASAJEROS";
             * Console.WriteLine(Texto);
             #endregion
             */
            //Lectura por teclado

            /*
             #region Def_Lec_tecl
             * Console.Write("Entrada de datos (string):");
             * string date = Console.ReadLine();
             *
             * Console.WriteLine(date);
             #endregion
             */
            /*
             * //Ejercicio if-else-else if
             #region Ej IF-ELSE-ELSE IF
             *
             * bool IsGreen, IsOrange, IsRed;
             *
             * IsGreen = true;
             * IsOrange = false;
             * //IsRed = false;
             * //IsRed = !IsGreen & !IsOrange;
             * IsRed = !(IsGreen | IsOrange);
             *
             * if (IsGreen)
             *  Console.WriteLine("Conduce sin problemas");
             *
             * else if (IsOrange)
             *  Console.WriteLine("Conduce con cuidado");
             *
             * else if(IsRed)
             *  Console.WriteLine("Para");
             *
             #endregion
             */
            //Ejercicio switch
            #region Ej switch
            Console.WriteLine("Maquina de golocinas\n12.Fanta - 14.Coca-Cola - 15. Coca-Cola Zero");
            Console.Write("Code:");
            string entrada  = Console.ReadLine();
            int    passcode = Int32.Parse(entrada);

            switch (passcode)
            {
            case 12:
                Console.WriteLine("Fanta");
                break;
                Console.WriteLine("Coca-Cola");

            case 14:
                Console.WriteLine("Nestea");
                break;

            case 15:
                Console.WriteLine("Coca-Cola Zero");
                break;

            default:
                Console.WriteLine("Opcion Incorrecta");
                break;
            }
            #endregion

            //Ejercicio Op Ternario

            #region Op_Tern

            bool IsMoving = true;

            Vida Status = (IsMoving) ? Vida.Vivo : Vida.Muerto;

            Console.WriteLine("Status: " + Status);

            Console.Write("Introduzca la hora 24:");
            int Hora = Convert.ToInt32(Console.ReadLine());

            string EstadoHora = "";
            int    Hora_new;
            string formato;

            if (Hora >= 0 && Hora <= 24)
            {
                Hora_new = (Hora > 12) ? Hora - 12 : Hora;

                formato = (Hora > 12) ? "PM" : "AM";
                Console.WriteLine("la hora es " + Hora + " y en nuevo formato es " + Hora_new + " " + formato);
            }

            else
            {
                EstadoHora = "la hora es " + Hora + " AM";
            }

            Console.WriteLine(EstadoHora);

            #endregion

            //Ejercicio Bucle While

            #region Ej_While

            int Cont = 0;

            while (Cont < 10)
            {
                Console.Write("" + Cont + "-");
                Cont++;
            }

            #endregion

            //generador aleatorio

            #region Gen_aleatorio

            Random Sem       = new Random();
            int    CarasDado = 6;
            int    Aleatorio = Sem.Next(1, CarasDado);

            #endregion

            //generador aleatorio con while y do while

            #region Rompe_Claves

            int    codigo    = 5712;
            int    veces     = 0;
            int    aleatorio = -1;
            Random rand      = new Random();

            while (aleatorio != codigo)
            {
                aleatorio = rand.Next(0, 9999);
                veces++;
            }

            /*
             * do{
             *  aleatorio = rand.Next(0, 9999);
             *  veces++;
             * }while (aleatorio != codigo);
             */

            Console.WriteLine("\nRepitio tantas veces " + veces);
            #endregion

            #region Bucle_For_Dados

            Random Rand    = new Random();
            int    Num_six = 0;

            for (int i = 1; i <= 1000; i++)
            {
                int Tirada = Rand.Next(1, 7);
                Console.WriteLine(i + " " + Tirada);

                if (Tirada == 6)
                {
                    Num_six++;
                }
            }

            Console.WriteLine("Ha habido " + Num_six + " seises.");

            #endregion

            //FIN DEL PROGRAMA
        }
Пример #40
0
 private void Awake()
 {
     instance = this;
 }
Пример #41
0
    private void creacionCarga(ValoresCarga contenedor)
    {
        Debug.Log (FuncTablero.formateaTiempo() + ": Iniciando el script de carga de valores...");
        Texture2D texBase = contenedor.texturaBase;
        FuncTablero.inicializa(texBase);
        Mesh rocaMesh = contenedor.roca;
        Mesh aguaMesh = contenedor.agua;
        float nivelAgua = contenedor.nivelAgua;
        float tamanoPlaya = contenedor.tamanoPlaya;
        //Trabajar con la textura Textura_Planeta y crear el mapa lógico a la vez
        Debug.Log (FuncTablero.formateaTiempo() + ": Aplicando textura de ruido...");
        Texture2D texturaBase = objetoRoca.renderer.sharedMaterial.mainTexture as Texture2D;
        texturaBase = texBase;
        texturaBase.Apply();
        Debug.Log (FuncTablero.formateaTiempo() + ": Asignando Mesh a la roca...");
        MeshFilter Roca = objetoRoca.GetComponent<MeshFilter>();
        Roca.mesh = rocaMesh;
        //Se añade el collider aqui, para que directamente tenga la mesh adecuada
        Debug.Log (FuncTablero.formateaTiempo() + ": Creando collider de la roca...");
           	objetoRoca.AddComponent<MeshCollider>();
        objetoRoca.GetComponent<MeshCollider>().sharedMesh = rocaMesh;
        Debug.Log (FuncTablero.formateaTiempo() + ": Asignando Mesh al oceano...");
        MeshFilter Agua = objetoOceano.GetComponent<MeshFilter>();
        Agua.mesh = aguaMesh;
        Debug.Log (FuncTablero.formateaTiempo() + ": Completando detalles...");
        //se ajusta la propiedad de nivel de agua del shader
        objetoOceano.renderer.sharedMaterial.SetFloat("_nivelMar", nivelAgua);
        objetoOceano.renderer.sharedMaterial.SetFloat("_tamPlaya", tamanoPlaya);

        Debug.Log (FuncTablero.formateaTiempo() + ": Cargando texturas de habitats...");
        //obtener la textura de habitats del array de materiales de roca. Habitats esta en la 1ª posicion.
        objetoRoca.renderer.sharedMaterials[2].mainTexture = contenedor.texturaElementos;
        objetoRoca.renderer.sharedMaterials[1].mainTexture = contenedor.texturaHabsEstetica;
        Texture2D texHabitats = objetoRoca.renderer.sharedMaterials[1].GetTexture("_FiltroTex") as Texture2D;
        texHabitats = contenedor.texturaHabitats;
        objetoRoca.renderer.sharedMaterials[1].SetTexture("_FiltroTex", texHabitats);
        Debug.Log (FuncTablero.formateaTiempo() + ": Cargando la vida...");
        vida = new Vida(contenedor.vida);
        vida.setObjetoRoca(objetoRoca.transform);
        Debug.Log (FuncTablero.formateaTiempo() + ": Carga completada.");
    }
Пример #42
0
 public void Awake()
 {
     // TRAER EL COMPONENTE VIDA DEL ENEMIGO
     v = GetComponent <Vida>();
 }
Пример #43
0
 // Start is called before the first frame update
 private void Awake()
 {
     Mplayer    = GameObject.FindGameObjectWithTag("Player");
     playerVida = Mplayer.GetComponent <Vida>();
 }
Пример #44
0
 private void Awake()
 {
     vidaPlayer           = GetComponent <Vida>();
     playerDamageCollider = gameObject.GetComponent <BoxCollider2D>();
 }
Пример #45
0
    // Start is called before the first frame update

    private void Awake()
    {
        tiroDoPlayer_ref = GameObject.Find("Tanque").GetComponent <TiroDoPlayer>();
        vida_ref         = GameObject.Find("Tanque").GetComponent <Vida>();
    }
Пример #46
0
 void Start()
 {
     gc = GameObject.Find("GameControl").GetComponent<Vida>();
 }
Пример #47
0
 // Start is called before the first frame update
 void Start()
 {
     vidaFonte = GetComponent <Vida>();
 }
Пример #48
0
    private void creacionInicial()
    {
        Debug.Log(FuncTablero.formateaTiempo() + ": Iniciando la creacion desde cero...");
        //Trabajar con la textura Textura_Planeta y crear el mapa lógico a la vez
        Texture2D texturaBase = objetoRoca.renderer.sharedMaterial.mainTexture as Texture2D;

        Color[] pixels = new Color[texturaBase.width * texturaBase.height];
        FuncTablero.inicializa(texturaBase);
        Debug.Log (FuncTablero.formateaTiempo() + ": Creando ruido...");
        pixels = FuncTablero.ruidoTextura();											//Se crea el ruido para la textura base y normales...
        Debug.Log(FuncTablero.formateaTiempo() + ": Completado. Suavizando polos y bordes...");
        pixels = FuncTablero.suavizaBordeTex(pixels, texturaBase.width / 20);			//Se suaviza el borde lateral...
        pixels = FuncTablero.suavizaPoloTex(pixels);									//Se suavizan los polos...
        Debug.Log(FuncTablero.formateaTiempo() + ": Completado. Aplicando cambios...");
        texturaBase.SetPixels(pixels);
        texturaBase.Apply();
        Debug.Log(FuncTablero.formateaTiempo() + ": Completado. Extruyendo vertices de la roca...");
        float extrusion = 0.45f;
        MeshFilter Roca = objetoRoca.GetComponent<MeshFilter>();
        Mesh meshTemp = Roca.mesh;
        meshTemp = FuncTablero.extruyeVerticesTex(meshTemp, texturaBase, extrusion, objetoRoca.transform.position);
        Roca.mesh = meshTemp;
        Debug.Log (FuncTablero.formateaTiempo() + ": Completado. Construyendo collider...");
        //Se añade el collider aqui, para que directamente tenga la mesh adecuada
           	objetoRoca.AddComponent<MeshCollider>();
        objetoRoca.GetComponent<MeshCollider>().sharedMesh = meshTemp;
        Debug.Log (FuncTablero.formateaTiempo() + ": Completado. Calculando y extruyendo vertices del oceano...");
        MeshFilter Agua = objetoOceano.GetComponent<MeshFilter>();
        Mesh meshAgua = Agua.mesh;
        meshAgua = FuncTablero.extruyeVerticesValor(meshAgua, FuncTablero.getNivelAgua(), extrusion, objetoOceano.transform.position);
        Agua.mesh = meshAgua;
        Debug.Log (FuncTablero.formateaTiempo() + ": Completado. Rellenando detalles...");
        //se ajusta la propiedad de nivel de agua del shader
        objetoOceano.renderer.sharedMaterial.SetFloat("_nivelMar", FuncTablero.getNivelAgua());
        objetoOceano.renderer.sharedMaterial.SetFloat("_tamPlaya", FuncTablero.getTamanoPlaya());

        Debug.Log (FuncTablero.formateaTiempo() + ": Terminado. Cargando texturas de habitats...");
        //obtener la textura de habitats del array de materiales de roca. Habitats esta en la 1ª posicion.
        Texture2D texElems = objetoRoca.renderer.sharedMaterials[2].mainTexture as Texture2D;
        //Texture2D texPlantas = objetoRoca.renderer.sharedMaterials[2].mainTexture as Texture2D;
        Texture2D texHabitatsEstetica = objetoRoca.renderer.sharedMaterials[1].mainTexture as Texture2D;
        Texture2D texHabitats = objetoRoca.renderer.sharedMaterials[1].GetTexture("_FiltroTex") as Texture2D;
        Debug.Log (FuncTablero.formateaTiempo() + ": Terminado. Creando el tablero...");
        Casilla[,] tablero = FuncTablero.iniciaTablero(texturaBase, texHabitats, texHabitatsEstetica, texElems, Roca.mesh, objetoRoca.transform.position);
        Debug.Log (FuncTablero.formateaTiempo() + ": Terminado. Creando Vida...");
        vida = new Vida(tablero, objetoRoca.transform);
        Debug.Log (FuncTablero.formateaTiempo() + ": Completada la creacion del planeta.");
    }
Пример #49
0
 private void Awake()
 {
     spawnarMunicao_ref = GetComponent <SpawnarMunicao>();
     vida_ref           = GameObject.Find("Tanque").GetComponent <Vida>();
 }
 // Start is called before the first frame update
 void Start()
 {
     vida          = GetComponent <Vida>();
     puntaje.valor = 0;
 }
Пример #51
0
 // Start is called before the first frame update
 void Start()
 {
     vida = GetComponent <Vida>();
 }
        public Vida CotizaVidaCPM(string Credito, string Plazo, string AnoCredito, string FechaInicio, string TasaInteresAnual)
        {
            Vida cotizacion = new Vida();
            List<Saldo> saldos = new List<Saldo>();
             
            double tarVida, tasaInteresAnual, tasaInteresMensual, mensualidad, totalIntereses;
            DateTime fechaActual, fechaPasada;

            int i;

            double tmpArriba, tmpAbajo;

            try
            {
                cotizacion.CreditoInicial = Convert.ToDouble(Credito).ToString("$#,##0.00");

                tarVida = Convert.ToDouble(System.Configuration.ConfigurationManager.AppSettings["TarifaVida"].ToString());

                tasaInteresAnual=Convert.ToDouble(TasaInteresAnual);
                tasaInteresAnual = (tasaInteresAnual / 100);

                tasaInteresMensual= (Convert.ToDouble(TasaInteresAnual)/12);
                tasaInteresMensual = (tasaInteresMensual / 100);

                tmpArriba = ((tasaInteresMensual) * Math.Pow(1 + tasaInteresMensual, Convert.ToDouble(Plazo)));
                tmpAbajo = ((Math.Pow(1 + tasaInteresMensual, Convert.ToDouble(Plazo))) - 1);

                mensualidad = (Convert.ToDouble(Credito) * (tmpArriba / tmpAbajo));

                double saldoAnterior = Convert.ToDouble(Credito);

                fechaPasada=Convert.ToDateTime(FechaInicio);

                for (i = 0; i <= (Convert.ToInt32(Plazo)); i++)
                {
                    double saldoInsoluto, cuotaVida, interes, capital;

                    int dias;
                    TimeSpan tiempo;
                    Saldo tmp = new Saldo();

                    if (i == 0)
                    {
                        saldoInsoluto = saldoAnterior;
                        cuotaVida = (saldoInsoluto * tarVida);
                        tmp.FechaPago = fechaPasada.ToString("dd/MM/yyyy");
                        tmp.DiasTranscurridos = "0";
                        tmp.Periodo = i;
                        tmp.Pago = mensualidad;
                        tmp.Capital = 0.00;
                        tmp.Interes = 0.00;
                        tmp.SaldoInsoluto = saldoInsoluto;
                        tmp.CuotaVida = cuotaVida;
                    }
                    else
                    {
                        fechaActual = fechaPasada.AddMonths(1);
                        tiempo = fechaActual.Subtract(fechaPasada);
                        dias = tiempo.Days;

                        if (i == Convert.ToInt32(Plazo))
                        {
                            capital = saldoAnterior;
                            interes = ((saldoAnterior * tasaInteresAnual * dias) / 360);
                            tmp.Periodo = i;
                            tmp.FechaPago = fechaActual.ToString("dd/MM/yyyy");
                            tmp.DiasTranscurridos = Convert.ToString(dias);
                            tmp.Pago = capital + interes;
                            tmp.Capital = capital;
                            tmp.Interes = interes;
                            tmp.SaldoInsoluto = 0.00;
                            tmp.CuotaVida = 0.00;
                        }
                        else
                        {
                            interes = ((saldoAnterior * tasaInteresAnual * dias) / 360);
                            capital = (mensualidad - interes);
                            saldoInsoluto = (saldoAnterior - capital);
                            cuotaVida = (saldoInsoluto * tarVida);

                            tmp.Periodo = i;
                            tmp.Pago = mensualidad;
                            tmp.FechaPago = fechaActual.ToString("dd/MM/yyyy");
                            tmp.DiasTranscurridos = Convert.ToString(dias);
                            tmp.Capital = capital;
                            tmp.Interes = interes;
                            tmp.SaldoInsoluto = saldoInsoluto;
                            tmp.CuotaVida = cuotaVida;

                            saldoAnterior = saldoInsoluto;
                        }
                        fechaPasada = fechaActual;                        
                    }                    
                    saldos.Add(tmp);   
                }         

                cotizacion.HTMLString = GeneraCorridaHTML(saldos);

                int mesInicio, mesFin;
                int noMeses;

                noMeses = ((Convert.ToInt32(AnoCredito) + 1) * 12);

                mesFin = noMeses - 1;
                mesInicio = noMeses - 12;

                double primaTotal, pagoMensual;

                primaTotal = 0.00;
                pagoMensual = 0.00;

                for (i = mesInicio; i <= mesFin; i++)
                {
                    Saldo saldo;

                    saldo = saldos.ElementAt(i);
                    primaTotal += saldo.CuotaVida;

                    saldo.Interes = Math.Round(saldo.Interes, 2);
                    saldo.CuotaVida = Math.Round(saldo.CuotaVida, 2);
                    saldo.Pago = Math.Round(saldo.Pago, 2);
                    saldo.SaldoInsoluto = Math.Round(saldo.SaldoInsoluto, 2);
                    saldo.Capital = Math.Round(saldo.Capital, 2);

                    cotizacion.saldos.Add(saldo);
                }

                pagoMensual = ((primaTotal / 12));

                cotizacion.PrimaTotal = Convert.ToString(primaTotal);
                cotizacion.PagoMensual = Convert.ToString(pagoMensual);

                Cobertura tmp1 = new Cobertura();
                Cobertura tmp2 = new Cobertura();
                Cobertura tmp3 = new Cobertura();
                Cobertura tmp4 = new Cobertura();

                tmp1.Id = "1";
                tmp1.Descripcion = "COBERTURA BASICA";
                tmp1.SumaAseg = "SALDO INSOLUTO";
                cotizacion.coberturas.Add(tmp1);

                tmp2.Id = "2";
                tmp2.Descripcion = "INVALIDEZ TOTAL Y PERMANENTE";
                tmp2.SumaAseg = "AMPARADA";
                cotizacion.coberturas.Add(tmp2);

                tmp3.Id = "3";
                tmp3.Descripcion = "COBERTURA POR DESEMPLEO";
                tmp3.SumaAseg = "AMPARADA";
                cotizacion.coberturas.Add(tmp3);

                tmp4.Id = "4";
                tmp4.Descripcion = "FALLECIMIENTO DEL COACREDITADO";
                tmp4.SumaAseg = "AMPARADA";
                cotizacion.coberturas.Add(tmp4);
            }

            catch (Exception ex)
            {
                cotizacion.ErrorBool = true;
                cotizacion.ErrorDesc = ex.Message;
            }

            return cotizacion;
        }
Пример #53
0
 private void Awake()
 {
     vida = GetComponentInParent <Vida>();
 }
        public Hipotecario CotizaHipotecarioPRYBE(string Avaluo, string Credito, string CodigoPostal,string Plazo, string AnoCredito, string FechaInicio, string TasaAnual)
        {
            Hipotecario cotizacion = new Hipotecario();
            Vivienda vivienda = new Vivienda();
            Vida vida = new Vida();

            double primerPago, pagoSubsecuente;

            try
            {
                vivienda = CotizaViviendaPRYBE(Avaluo, CodigoPostal);
                vida = CotizaVidaCPM(Credito, Plazo, AnoCredito, FechaInicio, TasaAnual);

                if (vivienda.ErrorBool != true)
                {

                    primerPago = (Convert.ToDouble(vivienda.PrimerPago)) + (Convert.ToDouble(vida.PagoMensual));
                    pagoSubsecuente = (Convert.ToDouble(vivienda.PagoSubsecuente)) + (Convert.ToDouble(vida.PagoMensual));

                    cotizacion.PrimerPago = Convert.ToString(Math.Round(primerPago, 2));
                    cotizacion.PagoSubsecuente = Convert.ToString(Math.Round(pagoSubsecuente, 2));

                    cotizacion.Saldos = vida.saldos;
                    cotizacion.CoberturasVida = vida.coberturas;
                    cotizacion.CoberturasVivienda = vivienda.coberturas;

                    cotizacion.vivienda = vivienda;
                    cotizacion.vida = vida;
                }
                else
                {
                    cotizacion.ErrorBool = true;
                    cotizacion.ErrorDesc = "No fue posible realizar la cotización debido a que el Código Postal capturado no tiene zonas de riesgo registradas";
                }
            }

            catch(Exception ex)
            {
                cotizacion.ErrorBool = true;
                cotizacion.ErrorDesc = ex.Message;
            }

            return cotizacion;
        }
Пример #55
0
 private void Start()
 {
     health  = 5;
     instace = this;
 }