public override void OnSignal(Signal signal, string origin) { origin = origin + "::Follower"; switch (signal) { case Signal.TargetFound: { origin += "::" + TaskManagerDebugger.SignalNames[(int)signal]; // Start following TaskFollow taskFollow = new TaskFollow(); taskFollow.priority = 1; mTaskManager.TriggerTask(taskFollow, origin); taskFollow.Initialize(mPerception.GetTargetAgent().transform); // React to the finding TaskReactLeader taskReact = new TaskReactLeader(); taskReact.priority = 3; mTaskManager.TriggerTask(taskReact, origin); taskReact.Initialize(mPerception.GetTargetAgent().transform); } break; case Signal.TargetInRange: { origin += "::" + TaskManagerDebugger.SignalNames[(int)signal]; // Shoot at target TaskShoot taskShoot = new TaskShoot(); taskShoot.priority = 2; mTaskManager.TriggerTask(taskShoot, origin); taskShoot.Initialize(mPerception.GetTargetAgent().transform, bullet); } break; case Signal.TargetDeath: { gameObject.GetComponent <NavigationController>().speed = 1; } break; case Signal.Hit: { TaskReactHit taskReact = new TaskReactHit(); taskReact.priority = 4; mTaskManager.TriggerTask(taskReact, origin); } break; } mTaskManager.OnSignal(signal, origin); }
public override void OnSignal(Signal signal, string origin) { origin = origin + "::Follower"; switch (signal) { case Signal.Hit: { TaskReactHit taskReact = new TaskReactHit(); taskReact.priority = 4; mTaskManager.TriggerTask(taskReact, origin); } break; } mTaskManager.OnSignal(signal, origin); }
void OnCollisionEnter(Collision collision) { if (collision.relativeVelocity.magnitude > 1.0f) { if (collision.gameObject.name.Contains("Bullet")) { TaskReactHit taskReact = new TaskReactHit(); taskReact.priority = 4; mTaskManager.TriggerTask(taskReact, "Wanderer::OnCollisionEnter"); } } foreach (ContactPoint contact in collision.contacts) { Debug.DrawRay(contact.point, contact.normal, Color.white); } }