Exemplo n.º 1
0
 protected override void OnDestroy()
 {
     this.Active = false;
     if (Object.op_Inequality((Object)this.habitatPoint, (Object)null))
     {
         this.habitatPoint.StopUse(this);
         this.habitatPoint = (ButterflyHabitatPoint)null;
     }
     base.OnDestroy();
 }
Exemplo n.º 2
0
 public void Initialize(ButterflyHabitatPoint _habitatPoint)
 {
     this.Clear();
     if (Object.op_Equality((Object)(this.habitatPoint = _habitatPoint), (Object)null))
     {
         this.SetState(AnimalState.Destroyed, (Action)null);
     }
     else
     {
         this.habitatPoint.SetUse(this);
         if (!this.habitatPoint.Available)
         {
             this.SetState(AnimalState.Destroyed, (Action)null);
         }
         else
         {
             MapArea ownerArea = this.habitatPoint.OwnerArea;
             this.ChunkID = !Object.op_Inequality((Object)ownerArea, (Object)null) ? 0 : ownerArea.ChunkID;
             this.LoadBody();
             this.SetStateData();
             this.animation = (Animation)((Component)this).GetComponentInChildren <Animation>(true);
             string _paramName = string.Empty;
             float  _speed     = 1f;
             if (Singleton <Resources> .IsInstance() && Object.op_Inequality((Object)Singleton <Resources> .Instance.AnimalDefinePack, (Object)null))
             {
                 AnimalDefinePack.AnimatorInfoGroup animatorInfo = Singleton <Resources> .Instance.AnimalDefinePack.AnimatorInfo;
                 if (animatorInfo != null)
                 {
                     _paramName = animatorInfo.AnimationSpeedParamName;
                     _speed     = animatorInfo.ButterflyAnimationSpeed;
                 }
             }
             this.SetAnimationSpeed(_paramName, _speed);
             Vector3 position1           = this.habitatPoint.DepopPoint.get_position();
             Vector3 position2           = this.habitatPoint.ViaPoint.get_position();
             float   viaPointRadius      = this.habitatPoint.ViaPointRadius;
             Vector3 randomMoveAreaPoint = this.GetRandomMoveAreaPoint();
             Vector3 vector3_1           = randomMoveAreaPoint;
             vector3_1.y = position2.y;
             Vector3 vector3_2 = Vector3.ClampMagnitude(Vector3.op_Subtraction(vector3_1, position2), viaPointRadius);
             Vector3 vector3_3 = Vector3.op_Addition(position2, vector3_2);
             this.pointList.Clear();
             this.pointList.Add(vector3_3);
             this.pointList.Add(randomMoveAreaPoint);
             randomMoveAreaPoint.y = position1.y;
             this.Rotation         = Quaternion.LookRotation(Vector3.op_Subtraction(randomMoveAreaPoint, position1), Vector3.get_up());
             this.Position         = position1;
             bool flag = false;
             this.MarkerEnabled = flag;
             this.BodyEnabled   = flag;
             this.SetState(AnimalState.Start, (Action)null);
         }
     }
 }