Exemple #1
0
    private void BeginCast(Vector3 v3Target)
    {
        Debug.Log("BTool BeginCast");
        ActionState goalState   = _brain.GetActionState(EActionStateIDs.ASID_ATTACKING);
        ASAttacking asAttacking = goalState as ASAttacking;

        asAttacking.SetToolIndex(_index);
        asAttacking.SetTargetPosition(v3Target);
        asAttacking.SetIssuedClientNumber(_issuedClientNumber);
        ActionState activeState = _brain.AttemptActionState((uint)EActionStateIDs.ASID_ATTACKING, 0);

        if (activeState != goalState)
        {
            SetFlag(BSR_END);
            return;
        }
        SetFlag(BSR_CAST);
    }
Exemple #2
0
    public override void Update()
    {
        if (_self.IsStunned() || _self.IsImmobilized())
        {
            return;
        }

        Vector3 v3Pos = _self.GetPosition();

        switch (_tool.ActionType)
        {
        case EEntityToolAction.TOOL_ACTION_PASSIVE:
        case EEntityToolAction.TOOL_ACTION_TOGGLE:
        case EEntityToolAction.TOOL_ACTION_NO_TARGET:
        case EEntityToolAction.TOOL_ACTION_TARGET_POSITION:
        case EEntityToolAction.TOOL_ACTION_TARGET_ENTITY:
        case EEntityToolAction.TOOL_ACTION_GLOBAL:
        case EEntityToolAction.TOOL_ACTION_TARGET_SELF:
        case EEntityToolAction.TOOL_ACTION_FACING:
        case EEntityToolAction.TOOL_ACTION_SELF_POSITION:
        case EEntityToolAction.TOOL_ACTION_ATTACK:
        case EEntityToolAction.TOOL_ACTION_ATTACK_TOGGLE:
        case EEntityToolAction.TOOL_ACTION_TARGET_DUAL:
        case EEntityToolAction.TOOL_ACTION_TARGET_DUAL_POSITION:
        case EEntityToolAction.TOOL_ACTION_TARGET_VECTOR:
        case EEntityToolAction.TOOL_ACTION_TARGET_ENTITY_VECTOR:
        case EEntityToolAction.TOOL_ACTION_TARGET_CURSOR:
            break;

        case EEntityToolAction.TOOL_ACTION_INVALID:
            Debug.LogWarning("Invalid tool action type");
            SetFlag(BSR_END);
            return;
        }

        ASAttacking activatingState = _brain.GetActionState(EActionStateIDs.ASID_ATTACKING) as ASAttacking;

        if (activatingState.IsActive())
        {
            return;
        }

        if ((GetFlags() & BSR_CAST) != 0)
        {
            ClearFlag(BSR_CAST);
            if (!activatingState.IsInterrupted())
            {
                SetFlag(BSR_END);
            }
            return;
        }

        BeginCast(_self.transform.forward);

        Debug.Log("111111111111111111111111111111");
        if ((GetFlags() & BSR_CAST) != 0 && !activatingState.IsActive())
        {
            Debug.Log("22222222222222222222222222222222");
            ClearFlag(BSR_CAST);
            if (!activatingState.IsInterrupted())
            {
                SetFlag(BSR_END);
                Debug.Log("BTool BSR_END");
            }
        }
    }