private void OnUpdate()
        {
            if (Singleton <Scene> .Instance.IsNowLoadingFade)
            {
                return;
            }
            bool?nullable = this._actor != null ? new bool?(this._actor.IsInit) : new bool?();

            if ((!nullable.HasValue ? 0 : (nullable.Value ? 1 : 0)) == 0)
            {
                return;
            }
            Actor.InputInfo stateInfo = this._actor.StateInfo;
            if (this._state != null)
            {
                this._state.Update(this._actor, ref stateInfo);
            }
            this._actor.StateInfo = stateInfo;
            if (this._state != null)
            {
                this._state.AfterUpdate(this._actor, this._actor.StateInfo);
            }
            this._character.Move(Vector3.get_zero());
            PlayerActor actor = this._actor as PlayerActor;

            if (!Object.op_Inequality((Object)actor, (Object)null) || !Object.op_Inequality((Object)actor.Partner, (Object)null) || !actor.Partner.IsSlave)
            {
                return;
            }
            actor.Partner.Position = actor.Position;
            actor.Partner.Rotation = actor.Rotation;
        }
 protected override void SubFixedUpdate()
 {
     if (Object.op_Equality((Object)this._actor, (Object)null) || this._state == null)
     {
         return;
     }
     Actor.InputInfo stateInfo = this._actor.StateInfo;
     if (this._state != null)
     {
         this._state.FixedUpdate(this._actor, stateInfo);
     }
     this._actor.StateInfo = stateInfo;
 }
 private void OnDisable()
 {
     if (Object.op_Implicit((Object)this._character))
     {
         ((Behaviour)this._character).set_enabled(false);
     }
     this._actor.StateInfo.Init();
     if (!Object.op_Implicit((Object)this._cameraTransform))
     {
         return;
     }
     Actor.InputInfo stateInfo = this._actor.StateInfo;
     stateInfo.lookPos     = Vector3.op_Addition(((Component)this).get_transform().get_position(), Vector3.op_Multiply(this._cameraTransform.get_forward(), 100f));
     this._actor.StateInfo = stateInfo;
 }
Beispiel #4
0
        public void UpdateState(Actor.InputInfo state, ActorLocomotion.UpdateType updateType)
        {
            this._actor.StateInfo = state;
            this.Look(updateType);
            this.GroundCheck();
            AgentProfile      agentProfile      = Singleton <Resources> .Instance.AgentProfile;
            LocomotionProfile locomotionProfile = Singleton <Resources> .Instance.LocomotionProfile;
            PlayerActor       actor             = this._actor as PlayerActor;
            NavMeshAgent      navMeshAgent      = this._actor.NavMeshAgent;

            if (actor.PlayerController.State is Follow)
            {
                Actor.InputInfo     stateInfo  = this._actor.StateInfo;
                ref Actor.InputInfo local      = ref stateInfo;
                Vector3             vector3    = Vector3.Scale(this._actor.NavMeshAgent.get_velocity(), new Vector3(1f, 0.0f, 1f));
                Vector3             normalized = ((Vector3) ref vector3).get_normalized();
                local.move            = normalized;
                this._actor.StateInfo = stateInfo;
                if ((double)navMeshAgent.get_remainingDistance() > (double)agentProfile.RunDistance && !actor.IsRunning)
                {
                    actor.IsRunning = true;
                }
                this.AnimState.setMediumOnWalk = true;
                this.AnimState.medVelocity     = locomotionProfile.AgentSpeed.walkSpeed;
                this.AnimState.maxVelocity     = locomotionProfile.AgentSpeed.runSpeed;
                float num;
                if (actor.IsRunning)
                {
                    this.AnimState.moveDirection = Vector3.op_Multiply(this.MoveDirection, locomotionProfile.AgentSpeed.runSpeed);
                    num = locomotionProfile.AgentSpeed.followRunSpeed;
                }
                else
                {
                    this.AnimState.moveDirection = Vector3.op_Multiply(this.MoveDirection, locomotionProfile.AgentSpeed.walkSpeed);
                    num = locomotionProfile.AgentSpeed.walkSpeed;
                }
                navMeshAgent.set_speed(Mathf.Lerp(navMeshAgent.get_speed(), num, locomotionProfile.LerpSpeed));
            }
 public abstract void FixedUpdate(Actor actor, Actor.InputInfo info);
 public abstract void Update(Actor actor, ref Actor.InputInfo info);
 public abstract void AfterUpdate(Actor actor, Actor.InputInfo info);