Exemplo n.º 1
0
    public override void OnDeactivate()
    {
        //Time.timeScale = 1;
        Owner.BlackBoard.BusyAction = false;

        Animation.Stop(AnimNameUp);
        Animation.Stop(AnimNameDown);
        Animation.Stop(AnimNameLeft);
        Animation.Stop(AnimNameRight);

        if (Owner.IsAlive)
        {
            Owner.BlackBoard.CoverFire = false;
        }

        //Debug.Log("deactivate " + Owner.BlackBoard.CoverFire);
        if (ActionCancel != null)
        {
            ActionCancel.SetSuccess();
        }

        ActionCancel = null;
        Action.SetSuccess();
        Action = null;
        base.OnDeactivate();
    }
Exemplo n.º 2
0
    public override void Activate()
    {
        base.Activate();

        Action = AgentActionFactory.Create(AgentActionFactory.E_Type.CoverFire) as AgentActionCoverFire;
        Action.CoverDirection = Owner.BlackBoard.CoverPosition;
        Action.CoverPose      = Owner.BlackBoard.CoverPose;

        ActionCancel = null;

        Owner.BlackBoard.ActionAdd(Action);
    }
Exemplo n.º 3
0
    public override void Update()
    {
        WeaponBase weapon = Owner.WeaponComponent.GetCurrentWeapon();

        if ((Owner.WorldState.GetWSProperty(E_PropKey.WeaponLoaded).GetBool() == false ||
             !Owner.BlackBoard.Desires.WeaponTriggerOn && (!Owner.BlackBoard.Desires.WeaponTriggerUp || !weapon.UseFireUp)) &&
            ActionCancel == null && weapon.IsBusy() == false)
        {
            //xxxx
            Owner.BlackBoard.Desires.WeaponTriggerOn = false;
            ActionCancel = AgentActionFactory.Create(AgentActionFactory.E_Type.CoverFireCancel) as AgentActionCoverFireCancel;
            Owner.BlackBoard.ActionAdd(ActionCancel);
        }
    }
Exemplo n.º 4
0
    public override bool HandleNewAction(AgentAction action)
    {
        if (action is AgentActionCoverFire)
        {
            Debug.LogError(ToString() + ": Second action is not allowed");
            action.SetFailed();
            return(true);
        }

        if (action is AgentActionCoverFireCancel)
        {
            ActionCancel = action as AgentActionCoverFireCancel;
            StartEnd();
            return(true);
        }

        if (action is AgentActionInjury)
        {
            PlayInjuryAnimation(action as AgentActionInjury);
            return(true);
        }

        if (action is AgentActionAttack)
        {
            string s = Owner.AnimSet.GetWeaponAnim(E_WeaponAction.Fire);

            Animation[s].blendMode = AnimationBlendMode.Additive;
            Animation[s].layer     = 2;

            if (Animation.IsPlaying(s))
            {
                Animation[s].time = 0;
            }
            else
            {
                Blend(s, 0.05f);
            }

            action.SetSuccess();
            return(true);
        }

        return(false);
    }
Exemplo n.º 5
0
    protected void CoverFireStop(uLink.NetworkMessageInfo info)
    {
        if (Owner.BlackBoard.DontUpdate)
        {
            return;
        }

#if !DEADZONE_CLIENT
        if (Owner.IsServer)
        {
            ServerAnticheat.ReportCoverFireStop(Owner.NetworkView.owner, info);
            Owner.NetworkView.RPC("CoverFireStop", uLink.RPCMode.OthersExceptOwner);
        }
#endif

        if (Owner.IsInCover)
        {
            AgentActionCoverFireCancel action = AgentActionFactory.Create(AgentActionFactory.E_Type.CoverFireCancel) as AgentActionCoverFireCancel;

            Owner.BlackBoard.ActionAdd(action);
        }
    }
Exemplo n.º 6
0
    public override void Reset()
    {
        if (ActionCancel != null)
        {
            ActionCancel.SetSuccess();
        }

        if (Owner.IsOwner)
        {
            //WeaponBase	weapon = Owner.WeaponComponent.GetCurrentWeapon();

            GameCamera.Instance.Reset(0, 30);
        }

        Owner.BlackBoard.CoverFire = false;
        ActionCancel = null;

        Action.SetSuccess();
        Action = null;

        base.Reset();
    }
Exemplo n.º 7
0
    public static AgentAction Create(E_Type type)
    {
        int index = (int)type;

        AgentAction a;

        if (m_UnusedActions[index].Count > 0)
        {
            a = m_UnusedActions[index].Dequeue();
        }
        else
        {
            switch (type)
            {
            case E_Type.Idle:
                a = new AgentActionIdle();
                break;

            case E_Type.Move:
                a = new AgentActionMove();
                break;

            case E_Type.Sprint:
                a = new AgentActionSprint();
                break;

            case E_Type.Goto:
                a = new AgentActionGoTo();
                break;

            case E_Type.Attack:
                a = new AgentActionAttack();
                break;

            case E_Type.Melee:
                a = new AgentActionMelee();
                break;

            case E_Type.Injury:
                a = new AgentActionInjury();
                break;

            case E_Type.Roll:
                a = new AgentActionRoll();
                break;

            case E_Type.WeaponChange:
                a = new AgentActionWeaponChange();
                break;

            case E_Type.Rotate:
                a = new AgentActionRotate();
                break;

            case E_Type.Use:
                a = new AgentActionUse();
                break;

            case E_Type.PlayAnim:
                a = new AgentActionPlayAnim();
                break;

            case E_Type.PlayIdleAnim:
                a = new AgentActionPlayIdleAnim();
                break;

            case E_Type.Death:
                a = new AgentActionDeath();
                break;

            case E_Type.Knockdown:
                a = new AgentActionKnockdown();
                break;

            case E_Type.Teleport:
                a = new AgentActionTeleport();
                break;

            case E_Type.CoverEnter:
                a = new AgentActionCoverEnter();
                break;

            case E_Type.CoverMove:
                a = new AgentActionCoverMove();
                break;

            case E_Type.CoverFire:
                a = new AgentActionCoverFire();
                break;

            case E_Type.CoverFireCancel:
                a = new AgentActionCoverFireCancel();
                break;

            case E_Type.CoverLeave:
                a = new AgentActionCoverLeave();
                break;

            case E_Type.Reload:
                a = new AgentActionReload();
                break;

            case E_Type.UseItem:
                a = new AgentActionUseItem();
                break;

            case E_Type.ConstructGadget:
                a = new AgentActionConstructGadget();
                break;

            case E_Type.TeamCommand:
                a = new AgentActionTeamCommand();
                break;

            default:
                Debug.LogError("no AgentAction to create");
                return(null);
            }
        }
        a.Reset();
        a.SetActive();

        // DEBUG !!!!!!
        //	m_ActionsInAction.Add(a);
        return(a);
    }