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); }
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()); }
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); }
public override void Activate() { base.Activate(); ActionMove = AgentActionFactory.Create(AgentActionFactory.E_Type.Move) as AgentActionMove; Owner.BlackBoard.ActionAdd(ActionMove); }
/*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); }
public override void Activate() { base.Activate(); Action = AgentActionFactory.Create(AgentActionFactory.E_Type.Reload) as AgentActionReload; Owner.BlackBoard.ActionAdd(Action); }
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); }
void CreateWeaponShow() { AgentActionWeaponShow _action = AgentActionFactory.Create(AgentActionFactory.E_Type.E_Weapon_Show) as AgentActionWeaponShow; _action.Show = true; Agent.BlackBoard.AddAction(_action); }
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); }
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); }
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); }
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(); }
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); }
protected override AgentAction MakeAgentAction() { AgentActionBlock agentAction = AgentActionFactory.Get(AgentActionType.BLOCK, Owner) as AgentActionBlock; agentAction.attacker = Owner.BlackBoard.desiredTarget; agentAction.time = 3.0f; return(agentAction); }
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); }
void DoAttackAction() { Action = null; Action = AgentActionFactory.Create(AgentActionFactory.E_Type.E_ATTACK_WHIRL) as AgentActionAttackWhirl; Action.Data = Owner.AnimSet.GetWhirlAttackAnim(); Owner.BlackBoard.AddAction(Action); }
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); }
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); }
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); }
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); }
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); }
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); }
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); } }
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); }
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); }
/*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()); }