// Token: 0x060013D3 RID: 5075 RVA: 0x0006124C File Offset: 0x0005F44C
        public void BakeRoaches2()
        {
            List <RoachController.Roach> list = new List <RoachController.Roach>();

            for (int i = 0; i < this.roachCount; i++)
            {
                Ray        ray = new Ray(base.transform.position, Util.ApplySpread(base.transform.forward, this.placementSpreadMin, this.placementSpreadMax, 1f, 1f, 0f, 0f));
                RaycastHit raycastHit;
                if (Physics.Raycast(ray, out raycastHit, this.placementMaxDistance, LayerIndex.world.mask))
                {
                    RoachController.SimulatedRoach simulatedRoach = new RoachController.SimulatedRoach(raycastHit.point + raycastHit.normal * 0.01f, raycastHit.normal, ray.direction, this.roachParams);
                    float keyframeInterval = this.roachParams.keyframeInterval;
                    List <RoachController.KeyFrame> list2 = new List <RoachController.KeyFrame>();
                    while (!simulatedRoach.finished)
                    {
                        simulatedRoach.Simulate(keyframeInterval);
                        list2.Add(new RoachController.KeyFrame
                        {
                            position = simulatedRoach.transform.position,
                            rotation = simulatedRoach.transform.rotation,
                            time     = simulatedRoach.age
                        });
                    }
                    RoachController.KeyFrame keyFrame = list2[list2.Count - 1];
                    keyFrame.position     += keyFrame.rotation * (Vector3.down * 0.25f);
                    list2[list2.Count - 1] = keyFrame;
                    simulatedRoach.Dispose();
                    list.Add(new RoachController.Roach
                    {
                        keyFrames = list2.ToArray()
                    });
                }
            }
            this.roaches = list.ToArray();
        }
 // Token: 0x060013D6 RID: 5078 RVA: 0x00061450 File Offset: 0x0005F650
 public void DebakeRoaches()
 {
     this.ClearRoachPathEditors();
     for (int i = 0; i < this.roaches.Length; i++)
     {
         RoachController.Roach roach = this.roaches[i];
         RoachController.RoachPathEditorComponent roachPathEditorComponent = this.AddPathEditorObject();
         for (int j = 0; j < roach.keyFrames.Length; j++)
         {
             RoachController.KeyFrame keyFrame = roach.keyFrames[j];
             RoachController.RoachNodeEditorComponent roachNodeEditorComponent = roachPathEditorComponent.AddNode();
             roachNodeEditorComponent.transform.position = keyFrame.position;
             roachNodeEditorComponent.transform.rotation = keyFrame.rotation;
         }
     }
 }
        // Token: 0x060013D8 RID: 5080 RVA: 0x00061508 File Offset: 0x0005F708
        private void UpdateRoach(int i)
        {
            RoachController.KeyFrame[] keyFrames = this.roaches[i].keyFrames;
            float num = Mathf.Min(this.scatterStartTime.timeSince, keyFrames[keyFrames.Length - 1].time);

            for (int j = 1; j < keyFrames.Length; j++)
            {
                if (num <= keyFrames[j].time)
                {
                    RoachController.KeyFrame keyFrame  = keyFrames[j - 1];
                    RoachController.KeyFrame keyFrame2 = keyFrames[j];
                    float t = Mathf.InverseLerp(keyFrame.time, keyFrame2.time, num);
                    this.SetRoachPosition(i, Vector3.Lerp(keyFrame.position, keyFrame2.position, t), Quaternion.Slerp(keyFrame.rotation, keyFrame2.rotation, t));
                    return;
                }
            }
        }