Beispiel #1
0
        public virtual TaskStatus OnUpdate()
        {
            NavMeshAgent navMeshAgent = this.Agent.NavMeshAgent;

            if (navMeshAgent.get_isOnOffMeshLink())
            {
                OffMeshLinkData currentOffMeshLinkData = navMeshAgent.get_currentOffMeshLinkData();
                if (Object.op_Inequality((Object)((OffMeshLinkData) ref currentOffMeshLinkData).get_offMeshLink(), (Object)null))
                {
                    return((TaskStatus)2);
                }
            }
            return((TaskStatus)1);
        }
        public virtual TaskStatus OnUpdate()
        {
            NavMeshAgent navMeshAgent = this._merchant.NavMeshAgent;
            M0           m0;

            if (navMeshAgent == null)
            {
                m0 = (M0)null;
            }
            else
            {
                OffMeshLinkData currentOffMeshLinkData = navMeshAgent.get_currentOffMeshLinkData();
                m0 = ((Component)((OffMeshLinkData) ref currentOffMeshLinkData).get_offMeshLink())?.GetComponent <ActionPoint>();
            }
            this._bookingPoint = (ActionPoint)m0;
            if (Object.op_Equality((Object)this._bookingPoint, (Object)null))
            {
                return((TaskStatus)1);
            }
            this._bookingPoint.AddBooking((Actor)this._merchant);
            this._merchant.BookingActionPoint = this._bookingPoint;
            return((TaskStatus)2);
        }
Beispiel #3
0
        protected override void OnUpdate(PlayerActor player, ref Actor.InputInfo info)
        {
            AgentActor agentPartner = player.AgentPartner;

            if (Object.op_Equality((Object)agentPartner, (Object)null))
            {
                return;
            }
            AgentProfile      agentProfile      = Singleton <Resources> .Instance.AgentProfile;
            LocomotionProfile locomotionProfile = Singleton <Resources> .Instance.LocomotionProfile;
            NavMeshAgent      navMeshAgent1     = player.NavMeshAgent;

            if (navMeshAgent1.get_isOnOffMeshLink())
            {
                this.Stop(player);
                OffMeshLinkData currentOffMeshLinkData1 = navMeshAgent1.get_currentOffMeshLinkData();
                if (!Object.op_Inequality((Object)((OffMeshLinkData) ref currentOffMeshLinkData1).get_offMeshLink(), (Object)null))
                {
                    return;
                }
                NavMeshAgent navMeshAgent2 = player.NavMeshAgent;
                M0           m0;
                if (navMeshAgent2 == null)
                {
                    m0 = (M0)null;
                }
                else
                {
                    OffMeshLinkData currentOffMeshLinkData2 = navMeshAgent2.get_currentOffMeshLinkData();
                    m0 = ((Component)((OffMeshLinkData) ref currentOffMeshLinkData2).get_offMeshLink())?.GetComponent <ActionPoint>();
                }
                ActionPoint point = (ActionPoint)m0;
                if (!Object.op_Inequality((Object)point, (Object)null) || !point.OffMeshAvailablePoint((Actor)player))
                {
                    return;
                }
                if (point is DoorPoint)
                {
                    player.CurrentPoint = point;
                    player.PlayerController.ChangeState("DoorOpen", point, (Action)null);
                }
                else
                {
                    player.CurrentPoint = point;
                    player.PlayerController.ChangeState("Move", point, (Action)null);
                }
            }
            else
            {
                Vector3 destination = this.DesiredPosition((Actor)agentPartner);
                if ((double)Vector3.Distance(destination, player.Position) >= (double)agentProfile.RestDistance)
                {
                    this.SetDestination(player, destination);
                    this._moved = true;
                }
                else
                {
                    NavMeshPathStatus pathStatus = navMeshAgent1.get_pathStatus();
                    if (pathStatus == 1 || pathStatus == 2)
                    {
                        if ((double)Vector3.Distance(player.Position, agentPartner.Position) >= (double)agentProfile.RestDistance)
                        {
                            return;
                        }
                        this.Stop(player);
                        if (!player.IsRunning)
                        {
                            return;
                        }
                        player.IsRunning = false;
                    }
                    else
                    {
                        if (navMeshAgent1.get_pathPending())
                        {
                            return;
                        }
                        if ((double)navMeshAgent1.get_remainingDistance() < (double)agentProfile.RestDistance && player.IsRunning)
                        {
                            player.IsRunning = false;
                        }
                        if (!this._moved || (double)navMeshAgent1.get_remainingDistance() >= (double)navMeshAgent1.get_stoppingDistance())
                        {
                            return;
                        }
                        this.Stop(player);
                        this._moved = false;
                    }
                }
            }
        }