public void Initialize(FarmPoint farmPoint) { this.Clear(); FarmPoint farmPoint1 = farmPoint; this.FarmPoint = farmPoint1; if (Object.op_Equality((Object)farmPoint1, (Object)null)) { this.SetState(AnimalState.Destroyed, (Action)null); } else { this._restrictedPointList = this.FarmPoint.ChickenWaypointList; List <Waypoint> toRelease = ListPool <Waypoint> .Get(); if (!this._restrictedPointList.IsNullOrEmpty <Waypoint>()) { foreach (Waypoint restrictedPoint in (IEnumerable <Waypoint>) this._restrictedPointList) { if (Object.op_Inequality((Object)restrictedPoint, (Object)null) && restrictedPoint.Available((INavMeshActor)this)) { toRelease.Add(restrictedPoint); } } } while (!((IReadOnlyList <Waypoint>)toRelease).IsNullOrEmpty <Waypoint>()) { int index = Random.Range(0, toRelease.Count); Waypoint waypoint = toRelease[index]; toRelease.RemoveAt(index); if (waypoint.Available((INavMeshActor)this)) { this._destination = waypoint; break; } } ListPool <Waypoint> .Release(toRelease); Dictionary <int, AnimalModelInfo> source; if (Singleton <Manager.Resources> .Instance.AnimalTable.ModelInfoTable.TryGetValue(this.AnimalData.AnimalTypeID, out source) && !((IReadOnlyDictionary <int, AnimalModelInfo>)source).IsNullOrEmpty <int, AnimalModelInfo>()) { KeyValuePair <int, AnimalModelInfo> keyValuePair = source.Rand <int, AnimalModelInfo>(); this.AnimalData.ModelID = keyValuePair.Key; this.SetModelInfo(keyValuePair.Value); } this.LoadBody(); this.SetStateData(); if (Object.op_Equality((Object)this._nicknameRoot, (Object)null)) { Transform transform = !Object.op_Inequality((Object)this.bodyObject, (Object)null) ? ((Component)this).get_transform() : this.bodyObject.get_transform(); this._nicknameRoot = new GameObject("Nickname Root").get_transform(); this._nicknameRoot.SetParent(transform, false); this._nicknameRoot.set_localPosition(new Vector3(0.0f, this.NicknameHeightOffset, 0.0f)); } bool flag = false; this.MarkerEnabled = flag; this.BodyEnabled = flag; ((Behaviour)this.Agent).set_enabled(false); this._originPriority = Singleton <Manager.Resources> .Instance.AnimalDefinePack.AgentInfo.GroundAnimalStartPriority; this._originPriority += this.ChickenIndex; this.Agent.set_avoidancePriority(this._originPriority); if (Object.op_Inequality((Object)this._destination, (Object)null)) { this._destination.Reserver = (INavMeshActor)this; this.Position = ((Component)this._destination).get_transform().get_position(); this.Rotation = Quaternion.Euler(0.0f, Random.Range(0.0f, 360f), 0.0f); } this.SetState(AnimalState.Start, (Action)null); } }