void Start() { if (Vision != null) { Vision.VisionOwner = gameObject; Vision.transform.position = VisionPlaceholder.position; } PubSubService.RegisterListener <TargetSpottedEvent>(OnTargetSpotted); PubSubService.RegisterListener <TargetLostEvent>(OnTargetLost); }
void Start() { CurrentTarget = null; agent.speed = enemy.EnemyStats.MovementSpeed; //stateMachine.ChangeState(new EnemyIdleState(animation, new AnimationClip[1], agent)); // Setup vision parameters and subscribe to events; if (Vision != null) { Vision.VisionOwner = gameObject; Vision.transform.position = VisionPlaceholder.position; Vision.transform.parent = VisionPlaceholder; } PubSubService.RegisterListener <TargetSpottedEvent>(OnTargetSpotted); PubSubService.RegisterListener <TargetLostEvent>(OnTargetLost); }