コード例 #1
0
    private void EventoColision(ColisionInformacion info)
    {
        Entidad entidad = info.GetEntidadImpacto();

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

        switch (objetivo)
        {
        case DeteccionObjetivo.ALIADO:

            if (entidad.GetTipo() == EntidadTipo.ALIADO)
            {
                this.entidad = entidad;
                eventodeteccion.Invoke();
            }


            break;

        case DeteccionObjetivo.ENEMIGO:

            if (entidad.GetTipo() == EntidadTipo.ENEMIGO)
            {
                this.entidad = entidad;
                eventodeteccion.Invoke();
            }


            break;

        case DeteccionObjetivo.AMBOS:

            if (entidad.GetTipo() != EntidadTipo.DESCONOCIDO)
            {
                this.entidad = entidad;
                eventodeteccion.Invoke();
            }

            break;

        case DeteccionObjetivo.TODOS:

            this.entidad = entidad;
            eventodeteccion.Invoke();

            break;
        }
    }