示例#1
0
    private void handle_boss_collider(Collision collision)
    {
        if (collision.collider.tag != "Player_Damage_Hitbox")
        {
            return;
        }

        Enemy1_State_Transition_Func enemy1_state_transition_func = enemy1_Controller.get_enemy1_state_transition_func;

        int damage = 0;

        if (collision.contacts.Length > 0)
        {
            ContactPoint contact = collision.contacts[0];

            switch (enemy1_Controller.curr_state)
            {
            case Enemy1_State_Transition_Func.enemy1_state.run_attack_left:
                damage = 30;
                break;

            case Enemy1_State_Transition_Func.enemy1_state.run_attack_right:
                damage = 30;
                break;

            case Enemy1_State_Transition_Func.enemy1_state.stomp_attack:
                damage = 50;
                enemy1_state_transition_func.setJustStomped();
                break;

            default:
                break;
            }
        }

        //return true if attack landed, false otherwise
        if (damage > 0)
        {
            AudioManager.instance.Play("boss_bonk");
            if (player_health_info.parry_ready)
            {
                player_health_info.setParrySuccess(true);
                enemy1_state_transition_func.setJustHit();
            }
            else if (!player_health_info.is_invincible)
            {
                player_health_info.doDamage(damage);
                player_health_info.setInvincible(0.5f);
                enemy1_state_transition_func.setJustHit();

                player_Controller.apply_knockback(enemy1_Controller.get_knockback_direction(), damage);
            }
        }
    }