コード例 #1
0
    public override void OnDeactivate()
    {
        // ALWAYS Success
        Owner.BlackBoard.ReactOnHits = true;
        Owner.BlackBoard.BusyAction  = false;

        Owner.BlackBoard.Cover     = Action.Cover;
        Owner.BlackBoard.CoverPose = Action.Cover.IsStandAllowed ? E_CoverPose.Stand : E_CoverPose.Crouch;

        if (Owner.BlackBoard.Desires.CoverPosition == E_CoverDirection.Unknown)
        {
            Owner.BlackBoard.CoverPosition = E_CoverDirection.Middle;             // player shit
        }
        else
        {
            Owner.BlackBoard.CoverPosition = Owner.BlackBoard.Desires.CoverPosition;
        }

        if (Owner.BlackBoard.CoverPosition == E_CoverDirection.Left || Owner.BlackBoard.CoverPosition == E_CoverDirection.Right)
        {
            Owner.WorldState.SetWSProperty(E_PropKey.CoverState, E_CoverState.Edge);
        }
        else
        {
            Owner.WorldState.SetWSProperty(E_PropKey.CoverState, E_CoverState.Middle);
        }

        //      Time.timeScale = 1;
        Action.SetSuccess();
        Action = null;
        base.OnDeactivate();
    }
コード例 #2
0
    public override void Activate()
    {
        base.Activate();

        if (Owner.BlackBoard.Desires.CoverSelected)
        {
            Action = Owner.CoverStart(Owner.BlackBoard.Desires.CoverSelected, Owner.BlackBoard.Desires.CoverPosition);
        }
    }
コード例 #3
0
    public override void Reset()
    {
        // ALWAYS Success
        Owner.BlackBoard.ReactOnHits = true;
        Owner.BlackBoard.BusyAction  = false;

        //      Time.timeScale = 1;
        Action.SetSuccess();
        Action = null;

        base.Reset();
    }
コード例 #4
0
    protected override void Initialize(AgentAction action)
    {
        base.Initialize(action);

        Action = action as AgentActionCoverEnter;

        CurrentMoveTime = 0;
        StartPosition   = Transform.position;

        string AnimName = Owner.AnimSet.GetCoverAnim(AnimSet.E_CoverAnim.Enter,
                                                     Action.Cover.IsStandAllowed ? E_CoverPose.Stand : E_CoverPose.Crouch,
                                                     E_CoverDirection.Middle);

        CrossFade(AnimName, 0.15f, PlayMode.StopAll);
        Owner.SetDominantAnimName(AnimName);

        if (Owner.BlackBoard.Desires.CoverPosition == E_CoverDirection.Unknown)
        {
            FinalPosition = Action.Cover.GetNearestPointOnCover(Owner.Position);
        }
        else if (Owner.BlackBoard.Desires.CoverPosition == E_CoverDirection.Left)
        {
            FinalPosition = Action.Cover.LeftEdge;
        }
        else if (Owner.BlackBoard.Desires.CoverPosition == E_CoverDirection.Right)
        {
            FinalPosition = Action.Cover.RightEdge;
        }
        else if (Owner.BlackBoard.Desires.CoverPosition == E_CoverDirection.Middle)
        {
            FinalPosition = Action.Cover.Transform.position;
        }

        Animation[AnimName].speed = 1.2f;
        MoveTime       = 0.3f;
        EndOfStateTime = 0.3f + Time.timeSinceLevelLoad;

        PositionOK = false;

        Owner.BlackBoard.MotionType = E_MotionType.None;
    }
コード例 #5
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);
    }