Exemplo n.º 1
0
void AttackNode::_during_behavior(const Variant &target, Dictionary &env) {
    bool is_hit = false;
    if (attack_area) {
        Character *from = ((Object*)target)->cast_to<Character>();
        if (from) {
            bool hit = attack_area->attack(from);
            if (hit) {
                is_hit = true;
                if (get_script_instance()) {
                    Variant var_env = Variant(env);
                    const Variant* ptr[2]={&target,&var_env};
                    get_script_instance()->call_multilevel(StringName("_on_attack"),ptr,2);
                }
            }
        }
    }
    Action::_during_behavior(target, env);
    if (is_hit) {
        set_hit(is_hit);
    }
}
Exemplo n.º 2
0
void disable_special() { set_hit(0); }