예제 #1
0
    private void handle_player_collider(Collision collision)
    {
        if (collision.collider.tag != "Enemy_Damage_Hitbox")
        {
            return;
        }

        int damage = 0;

        if (collision.contacts.Length > 0)
        {
            ContactPoint contact = collision.contacts[0];
            switch (player_Controller.curr_atk_state)
            {
            case Attack_State_Transition_Func.attack_state.attack_basic_0:
                damage = 30;
                break;

            case Attack_State_Transition_Func.attack_state.attack_basic_1:
                damage = 30;
                break;

            case Attack_State_Transition_Func.attack_state.attack_basic_2:
                damage = 50;
                break;

            case Attack_State_Transition_Func.attack_state.attack_basic_3:
                damage = 50;
                break;

            case Attack_State_Transition_Func.attack_state.attack_basic_4:
                damage = 50;
                break;

            case Attack_State_Transition_Func.attack_state.attack_dash_0:
                damage = 40;
                break;

            case Attack_State_Transition_Func.attack_state.attack_jump_0:
                damage = 40;
                break;

            default:
                break;
            }

            int cur_combo_points;
            if (damage > 0 && !boss_health_info.is_invincible)
            {
                Particle_system_controller.Instance.set_particle(CONTROL_CONFIG.VFX_HIT_PREFAB_NAME_1, contact.point, 0.2f);

                if (player_health_info.parry_bonus)
                {
                    damage = (int)(damage * 1.5);
                }

                boss_health_info.doDamage(damage);
                AudioManager.instance.Play("game jam 3 impact");

                boss_health_info.setInvincible(0.4f);
                combo_info.setComboTimer(1.5f);

                cur_combo_points = damage;
                float combo_multiplier = 1.0f + (combo_info.combo_counter * 0.1f);

                if (combo_multiplier > 2.0f)
                {
                    combo_multiplier = 2.0f;
                }
                cur_combo_points = (int)(cur_combo_points * combo_multiplier);

                combo_info.addComboPoints(cur_combo_points);
                combo_info.combo_counter++;
            }
        }
    }
예제 #2
0
        //is this obsolete?
        public static void do_attack(Attack_State_Transition_Func.attack_state attack_state, Collider[] hitboxes, ComboInfo combo_info,
                                     HealthInfo player_health_info, HealthInfo boss_health_info)
        {
            int damage = 0;

            foreach (Collider col in hitboxes)
            {
                Collider[] cols = Physics.OverlapBox(col.bounds.center, col.bounds.extents, col.transform.rotation, LayerMask.GetMask("EnemyHitbox"));
                if (cols.Length > 0)
                {
                    switch (attack_state)
                    {
                    case Attack_State_Transition_Func.attack_state.attack_basic_0:
                        damage = 30;
                        break;

                    case Attack_State_Transition_Func.attack_state.attack_basic_1:
                        damage = 30;
                        break;

                    case Attack_State_Transition_Func.attack_state.attack_basic_2:
                        damage = 50;
                        break;

                    case Attack_State_Transition_Func.attack_state.attack_basic_3:
                        damage = 50;
                        break;

                    case Attack_State_Transition_Func.attack_state.attack_basic_4:
                        damage = 50;
                        break;

                    case Attack_State_Transition_Func.attack_state.attack_dash_0:
                        damage = 40;
                        break;

                    case Attack_State_Transition_Func.attack_state.attack_jump_0:
                        damage = 40;
                        break;

                    default:
                        Debug.Log("Unable to identify attack, make sure switch case matches.");
                        break;
                    }
                }
            }

            int cur_combo_points;

            if (damage > 0 && !boss_health_info.is_invincible)
            {
                if (player_health_info.parry_bonus)
                {
                    damage = (int)(damage * 1.5);
                }

                boss_health_info.doDamage(damage);
                Debug.Log(damage);
                AudioManager.instance.Play("game jam 3 impact");

                boss_health_info.setInvincible(0.4f);
                combo_info.setComboTimer(1.5f);

                cur_combo_points = damage;
                float combo_multiplier = 1.0f + (combo_info.combo_counter * 0.1f);

                if (combo_multiplier > 2.0f)
                {
                    combo_multiplier = 2.0f;
                }
                cur_combo_points = (int)(cur_combo_points * combo_multiplier);

                combo_info.addComboPoints(cur_combo_points);
                combo_info.combo_counter++;
            }
        }