コード例 #1
0
ファイル: NManayer.cs プロジェクト: ejemplo9004/comu
    void OnEntroJugadorNuevo(SocketIOEvent socketIOEvent)
    {
        print("Entro otro jugador");
        string     data     = socketIOEvent.data.ToString();
        UserJSON   userJSON = UserJSON.CreateFromJSON(data);
        Vector3    pos      = new Vector3(userJSON.position[0], userJSON.position[1], userJSON.position[2]);
        Quaternion rot      = Quaternion.Euler(userJSON.rotation[0], userJSON.rotation[1], userJSON.rotation[2]);
        GameObject o        = GameObject.Find(userJSON.nombre) as GameObject;

        if (o != null)
        {
            return;
        }
        GameObject p = GameObject.Find(userJSON.nombre);

        if (p == null)
        {
            p = Instantiate(jugador, pos, rot) as GameObject;
        }
        ControlPersonaje cp = p.GetComponent <ControlPersonaje>();

        cp.personaje = userJSON.personaje;
        cp.Inicializar(userJSON.nombre, false);

        Salud s = p.GetComponent <Salud>();

        s.saludActual = userJSON.salud;
        s.CambiarSalud();
    }
コード例 #2
0
 // Update is called once per frame
 void Update()
 {
     transform.GetChild(0).GetComponent <Text>()
     .text = "Mana: " + ManaDisponible.ToString();
     transform.GetChild(1).GetComponent <Text>()
     .text = "Salud: " + Salud.ToString();
 }
コード例 #3
0
ファイル: NManayer.cs プロジェクト: ejemplo9004/comu
    void OnPlayerMove(SocketIOEvent socketIOEvent)
    {
        string   data     = socketIOEvent.data.ToString();
        UserJSON userJSON = UserJSON.CreateFromJSON(data);
        Vector3  pos      = new Vector3(userJSON.position[0], userJSON.position[1], userJSON.position[2]);

        // Si este es el jugador actual
        if (userJSON.nombre.Substring(1) == nombreJugador.text)
        {
            return;
        }
        GameObject p = GameObject.Find(userJSON.nombre) as GameObject;

        if (p == null)
        {
            p = Instantiate(jugador, pos, Quaternion.identity) as GameObject;
            ControlPersonaje cp = p.GetComponent <ControlPersonaje>();
            cp.personaje = userJSON.personaje;
            cp.Inicializar(userJSON.nombre, false);

            Salud s = p.GetComponent <Salud>();
            s.saludActual = userJSON.salud;
            s.CambiarSalud();
        }
        p.transform.position = pos;
    }
コード例 #4
0
    // Start is called before the first frame update
    void Start()
    {
        inputPlayer = GetComponent <InputPlayer>();
        rgb2D       = GetComponent <Rigidbody2D>();

        _transform = GetComponent <Transform>();
        _anim      = GetComponent <Animator>();
        _sprite    = GetComponent <SpriteRenderer>();

        RunHashCode = Animator.StringToHash("IsRun");
        attacker    = GetComponent <Attacker>();

        salud = GetComponent <Salud>();

        experienceLevel = GetComponent <ExperienceLevel>();

        //Inicializar texto de paneles
        PanelAttribute.Instance.UpdateTextAtributte(attributePlayer, salud, experienceLevel);

        _skill                 = GetComponent <Skill>();
        _trailRenderer         = GetComponent <TrailRenderer>();
        _trailRenderer.enabled = false;


        soundFoot = GetComponentInChildren <SoundFoot>();
    }
コード例 #5
0
 public void ActualizarTextosAtributos(Atributos atributos, Salud salud, NivelDeExperiencia nivelDeExperiencia)
 {
     txtNivel.text             = nivelDeExperiencia.nivel.ToString();
     txtExperiencia.text       = nivelDeExperiencia.experiencia.ToString();
     txtSalud.text             = salud.salud.ToString();
     txtAtaque.text            = atributos.ataque.ToString();
     txtVelocidad.text         = atributos.velocidad.ToString();
     txtPuntosDeAtributos.text = nivelDeExperiencia.puntosDeAtributos.ToString();
 }
コード例 #6
0
 public void UpdateTextAtributte(Attributes attributes, Salud salud, ExperienceLevel experienceLevel)
 {
     txtNivel.text    = experienceLevel.nivel.ToString();
     txtExp.text      = experienceLevel.exp.ToString();
     txtSalud.text    = salud.salud.ToString();
     txtAttack.text   = attributes.attack.ToString();
     txtVelocity.text = attributes.velocity.ToString();
     txtPtos.text     = experienceLevel.pointAttributes.ToString();
 }
コード例 #7
0
ファイル: NManayer.cs プロジェクト: ejemplo9004/comu
    void OnSalud(SocketIOEvent socketIOEvent)
    {
        string           data             = socketIOEvent.data.ToString();
        SaludUsuarioJSON saludUsuarioJSON = SaludUsuarioJSON.CreateFromJSON(data);
        GameObject       p = GameObject.Find(saludUsuarioJSON.nombre);
        Salud            s = p.GetComponent <Salud>();

        s.saludActual = saludUsuarioJSON.salud;
        s.CambiarSalud();
    }
コード例 #8
0
        public List <string> Deducciones(string Fallas)
        {
            List <string> DatosDed = new List <string>();

            DatosDed.Add(Fallas);
            DatosDed.Add(Salud.ToString());
            DatosDed.Add(Pension.ToString());
            DatosDed.Add(TotDed.ToString());
            return(DatosDed);
        }
コード例 #9
0
 // Use this for initialization
 void Awake()
 {
     nivel             = 1;
     generadorText     = GetComponent <GeneradorTextHit>();
     jugador           = GetComponent <WarriorController>();
     salud             = GetComponent <Salud>();
     expSiguienteNivel = CurvaExperiencia(nivel);
     ActualizarBarraDeExp();
     LlamarBotonesAtributos();
 }
コード例 #10
0
ファイル: Poder.cs プロジェクト: ejemplo9004/comu
    void OnTriggerEnter(Collider otro)
    {
        Salud s = otro.gameObject.GetComponent <Salud> ();

        if (s != null)
        {
            s.CausarDaño(JugadorCreador, daño);
        }
        GameObject op = Instantiate(particulasExplosion, transform.position, transform.rotation) as GameObject;

        Destroy(op, 4);
        Destroy(gameObject);
    }
コード例 #11
0
    void Awake()
    {
        nivel = 1;

        player = GetComponent <PlayerController>();
        salud  = GetComponent <Salud>();

        generatorText = GetComponent <GeneratorText>();
        expNextLevel  = ExperienceCurve(nivel);

        UpdateExpBar();
        CallButtonSwitch();
    }
コード例 #12
0
 // Update is called once per frame
 void Update()
 {
     if (contador > 0)
     {
         contador -= Time.deltaTime;
     }
     esta_curandose = curanderoCerca();
     if (esta_curandose == true && contador <= 0)
     {
         Salud curarse = GetComponent <Salud>();
         curarse.Curar(1);
         contador = tiempo_de_espera;
     }
 }
コード例 #13
0
ファイル: Pocion.cs プロジェクト: kyus-hub/Curso-RPG-2D-UNITY
    public override bool UsarItem()
    {
        Salud saludJugador = GameManager.instance.jugador.GetComponent <Salud>();

        if (saludJugador.SaludActual >= saludJugador.salud)
        {
            Debug.Log("Salud Llena , no se utilizará poción");
            return(false);
        }
        else
        {
            saludJugador.modificarSaludActual(curacion);
            return(true);
        }
    }
コード例 #14
0
    public override bool UsedItem()
    {
        Salud playerSalud = GameManager.Instance.player.GetComponent <Salud>();

        if (playerSalud.ActualSalud >= playerSalud.salud)
        {
            Debug.Log("Salud llena!");
            return(false);
        }
        else
        {
            playerSalud.UpdateActualSalud(healing);
            return(true);
        }
    }
コード例 #15
0
 // Use this for initialization
 void Start()
 {
     pies               = GetComponentInChildren <Pies>();
     trailRenderer      = GetComponent <TrailRenderer>();
     habilidad          = GetComponent <Habilidad>();
     nivelDeExperiencia = GetComponent <NivelDeExperiencia>();
     salud              = GetComponent <Salud>();
     inputJugador       = GetComponent <InputPlayer>();
     miRigidbody2D      = GetComponent <Rigidbody2D>(); //El rigidbody2d de este gameObject
     animator           = GetComponent <Animator>();
     miSprite           = GetComponent <SpriteRenderer>();
     atacante           = GetComponent <Atacante>();
     correrHashCode     = Animator.StringToHash("Corriendo");
     PanelAtributos.instance.ActualizarTextosAtributos(atributosJugador, salud, nivelDeExperiencia);
 }
コード例 #16
0
        public List <string> CalculoSueldo(string ident, string nombre, string apellidos, string cargo, int sueldo, int domingos, int fallas, int horasext)
        {
            List <string> DatosNomina = new List <string>();

            DatosNomina.Add(ident);
            DatosNomina.Add(nombre + " " + apellidos);
            DatosNomina.Add(cargo);
            VDia    = sueldo / 30;
            VHOrd   = VDia / 8;
            Conv    = VHOrd * 1.25; VHExt = (int)Conv;
            Conv    = VHOrd * 1.75; VHDom = (int)Conv;
            VDom    = VHDom * 8;
            Conv    = sueldo * 0.04;
            Salud   = (int)Conv;       //Salud
            Pension = Salud;           // Pension
            TotDev  = sueldo;          //Devengados
            TotDed  = Salud + Pension; // Deducciones
            if (sueldo < 877077 * 2)
            {
                SubTr  = 97032;          //Subsidio Transporte
                TotDev = TotDev + SubTr; //Devengados
            }
            if (fallas != 0)
            {
                DescDias = fallas * VDia;
                TotDed   = TotDed + DescDias; //Devengados
            }

            TotHrExt = horasext * VHExt;
            TotDom   = domingos * VDom; // Domingos Trabajados

            TotDev = TotDev + TotHrExt; // Horas Extras
            TotDev = TotDev + TotDom;   //Devengados
            SalTot = TotDev - TotDed;

            DatosNomina.Add("$ " + sueldo.ToString());   //3
            DatosNomina.Add("$ " + TotDom.ToString());   //4
            DatosNomina.Add("$ " + TotHrExt.ToString()); //5
            DatosNomina.Add("$ " + TotDed.ToString());   //6
            DatosNomina.Add("$ " + SubTr.ToString());    //7
            DatosNomina.Add("$ " + DescDias.ToString()); //8
            DatosNomina.Add("$ " + Pension.ToString());  //9
            DatosNomina.Add("$ " + Salud.ToString());    //10
            DatosNomina.Add("$ " + TotDev.ToString());   //11
            DatosNomina.Add("$ " + SalTot.ToString());   //12

            return(DatosNomina);
        }
コード例 #17
0
    private void OnCollisionEnter(Collision informacion)
    {
        GameObject objColisionado = informacion.gameObject;

        if (objColisionado.tag == "Jugador")
        {
            Salud a = objColisionado.GetComponent <Salud>();
            a.Golpeado(10);
        }

        if (objColisionado.tag == "Construccion")
        {
            SaludConst a = objColisionado.GetComponent <SaludConst>();
            a.Golpeado(5);
        }
    }
コード例 #18
0
 public ActionResult GrabSalud(Salud salud)
 {
     try
     {
         using (var Salud = new EmpleadosEntities())
         {
             var GrabaSalud = Salud.Sp_Ins_Salud(salud.Nombre_Salud, salud.Porc_Cotiz);
             return(Json(GrabaSalud));
         }
     }
     catch (Exception ex)
     {
         Logger.Error("Error On:", ex);
         Response.StatusCode        = 500;
         Response.StatusDescription = ex.Message;
         return(Json(Response));
     }
 }
コード例 #19
0
 public ActionResult ModSistSalud(Salud salud)
 {
     try
     {
         using (var Salud = new EmpleadosEntities())
         {
             var ActSalud = Salud.Sp_UPD_Salud(salud.Cod_Salud, salud.Nombre_Salud, salud.Porc_Cotiz);
         }
         return(RedirectToAction("Index"));
     }
     catch (Exception ex)
     {
         Logger.Error("Error On:", ex);
         Response.StatusCode        = 500;
         Response.StatusDescription = ex.Message;
         return(Json(Response));
     }
 }
コード例 #20
0
    void Start()
    {
        if (gm == null)
        {
            gm = gameObject.GetComponent <GameManager>();
        }

        if (player == null)
        {
            player = GameObject.FindWithTag("Player");
        }

        playerHealth = player.GetComponent <Salud>();

        // setup score display
        Collect(0);

        // make other UI inactive
        //gameOverCanvas.SetActive (false);
        if (canBeatLevel)
        {
            beatLevelCanvas.SetActive(false);
        }
    }
コード例 #21
0
 private void Start()
 {
     miRigidBody2D = GetComponent <Rigidbody2D>();
     miSalud       = GetComponent <Salud>();
 }
コード例 #22
0
 void Awake()
 {
     health = GetComponent <Salud>();
     danger = GetComponent <Danger>();
     characterController = GetComponent <CharacterController>();
 }
コード例 #23
0
ファイル: Attributes.cs プロジェクト: cristian67/RPG-GAME-2D
 public void ModificatorSalud(Salud salud, int amount)
 {
     salud.ModificatorSalud += amount;
 }
コード例 #24
0
 void Start()
 {
     miSalud = GetComponent <Salud>();
     rb      = GetComponent <Rigidbody2D>();
 }
コード例 #25
0
 // Start is called before the first frame update
 void Start()
 {
     mySalud = GetComponent <Salud>();
     myRgb2D = GetComponent <Rigidbody2D>();
 }
コード例 #26
0
 void Awake()
 {
     health = GetComponent <Salud>();
 }
コード例 #27
0
        //funciona
        public async void guardarVida()
        {
            //try{
            bool   guarda     = false;
            string rutCliente = txtRutCont.Text;

            DateTime localDate = DateTime.Now;
            string   mes = "", dia = "", minu = "", seg = "";
            string   anio = localDate.Year.ToString();

            mes = localDate.Month.ToString();
            dia = localDate.Day.ToString();
            string hora = localDate.Hour.ToString();

            minu = localDate.Minute.ToString();
            seg  = localDate.Second.ToString();

            if (mes.Length == 1)
            {
                mes = "0" + mes;
            }
            if (dia.Length == 1)
            {
                dia = "0" + dia;
            }
            if (minu.Length == 1)
            {
                minu = "0" + minu;
            }
            if (seg.Length == 1)
            {
                seg = "0" + seg;
            }
            string numero = anio + mes + dia + hora + minu + seg;

            string   plan             = cbbPlan.SelectedValue.ToString();
            DateTime fechaIniVig      = dtpFechaInicio.SelectedDate.Value;
            DateTime fechaFinVig      = fechaIniVig.AddYears(1);
            string   fechaVigencia    = fechaIniVig.Year.ToString() + "-" + fechaIniVig.Month.ToString() + "-" + fechaIniVig.Day.ToString();
            string   fechaFinVigencia = fechaFinVig.Year.ToString() + "-" + fechaFinVig.Month.ToString() + "-" + fechaFinVig.Day.ToString();
            string   salud            = cbbSalud.SelectedValue.ToString();

            if (salud == "Si")
            {
                salud = "1";
            }
            else if (salud == "No")
            {
                salud = "0";
            }
            else
            {
                salud = "";
            }
            string primaAnu    = txtPrimaAnu.Text;
            string primaMen    = txtPrimaMen.Text;
            string observacion = txtObsv.Text;
            int    idTipoCont  = cbbTipoCont.SelectedIndex * 10;

            /*if (idTipoCont == 10)
             * {
             *  idTipoCont = 30;
             * }
             * else if (idTipoCont == 30)
             * {
             *  idTipoCont = 10;
             * }*/

            objSalud                     = new Salud();
            objSalud.RutCliente          = rutCliente;
            objSalud.NumeroContrato      = numero;
            objSalud.CodigoPlan          = plan;
            objSalud.FechaInicioVigencia = fechaVigencia;
            objSalud.FechaFinVigencia    = fechaFinVigencia;
            objSalud.DeclaracionSalud    = salud;
            objSalud.PrimaAnual          = primaAnu;
            objSalud.PrimaMensual        = primaMen;
            objSalud.Vigente             = "1";
            objSalud.Observaciones       = observacion;
            objSalud.TipoContrato        = idTipoCont;


            //DateTime fecha_iniv = Convert.ToDateTime(value);
            int result = DateTime.Compare(fechaIniVig, DateTime.Today);
            int mesV   = fechaIniVig.Month - DateTime.Today.Month;

            //if (result >= 0){
            if (mesV < 1)
            {
                guarda = objSalud.agregarContrato();
                if (guarda == true)
                {
                    MessageBox.Show("Contrato de Salud Ingresado", "Confirmacion!", MessageBoxButton.OK, MessageBoxImage.Information);
                    limpiar();
                }
                else
                {
                    MessageBox.Show("Contrato Ya ha Ingresado", "Advertencia!", MessageBoxButton.OK, MessageBoxImage.Exclamation);
                }
            }
            else
            {
                await this.ShowMessageAsync("Advertencia!", "Mes de inicio de vigencia no puede ser superior a un mes");
            }

            /*}
             * catch (Exception error)
             * {
             *  MessageBox.Show(error.Message, "Error!", MessageBoxButton.OK, MessageBoxImage.Error);
             * }*/
        }
コード例 #28
0
 private void ModificarSalud(Salud salud, int cantidad)
 {
     salud.ModificadorSalud += cantidad;
 }
コード例 #29
0
    /// <summary>
    /// Handles the cool down.
    /// </summary>
    void HandleCoolDown()
    {
        if (AttackFired && coolDown == 0)
        {
            coolDown = coolDownTime;
            AddTrailComponent();
        }

        if (coolDown > 0)
        {
            //Handle CoolDown Time
            coolDown -= coolDownTimeRate * Time.deltaTime;
            float step             = coolDownTime / bezier.points.Length;
            float cooldowntimeleft = coolDownTime - coolDown;

            //Calculate which point the ray should be cast to, as per it's Cooldown time
            int index = (int)Mathf.Clamp(cooldowntimeleft / step, 0, bezier.points.Length - 1);

            Vector3 targetPosition = bezier.points[index];
            Vector3 direction      = (targetPosition - transform.position);
            float   distance       = Vector3.Distance(targetPosition, transform.position) * attackRange;

            float pointDamage = Damage / bezier.points.Length;

            //Cast a ray to catch the objects within effect distance
            Ray        attackRay = new Ray(transform.position, direction);
            RaycastHit attackHit;
            Physics.Raycast(attackRay, out attackHit, distance, enemyLayers);

            if (attackHit.collider)
            {
                GameObject enemigo = attackHit.collider.gameObject;
                Enemigo    enemy   = enemigo.GetComponent <Enemigo>();
                if (enemy)
                {
                    Salud health = enemigo.GetComponent <Salud>();
                    if (health)
                    {
                        health.TakeDamage(pointDamage);
                    }

                    switch (attackReaction)
                    {
                    case Common.AttackReaction.Juggle:
                        MalabarEnemigo malabarEnemigo = enemigo.GetComponent <MalabarEnemigo>();
                        if (malabarEnemigo)
                        {
                            malabarEnemigo.AddJuggle(pointDamage * attackReactionPower);
                        }
                        break;

                    case Common.AttackReaction.Pushback:
                        Pushback pushback = enemigo.GetComponent <Pushback>();
                        if (pushback)
                        {
                            pushback.AddPushback(pointDamage * attackReactionPower, transform.position);
                        }
                        break;
                    }

                    Debug.Log(attackReaction.ToString());


                    if (cameraShake)
                    {
                        CameraShake.ShakeType ShakeType;
                        switch (attackType)
                        {
                        case Common.MainAttackType.Light:
                            ShakeType = CameraShake.ShakeType.Light;
                            break;

                        case Common.MainAttackType.Medium:
                            ShakeType = CameraShake.ShakeType.Medium;
                            break;

                        case Common.MainAttackType.Fierce:
                            ShakeType = CameraShake.ShakeType.Strong;
                            break;

                        default:
                            ShakeType = CameraShake.ShakeType.Medium;
                            break;
                        }
                        cameraShake.RequestShake(pointDamage, ShakeType);
                    }
                }
            }


            if (DebugAttack)
            {
                Debug.DrawRay(transform.position, direction * attackRange, Color.red);
            }



            ///Create trail effect
            if (trailObject)
            {
                Vector3 trailObjectPosition = attackRay.GetPoint(distance);
                trailObject.transform.position = trailObjectPosition;

                LineRenderer line = trailObject.GetComponent <LineRenderer>();
                line.SetPositions(new Vector3[] {
                    trailObject.transform.position
                    , transform.position
                });
            }
        }

        else
        {
            coolDown    = 0;
            AttackFired = false;
            Destroy(trailObject);
        }
    }