Esempio n. 1
0
 public DeteccionInformacion(PerfilDeteccion perfil, Colision colisiondetectada, Entidad entidad, Entidad entidaddetectada)
 {
     this.perfil            = perfil;
     this.colisiondetectada = colisiondetectada;
     this.entidad           = entidad;
     this.entidaddetectada  = entidaddetectada;
 }
Esempio n. 2
0
        private void EventoColision(ColisionInformacion info)
        {
            if (!IsEnable())
            {
                return;
            }

            Entidad entidad = info.GetEntidadImpacto();

            if (entidad == null || info.GetColisionEstado() != ColisionEstado.ENTER)
            {
                return;
            }
            ModuloVitalidad vitalidad = entidad.GetModuloVitalidad();

            if (vitalidad == null)
            {
                return;
            }
            PerfilDeteccion perfil = GetPerfilDeteccion(info.GetColision());

            if (perfil == null)
            {
                return;
            }

            switch (perfil.GetObjetivo())
            {
            case DeteccionObjetivo.ALIADO:

                if (entidad.GetTipo() == EntidadTipo.ALIADO)
                {
                    SolicitarEvento(new DeteccionInformacion(
                                        perfil,
                                        info.GetColisionImpacto(),
                                        GetEntidad(),
                                        entidad
                                        ));
                }


                break;

            case DeteccionObjetivo.ENEMIGO:

                if (entidad.GetTipo() == EntidadTipo.ENEMIGO)
                {
                    SolicitarEvento(new DeteccionInformacion(
                                        perfil,
                                        info.GetColisionImpacto(),
                                        GetEntidad(),
                                        entidad
                                        ));
                }


                break;

            case DeteccionObjetivo.AMBOS:

                if (entidad.GetTipo() != EntidadTipo.DESCONOCIDO)
                {
                    SolicitarEvento(new DeteccionInformacion(
                                        perfil,
                                        info.GetColisionImpacto(),
                                        GetEntidad(),
                                        entidad
                                        ));
                }

                break;

            case DeteccionObjetivo.TODOS:

                SolicitarEvento(new DeteccionInformacion(
                                    perfil,
                                    info.GetColisionImpacto(),
                                    GetEntidad(),
                                    entidad
                                    ));

                break;
            }
        }