protected override void OnDestroy()
 {
     this.Active = false;
     foreach (WildBirdFlock.Bird bird in this.birds)
     {
         bird?.Destroy();
     }
     this.birds.Clear();
     if (Object.op_Inequality((Object)this.habitatPoint, (Object)null))
     {
         this.habitatPoint.StopUse(this);
         this.habitatPoint = (BirdFlockHabitatPoint)null;
     }
     base.OnDestroy();
 }
        public void Initialize(BirdFlockHabitatPoint _habitatPoint)
        {
            this.Clear();
            if (Object.op_Equality((Object)(this.habitatPoint = _habitatPoint), (Object)null))
            {
                this.SetState(AnimalState.Destroyed, (Action)null);
            }
            else if (!this.habitatPoint.SetUse(this))
            {
                this.SetState(AnimalState.Destroyed, (Action)null);
            }
            else
            {
                this.areaInfo = (BirdFlockHabitatPoint.BirdMoveAreaInfo)null;
                List <BirdFlockHabitatPoint.BirdMoveAreaInfo> birdMoveAreaInfoList = ListPool <BirdFlockHabitatPoint.BirdMoveAreaInfo> .Get();

                birdMoveAreaInfoList.AddRange((IEnumerable <BirdFlockHabitatPoint.BirdMoveAreaInfo>) this.habitatPoint.AreaInfos);
                while (!((IReadOnlyList <BirdFlockHabitatPoint.BirdMoveAreaInfo>)birdMoveAreaInfoList).IsNullOrEmpty <BirdFlockHabitatPoint.BirdMoveAreaInfo>())
                {
                    this.areaInfo = birdMoveAreaInfoList.GetRand <BirdFlockHabitatPoint.BirdMoveAreaInfo>();
                    if (this.areaInfo == null || this.areaInfo.Available)
                    {
                        ;
                    }
                }
                ListPool <BirdFlockHabitatPoint.BirdMoveAreaInfo> .Release(birdMoveAreaInfoList);

                if (this.areaInfo == null)
                {
                    this.SetState(AnimalState.Destroyed, (Action)null);
                }
                else
                {
                    this.SetStateData();
                    MapArea ownerArea = this.habitatPoint.OwnerArea;
                    this.ChunkID = !Object.op_Inequality((Object)ownerArea, (Object)null) ? 0 : ownerArea.ChunkID;
                    this.birdNum = this.areaInfo.CreateNumRange.RandomRange();
                    Vector3 position1 = this.areaInfo.StartPoint.get_position();
                    Vector3 position2 = this.areaInfo.EndPoint.get_position();
                    this.deathDistance = Vector3.Distance(position1, position2);
                    this.Position      = position1;
                    this.Rotation      = Quaternion.LookRotation(Vector3.op_Subtraction(position2, position1), Vector3.get_up());
                    this.MarkerEnabled = true;
                    this.SetState(AnimalState.Locomotion, (Action)null);
                }
            }
        }
 public override void Clear()
 {
     base.Clear();
     if (!((IReadOnlyList <WildBirdFlock.Bird>) this.birds).IsNullOrEmpty <WildBirdFlock.Bird>())
     {
         foreach (WildBirdFlock.Bird bird in this.birds)
         {
             bird?.Destroy();
         }
         this.birds.Clear();
     }
     if (!Object.op_Inequality((Object)this.habitatPoint, (Object)null))
     {
         return;
     }
     this.habitatPoint.StopUse(this);
     this.habitatPoint = (BirdFlockHabitatPoint)null;
 }