public override void Execute() { List <Transform> context = _flockEntity.GetNearbyEntities(); if (context.Count == 0) { _fsm.Transition(CheepCheep.States.SWIMMING); } else { Vector3 flockingDirection = _flockEntity.UpdateDirection(); _fish.Move(flockingDirection.normalized); } }
public override void Execute() { Vector3 currentPosition = _fish.transform.position; Vector3 offset = _target - currentPosition; List <Transform> context = _flockEntity.GetNearbyEntities(); if (context.Count > 0) { _fsm.Transition(CheepCheep.States.IN_FLOCK); } else if (offset.magnitude < _fish.ViewDistance) { _target = GameEngine.Instance.GetRandomPosition(); } else { _fish.Move(offset.normalized); } }