public override bool SetActionPoint(
     AnimalActionPoint _actionPoint,
     AnimalState _nextState,
     ActionTypes _actionType)
 {
     if (!((Behaviour)this.Agent).get_enabled())
     {
         return(this.SetActionPointNonAgent(_actionPoint, _nextState, _actionType));
     }
     if (Object.op_Equality((Object)_actionPoint, (Object)null) || Object.op_Equality((Object)this.actionPoint, (Object)_actionPoint) || _nextState == AnimalState.None)
     {
         return(false);
     }
     if (this.calculatePath == null)
     {
         this.calculatePath = new NavMeshPath();
     }
     if (!this.Agent.CalculatePath(_actionPoint.Destination, this.calculatePath) || this.calculatePath.get_status() != null || !this.Agent.SetPath(this.calculatePath))
     {
         return(false);
     }
     this.calculatePath = (NavMeshPath)null;
     this.ClearCurrentWaypoint();
     this.destination     = new Vector3?();
     this.LocomotionCount = 1;
     this.NextState       = _nextState;
     if (Object.op_Inequality((Object)this.actionPoint, (Object)null))
     {
         this.actionPoint.RemoveBooking((IAnimalActionPointUser)this);
     }
     this.actionPoint = _actionPoint;
     this.actionPoint.AddBooking((IAnimalActionPointUser)this);
     this.ActionType = _actionType;
     return(true);
 }
Exemple #2
0
 private void OnExit(AnimalActionPoint point)
 {
     if (Object.op_Equality((Object)point, (Object)null))
     {
         return;
     }
     this.VisibleList.Remove(point);
 }
Exemple #3
0
 private void OnEnter(AnimalActionPoint point)
 {
     if (Object.op_Equality((Object)point, (Object)null) || this.VisibleList.Contains(point))
     {
         return;
     }
     this.VisibleList.Add(point);
 }
Exemple #4
0
 public void RefreshQueryPoints()
 {
     AnimalActionPoint[] animalActionPoints = Singleton <Manager.Map> .Instance.PointAgent.AnimalActionPoints;
     this.SearchPoints.Clear();
     for (int index = 0; index < animalActionPoints.Length; ++index)
     {
         AnimalActionPoint animalActionPoint = animalActionPoints[index];
         if (Object.op_Inequality((Object)animalActionPoint, (Object)null))
         {
             this.SearchPoints.Add(animalActionPoint);
         }
     }
 }
        protected AnimalActionPoint[] GetActionPoints(ActionTypes _actionType)
        {
            List <AnimalActionPoint> toRelease = ListPool <AnimalActionPoint> .Get();

            for (int index = 0; index < this.ActionPoints.Count; ++index)
            {
                AnimalActionPoint actionPoint = this.ActionPoints[index];
                if (actionPoint.Available((IAnimalActionPointUser)this) && (actionPoint.ActionType & _actionType) != ActionTypes.None)
                {
                    toRelease.Add(actionPoint);
                }
            }
            AnimalActionPoint[] animalActionPointArray = new AnimalActionPoint[toRelease.Count];
            for (int index = 0; index < toRelease.Count; ++index)
            {
                animalActionPointArray[index] = toRelease[index];
            }
            ListPool <AnimalActionPoint> .Release(toRelease);

            return(animalActionPointArray);
        }
 public bool SetActionPointNonAgent(
     AnimalActionPoint _actionPoint,
     AnimalState _nextState,
     ActionTypes _actionType)
 {
     if (Object.op_Equality((Object)_actionPoint, (Object)null) || Object.op_Equality((Object)this.actionPoint, (Object)_actionPoint) || _nextState == AnimalState.None)
     {
         return(false);
     }
     this.ClearCurrentWaypoint();
     this.LocomotionCount = 0;
     this.NextState       = _nextState;
     if (Object.op_Inequality((Object)this.actionPoint, (Object)null))
     {
         this.actionPoint.RemoveBooking((IAnimalActionPointUser)this);
     }
     this.actionPoint = _actionPoint;
     this.actionPoint.AddBooking((IAnimalActionPointUser)this);
     this.ActionType = _actionType;
     return(true);
 }