예제 #1
0
 public void Initialize(GroundAnimalHabitatPoint _habitatPoint)
 {
     this.Clear();
     if (Object.op_Equality((Object)(this.habitatPoint = _habitatPoint), (Object)null))
     {
         this.SetState(AnimalState.Destroyed, (Action)null);
     }
     else if (!this.habitatPoint.Available || !this.habitatPoint.SetUse(this))
     {
         this.SetState(AnimalState.Destroyed, (Action)null);
     }
     else
     {
         this.DeactivateNavMeshElements();
         this.SetWaypoints(this.habitatPoint);
         this.stateController.Initialize((AnimalBase)this);
         this.desireController.Initialize(Object.op_Implicit((Object)this));
         this.SearchAction.SetSearchEnabled(false, true);
         this.SearchActor.SetSearchEnabled(false, true);
         this.LoadBody();
         this.SetStateData();
         this.BodyEnabled = false;
         this.IsEscape    = (double)Random.Range(0.0f, 100f) < (double)this.escapePercent;
         this.SetIsEscape = false;
         this.SetState(AnimalState.Repop, (Action)null);
     }
 }
        private bool AvailablePoint(GroundAnimalHabitatPoint _point)
        {
            if (Object.op_Equality((Object)_point.InsidePoint, (Object)null) || !((Component)_point).get_gameObject().get_activeSelf())
            {
                return(false);
            }
            Vector3 position1 = _point.InsidePoint.get_position();
            Vector3 position2 = this._centerPoint.get_position();

            return((double)this.DistanceY(position1, position2) <= (double)this._moveHeight && (double)this.DistanceXZ(position1, position2) <= (double)this._moveRadius);
        }
예제 #3
0
 protected override void OnDestroy()
 {
     this.Active = false;
     if (Object.op_Inequality((Object)this.habitatPoint, (Object)null))
     {
         this.habitatPoint.StopUse(this);
         this.habitatPoint = (GroundAnimalHabitatPoint)null;
     }
     this.Dispose();
     base.OnDestroy();
 }
예제 #4
0
 protected void SetWaypoints(GroundAnimalHabitatPoint _habitatPoint)
 {
     if (this.MoveArea != null)
     {
         this.MoveArea.Clear();
     }
     if (this.MoveArea == null)
     {
         this.MoveArea = new LocomotionArea();
     }
     if (Object.op_Equality((Object)_habitatPoint, (Object)null))
     {
         return;
     }
     this.MoveArea.SetWaypoint(_habitatPoint.Waypoints);
 }