示例#1
0
    void CreateIdle()
    {
        Agent.BlackBoard.DesiredPosition = Agent.Position;
        AgentAction _action = AgentActionFactory.Create(AgentActionFactory.E_Type.E_Idle);

        Agent.BlackBoard.AddAction(_action);
    }
    protected void CoverLeave(AgentActionCoverLeave.E_Type typeOfLeave, uLink.NetworkMessageInfo info)
    {
        //TODO: How is this? I believe we definitelly cannot afford to ignore the CoverLeave event on both on proxies and I think we
        //should not ignore it on server too. No doubt about proxies - they should just do what they are told to do.
        //About the server - how can we ignore it without fixing a client? If we ignore it, the player stayes in a cover forever
        //which might cause both: visual artefacts and even detecting player as a cheater.
        //I don't think that a potential cheater can gain much of benefit by leaving the cover prematurely.

        //if (Owner.BlackBoard.DontUpdate)
        //	return;

        if (Owner.IsInCover)
        {
#if !DEADZONE_CLIENT
            if (Owner.IsServer)
            {
                ServerAnticheat.ReportCoverLeave(Owner.NetworkView.owner, typeOfLeave, info);
                Owner.NetworkView.RPC("CoverLeave", uLink.RPCMode.OthersExceptOwner, typeOfLeave);
            }
#endif

            AgentActionCoverLeave action = AgentActionFactory.Create(AgentActionFactory.E_Type.CoverLeave) as AgentActionCoverLeave;
            action.TypeOfLeave        = typeOfLeave;
            action.FinalViewDirection = Owner.BlackBoard.Cover.Forward;
            action.Cover = Owner.BlackBoard.Cover;

            Owner.BlackBoard.ActionAdd(action);
        }
    }
    protected override AgentAction MakeAgentAction()
    {
        AgentActionAttackWhirl agentAction = AgentActionFactory.Get(AgentActionType.ATTACK_WHIRL, Owner) as AgentActionAttackWhirl;

        agentAction.data = Owner.AnimSet.GetWhirlAttackAnim();
        return(agentAction);
    }
示例#4
0
    private void DoAction()
    {
        Action = null;

        if (Owner.BlackBoard.DesiredTarget == null)
        {
            return;
        }

        Action = AgentActionFactory.Create(AgentActionFactory.E_Type.E_BLOCK) as AgentActionBlock;

        Action.Attacker = Owner.BlackBoard.DesiredTarget;
        Action.Time     = 3.0f;

        Owner.BlackBoard.ActionAdd(Action);

        WorldStateProp prop = Owner.WorldState.GetWSProperty(E_PropKey.E_IN_DODGE);

        if (prop == null || prop.GetBool() == true)
        {
            return;
        }

        //WorldStateTime = prop.Time;


        //UnityEngine.Debug.Log(this.ToString() + "Send new roll action to pos " + Action.Direction.ToString());
    }
示例#5
0
    public override void Update()
    {
        if (Owner.IsAlive == false)
        {
            Interruptible = true;
        }

        if (Count == 3)
        {
            if (Action.IsActive() == false && ActionAttack == null)
            {
                Owner.SoundPlayBerserk();
                Owner.BlackBoard.Invulnerable = true;
                ActionAttack           = AgentActionFactory.Create(AgentActionFactory.E_Type.E_ATTACK) as AgentActionAttack;
                ActionAttack.Data      = Owner.AnimSet.GetFirstAttackAnim(Owner.BlackBoard.WeaponSelected, E_AttackType.O);
                ActionAttack.AttackDir = Owner.Forward;
                Owner.BlackBoard.ActionAdd(ActionAttack);
            }
            return;
        }

        WorldStateProp prop = Owner.WorldState.GetWSProperty(E_PropKey.E_EVENT);

        if (prop == null || prop.GetEvent() != E_EventTypes.Hit || Owner.IsAlive == false)
        {
            return;
        }

        SendAction();
    }
    protected void UseItemInCover(E_ItemID gadget, E_CoverPose coverPose, E_CoverDirection coverDirection, uLink.NetworkMessageInfo info)
    {
        if (Owner.BlackBoard.DontUpdate)
        {
            return;
        }

#if !DEADZONE_CLIENT
        if (Owner.IsServer)
        {
            ServerAnticheat.ReportUseItemInCover(Owner.NetworkView.owner, gadget, coverPose, coverDirection, info);
            Owner.NetworkView.RPC("UseItemInCover", uLink.RPCMode.OthersExceptOwner, gadget, coverPose, coverDirection);
        }
#endif

        Owner.BlackBoard.KeepMotion     = false;
        Owner.BlackBoard.Desires.Gadget = gadget;

        AgentActionUseItem a = AgentActionFactory.Create(AgentActionFactory.E_Type.UseItem) as AgentActionUseItem;

        a.CoverDirection = coverDirection;
        a.CoverPose      = coverPose;

        Owner.BlackBoard.ActionAdd(a);

        Owner.WorldState.SetWSProperty(E_PropKey.AtTargetPos, true);
    }
示例#7
0
    public override void Activate()
    {
        base.Activate();

        ActionMove = AgentActionFactory.Create(AgentActionFactory.E_Type.Move) as AgentActionMove;
        Owner.BlackBoard.ActionAdd(ActionMove);
    }
示例#8
0
    /*private void ActionRotate(Vector3 direction)
     * {
     *      RotateAction = AgentActionFactory.Create(AgentActionFactory.E_Type.Rotate) as AgentActionRotate;
     *      RotateAction.Direction = direction;
     *      Owner.BlackBoard.AddAction(RotateAction);
     * }*/

    private void SendAction()
    {
        Fact fact = Owner.Memory.GetFact(Query);

        if (fact != null)
        {
            Action        = AgentActionFactory.Create(AgentActionFactory.E_Type.Rotate) as AgentActionRotate;
            Action.Target = fact.Agent;

            Action.RotationModifier = 0.8f;

            Owner.BlackBoard.AddAction(Action);

            //if (Owner.debugGOAP) Debug.Log(this.ToString() + " - " + Action.Target.GameObject.ToString());
        }
        else if (Owner.BlackBoard.DesiredTarget != null)
        {
            Action        = AgentActionFactory.Create(AgentActionFactory.E_Type.Rotate) as AgentActionRotate;
            Action.Target = Owner.BlackBoard.DesiredTarget;

            Action.RotationModifier = 0.5f;

            Owner.BlackBoard.AddAction(Action);

            //if (Owner.debugGOAP) Debug.Log(this.ToString() + " - " + Action.Target.GameObject.ToString());
        }


        //UnityEngine.Debug.Log(this.ToString() + "Send new goto action to pos " + FinalPos.ToString());
    }
    void DoAttackAction()
    {
        Action            = AgentActionFactory.Create(AgentActionFactory.E_Type.E_ATTACK) as AgentActionAttack;
        Action.Target     = null;// Owner.BlackBoard.DesiredTarget != null && Owner.BlackBoard.DesiredTarget.IsAlive ? Owner.BlackBoard.DesiredTarget : null;
        Action.AttackType = E_AttackType.X;

        if (Owner.BlackBoard.DesiredTarget != null && Owner.BlackBoard.DesiredTarget.IsAlive)
        {
            Vector3 dir = Owner.BlackBoard.DesiredTarget.Position - Owner.Position;
            dir.Normalize();
            Owner.BlackBoard.DesiredDirection = dir;
        }
        else
        {
            Owner.BlackBoard.DesiredDirection = Owner.Forward;
        }

        Action.AttackDir = Owner.BlackBoard.DesiredDirection;

        Action.Hit             = false;
        Action.AttackPhaseDone = false;

        // Debug.Log("action attack  " + (Action.AttackTarget != null ? Action.AttackTarget.name : "no target"));

        Owner.BlackBoard.ActionAdd(Action);
    }
示例#10
0
    public override void Activate()
    {
        base.Activate();

        Action = AgentActionFactory.Create(AgentActionFactory.E_Type.Reload) as AgentActionReload;
        Owner.BlackBoard.ActionAdd(Action);
    }
示例#11
0
 public override void Activate()
 {
     base.Activate();
     Action          = AgentActionFactory.Create(AgentActionFactory.E_Type.E_Move) as AgentActionMove;
     Action.MoveType = AgentActionMove.E_MoveType.E_MT_Forward;
     Owner.BlackBoard.AddAction(Action);
 }
示例#12
0
    void CreateWeaponShow()
    {
        AgentActionWeaponShow _action = AgentActionFactory.Create(AgentActionFactory.E_Type.E_Weapon_Show) as AgentActionWeaponShow;

        _action.Show = true;
        Agent.BlackBoard.AddAction(_action);
    }
示例#13
0
 public override void Activate()
 {
     base.Activate();
     Action          = AgentActionFactory.Create(AgentActionFactory.E_Type.E_PLAY_ANIM) as AgentActionPlayAnim;
     Action.AnimName = Owner.BlackBoard.DesiredAnimName;
     Owner.BlackBoard.AddAction(Action);
 }
示例#14
0
    private void ActionDone(AgentAction action)
    {
        #region  //

        /*if(action.IsSuccess())
         * {
         *  /*if (action is AgentActionGoTo && (action as AgentActionGoTo).FinalPosition == DesiredPosition)
         *  {
         *      //Debug.Log(action.ToString() + "is done, setting E_AT_TARGET_POS to true");
         *      Owner.WorldState.SetWSProperty(E_PropKey.E_AT_TARGET_POS, true);
         *  }
         *  else if (action is AgentActionWeaponShow)
         *  {
         *      //Debug.Log(action.ToString() + "is done, setting E_WEAPON_IN_HANDS to " + (action as AgentActionWeaponShow).Show.ToString());
         *      Owner.WorldState.SetWSProperty(E_PropKey.E_WEAPON_IN_HANDS, (action as AgentActionWeaponShow).Show);
         *  }
         *  else if (action is AgentActionUseLever)
         *  {
         *      Owner.WorldState.SetWSProperty(E_PropKey.E_USE_WORLD_OBJECT, false);
         *      InteractionObject = null;
         *      Interaction = E_InteractionType.E_NONE;
         *
         *  }
         *  else if (action is AgentActionPlayAnim)
         *  {
         *      Owner.WorldState.SetWSProperty(E_PropKey.E_PLAY_ANIM, false);
         *      DesiredAnimation = null;
         *  }
         * }*/
        #endregion
        AgentActionFactory.Return(action);
    }
示例#15
0
    void CreateMove(Vector3 _moveDirection)
    {
        Agent.BlackBoard.DesiredDirection = _moveDirection;
        Agent.BlackBoard.DesiredPosition  = Agent.Position;
        AgentAction _action = AgentActionFactory.Create(AgentActionFactory.E_Type.E_Move);

        Agent.BlackBoard.AddAction(_action);
    }
示例#16
0
    public override void Deactivate()
    {
        Owner.WorldState.SetWSProperty(E_PropKey.E_AT_TARGET_POS, true);
        AgentActionIdle a = AgentActionFactory.Create(AgentActionFactory.E_Type.E_IDLE) as AgentActionIdle;

        Owner.BlackBoard.AddAction(a);
        base.Deactivate();
    }
示例#17
0
 public override void Activate()
 {
     base.Activate();
     Owner.BlackBoard.WeaponState = E_WeaponState.Ready;
     Action      = AgentActionFactory.Create(AgentActionFactory.E_Type.E_Weapon_Show) as AgentActionWeaponShow;
     Action.Show = false;
     Owner.BlackBoard.AddAction(Action);
 }
示例#18
0
    protected override AgentAction MakeAgentAction()
    {
        AgentActionBlock agentAction = AgentActionFactory.Get(AgentActionType.BLOCK, Owner) as AgentActionBlock;

        agentAction.attacker = Owner.BlackBoard.desiredTarget;
        agentAction.time     = 3.0f;
        return(agentAction);
    }
示例#19
0
    public override void Activate()
    {
        base.Activate();

        Action          = AgentActionFactory.Create(AgentActionFactory.E_Type.PlayAnim) as AgentActionPlayAnim;
        Action.AnimName = Owner.BlackBoard.Desires.Animation;
        Owner.BlackBoard.ActionAdd(Action);
    }
示例#20
0
    void DoAttackAction()
    {
        Action = null;

        Action      = AgentActionFactory.Create(AgentActionFactory.E_Type.E_ATTACK_WHIRL) as AgentActionAttackWhirl;
        Action.Data = Owner.AnimSet.GetWhirlAttackAnim();
        Owner.BlackBoard.AddAction(Action);
    }
示例#21
0
    public override void Activate()
    {
        base.Activate();

        Action          = AgentActionFactory.Create(AgentActionFactory.E_Type.E_MOVE) as AgentActionMove;
        Action.MoveType = AgentActionMove.E_MoveType.E_MT_FORWARD;
        Owner.BlackBoard.ActionAdd(Action);
    }
示例#22
0
    protected override AgentAction MakeAgentAction()
    {
        AgentActionGoTo agentAction = AgentActionFactory.Get(AgentActionType.GOTO_POS, Owner) as AgentActionGoTo;

        agentAction.moveType      = MoveType.FORWARD;
        agentAction.motionType    = MotionType.SPRINT;
        agentAction.finalPosition = GetBestAttackStart(Owner.BlackBoard.desiredTarget);
        return(agentAction);
    }
示例#23
0
    public override void Activate()
    {
        base.Activate();

        Owner.BlackBoard.WeaponState = E_WeaponState.Ready;

        Action = AgentActionFactory.Create(AgentActionFactory.E_Type.E_PLAY_IDLE_ANIM) as AgentActionPlayIdleAnim;
        Owner.BlackBoard.AddAction(Action);
    }
示例#24
0
    void DoAttackAction()
    {
        Action = null;

        Action           = AgentActionFactory.Create(AgentActionFactory.E_Type.E_ATTACK) as AgentActionAttack;
        Action.Data      = Owner.AnimSet.GetFirstAttackAnim(Owner.BlackBoard.WeaponSelected, E_AttackType.Berserk);
        Action.AttackDir = Owner.Forward;
        Owner.BlackBoard.ActionAdd(Action);
    }
示例#25
0
    void SendAction()
    {
        Action        = AgentActionFactory.Create(AgentActionFactory.E_Type.E_ATTACK_ROLL) as AgentActionAttackRoll;
        Action.Data   = Owner.AnimSet.GetRollAttackAnim();
        Action.Target = Owner.BlackBoard.DesiredTarget;
        // Debug.Log("action attack  " + (Action.AttackTarget != null ? Action.AttackTarget.name : "no target"));

        Owner.BlackBoard.AddAction(Action);
    }
示例#26
0
    void ActionCommand(E_CommandID id)
    {
        //TODO: do something clever here...
        AgentActionTeamCommand a = AgentActionFactory.Create(AgentActionFactory.E_Type.TeamCommand) as AgentActionTeamCommand;

        a.Command = id;

        Owner.BlackBoard.ActionAdd(a);
    }
示例#27
0
 public override void Update()
 {
     if (Owner.BlackBoard.MotionType != E_MotionType.Sprint && Owner.WorldState.GetWSProperty(E_PropKey.WeaponLoaded).GetBool() == false &&
         Owner.WeaponComponent.GetCurrentWeapon().IsBusy() == false && Owner.WeaponComponent.GetCurrentWeapon().WeaponAmmo > 0)
     {
         AgentAction a = AgentActionFactory.Create(AgentActionFactory.E_Type.Reload) as AgentActionReload;
         Owner.BlackBoard.ActionAdd(a);
     }
 }
示例#28
0
    public override void Deactivate()
    {
        base.Deactivate();

        Owner.WorldState.SetWSProperty(E_PropKey.AtTargetPos, true);
        AgentActionIdle a = AgentActionFactory.Create(AgentActionFactory.E_Type.Idle) as AgentActionIdle;

        Owner.BlackBoard.ActionAdd(a);
    }
示例#29
0
    public override void Activate()
    {
        base.Activate();

        Owner.BlackBoard.WeaponState = E_WeaponState.Ready;

        Action      = AgentActionFactory.Create(AgentActionFactory.E_Type.E_WEAPON_SHOW) as AgentActionWeaponShow;
        Action.Show = true;
        Owner.BlackBoard.ActionAdd(Action);
    }
示例#30
0
    /*private void ActionRotate(Vector3 direction)
     * {
     *      RotateAction = AgentActionFactory.Create(AgentActionFactory.E_Type.Rotate) as AgentActionRotate;
     *      RotateAction.Direction = direction;
     *      Owner.BlackBoard.AddAction(RotateAction);
     * }*/

    private void SendAction()
    {
        Action                     = AgentActionFactory.Create(AgentActionFactory.E_Type.E_COMBAT_MOVE) as AgentActioCombatMove;
        Action.MoveType            = E_MoveType.Forward;
        Action.Target              = Owner.BlackBoard.DesiredTarget;
        Action.DistanceToMove      = UnityEngine.Random.Range((Owner.BlackBoard.DistanceToTarget - (Owner.BlackBoard.CombatRange * 0.5f)) * 0.5f, Owner.BlackBoard.DistanceToTarget - (Owner.BlackBoard.CombatRange * 0.5f));
        Action.MinDistanceToTarget = 3;
        Owner.BlackBoard.AddAction(Action);
        //UnityEngine.Debug.Log(this.ToString() + "Send new goto action to pos " + FinalPos.ToString());
    }