void Awake() { if (agentNavigator == null) { agentNavigator = gameObject.GetComponent <AgentNavigator>(); } }
// Use this for initialization void Start() { agentNavigator = gameObject.GetComponent <AgentNavigator>(); isHome = false; staminaLevel = UnityEngine.Random.Range(5, 22); if (staminaLevel > 15) { staminaLevel = 15; } }
public void SimulateAgent(Agent agent) { if (agent.IsHuman) { AgentNavigator agentNavigator = agent.GetComponent <CampaignAgentComponent>().AgentNavigator; int num = MBRandom.RandomInt(35, 50); agent.PreloadForRendering(); for (int i = 0; i < num; i++) { if (agentNavigator != null) { agentNavigator.Tick(0.1f, true); } if (agent.IsUsingGameObject) { agent.CurrentlyUsedGameObject.SimulateTick(0.1f); } } } }
public CharacterMovementActuator(Transform transform, Rigidbody rigidbody, AgentNavigator agentNavigator, IAgentAI agentAI, SwampCollisionListener swampCollisionListener, ICommandProvider commandProvider, CharacterConfiguration configuration) { _transform = transform; _rigidbody = rigidbody; _agentNavigator = agentNavigator; _commandProvider = commandProvider; _configuration = configuration; _attackMovementCanStart = false; _attackMovementMustEnd = false; _movementSpeedModifier = 1.0f; AnimationCallbackHandler animationCallbackHandler = _transform.GetComponentInChildren <AnimationCallbackHandler>(); animationCallbackHandler.AttackMovementStartEvent += HandleAttackMovementStartEvent; animationCallbackHandler.AttackMovementEndEvent += HandleAttackMovementEndEvent; agentAI.SetTargetEvent += HandleSetTargetEvent; swampCollisionListener.SwampEntryEvent += HandleSwampEntryEvent; }
/*public override void OnMissionTick(float dt) * { * base.OnMissionTick(dt); * * foreach (var VARIABLE in Mission.) * { * * } * * if (agent.IsMainAgent || !agent.IsHuman) * { * return; * } * * if (agent.GetComponent<CampaignAgentComponent>().AgentNavigator != null) * { * GiveOrdersAfterDeathSubModule.Print($"{agent.Name} : Setting DetectThievingBehaviour"); * AgentNavigator agentNavigator = agent.GetComponent<CampaignAgentComponent>().AgentNavigator; * agentNavigator.GetBehaviorGroup<DailyBehaviorGroup>().AddBehavior<DetectThievingBehaviour>(); * } * else * { * GiveOrdersAfterDeathSubModule.Print($"{agent.Name} : AgentNavigator is null"); * } * }*/ public override void AfterStart() { base.AfterStart(); foreach (Agent agent in Mission.Agents) { if (agent.IsMainAgent || !agent.IsHuman) { continue; } if (agent.GetComponent <CampaignAgentComponent>().AgentNavigator != null) { AgentNavigator agentNavigator = agent.GetComponent <CampaignAgentComponent>().AgentNavigator; agentNavigator.GetBehaviorGroup <DailyBehaviorGroup>().AddBehavior <DetectThievingBehaviour>(); GiveOrdersAfterDeathSubModule.Print($"{agent.Name} : Setting DetectThievingBehaviour"); } else { GiveOrdersAfterDeathSubModule.Print($"{agent.Name} : AgentNavigator is null"); } } }