Beispiel #1
0
 private void OnCollisionEnter(Collision collision)
 {
     // Si el estado es 'Attack' matamos al enemigo (mirar etiqueta)
     if (collision.gameObject.CompareTag("Enemy"))
     {
         // Obtener estado actual de la capa Attack Layer
         AnimatorStateInfo stateInfo = _animator.GetCurrentAnimatorStateInfo(AttackLayerIndex);
         if (stateInfo.fullPathHash == AttackLayerAttackHash && _animator.GetFloat(DistanceHash) > 0)
         {
             SkeletonBehaviour sBehaviour = collision.gameObject.GetComponent <SkeletonBehaviour>();
             sBehaviour.Kill();
         }
     }
 }
Beispiel #2
0
    // Evento al ser notificado por un enemigo (cuando muere)
    public void notifyEnemyKilled(SkeletonBehaviour enemy)
    {
        // Eliminamos enemigo de la lista actual
        currentEnemiesList.Remove(enemy);

        // Subimos 10 puntos y actualizamos la puntuacion en la UI
        // TODO

        // Si no quedan enemmigos
        if (currentEnemiesList.Count == 0)              // KEEP
        {
            // Mostrar panel de 'Mision cumplida' y pausar a Player
            // TODO
        }
    }
    // Evento al ser notificado por un enemigo (cuando muere)
    public void notifyEnemyKilled(SkeletonBehaviour enemy)
    {
        // Eliminamos enemigo de la lista actual
        currentEnemiesList.Remove(enemy);               // KEEP

        // Subimos 10 puntos y actualizamos la puntuacion en la UI
        _score += 10;
        UIManager.instance.updateScore(_score);

        // Si no quedan enemmigos
        if (currentEnemiesList.Count == 0)              // KEEP
        {
            // Mostrar panel de 'Mision cumplida' y pausar a Player
            UIManager.instance.showEndPanel(true);
            player.pause = true;
        }
    }
Beispiel #4
0
 private void Awake()
 {
     enemyParent = GetComponentInParent <SkeletonBehaviour>();
 }