Esempio n. 1
0
 public override void OnUpdate()
 {
     base.OnUpdate();
     if (this.m_AI.m_ID == AI.AIID.Spearman && FPPController.Get().m_Dodge&& this.m_CurrentAction == this.m_Attack)
     {
         this.m_AI.m_DamageModule.m_BlockDamage = true;
     }
     this.UpdateRotation();
 }
Esempio n. 2
0
 private void SetActive(bool set)
 {
     if (this.m_Active == set)
     {
         return;
     }
     this.m_Active = set;
     if (!this.m_Active)
     {
         FPPController.Get().OnDeactivateHUDItem();
     }
 }
Esempio n. 3
0
    protected override bool ShouldShow()
    {
        if (GreenHellGame.Instance.m_GameMode != GameMode.Story)
        {
            return(false);
        }
        if (ScenarioManager.Get().IsBoolVariableTrue("PlayerMechGameEnding"))
        {
            return(false);
        }
        if (ChallengesManager.Get() && ChallengesManager.Get().IsChallengeActive())
        {
            return(false);
        }
        if (ConsciousnessController.Get().IsActive())
        {
            return(false);
        }
        if (SleepController.Get().IsActive())
        {
            return(false);
        }
        if (HUDReadableItem.Get().enabled)
        {
            return(false);
        }
        if (Player.Get().m_Animator.GetBool(Player.Get().m_CleanUpHash))
        {
            return(false);
        }
        if (Time.time - SwimController.Get().m_LastDisableTime < 0.5f)
        {
            return(false);
        }
        if (Player.Get().m_IsInAir)
        {
            return(false);
        }
        if (HUDWheel.Get().enabled)
        {
            return(false);
        }
        if (FPPController.Get().m_Dodge)
        {
            return(false);
        }
        int shortNameHash = Player.Get().m_Animator.GetCurrentAnimatorStateInfo(1).shortNameHash;

        return(shortNameHash != this.m_MapWatchHideHash && shortNameHash != this.m_MapWatchIdleHash && shortNameHash != this.m_MapWatchShowHash && shortNameHash != this.m_MapZoomHash && shortNameHash != this.m_MapHideHash && shortNameHash != this.m_MapIdleHash && shortNameHash != this.m_ShowMapHash && (!DeathController.Get().IsActive() && !InsectsController.Get().IsActive() && !ScenarioManager.Get().IsDreamOrPreDream() && !Inventory3DManager.Get().IsActive() && !CutscenesManager.Get().IsCutscenePlaying() && !SwimController.Get().IsActive() && !BodyInspectionController.Get().IsActive() && !HarvestingAnimalController.Get().IsActive() && !HarvestingSmallAnimalController.Get().IsActive() && !VomitingController.Get().IsActive() && !MapController.Get().IsActive() && !NotepadController.Get().IsActive() && !MudMixerController.Get().IsActive()) && !MakeFireController.Get().IsActive());
    }
Esempio n. 4
0
 protected override void OnDisable()
 {
     base.OnDisable();
     this.m_Animator.CrossFade(this.m_Idle, 0.2f, 0);
     this.m_Animator.CrossFade(this.m_UnarmedIdle, 0.2f, 1);
     if (this.m_Trigger && Player.Get())
     {
         Collider[] componentsInChildren = this.m_Trigger.GetComponentsInChildren <Collider>();
         for (int i = 0; i < componentsInChildren.Length; i++)
         {
             Physics.IgnoreCollision(componentsInChildren[i], Player.Get().m_Collider, false);
         }
     }
     if (this.m_State == AnimationTriggerController.State.Animation && this.m_Trigger)
     {
         ScenarioManager.Get().SetBoolVariable(this.m_Trigger.m_ScenarioBoolVariable, true);
     }
     LookController.Get().m_LookDev.y = 0f;
     LookController.Get().m_WantedLookDev.y = 0f;
     base.ResetBodyRotationBonesParams();
     FPPController.Get().ResetBodyRotationBonesParams();
 }
Esempio n. 5
0
    protected override void OnDisable()
    {
        base.OnDisable();
        LookController.Get().m_WantedLookDev.y = 0f;
        this.m_Player.m_AudioModule.StopHarvestAnimalSound();
        if (this.m_Animator.isInitialized)
        {
            this.m_Animator.SetBool(this.m_MudMixerHash, false);
        }
        Collider collider = Player.Get().m_Collider;

        Physics.IgnoreCollision(collider, this.m_Mixer.m_BoxCollider, false);
        foreach (Collider collider2 in this.m_Mixer.gameObject.GetComponentsInChildren <Collider>())
        {
            Physics.IgnoreCollision(collider, collider2, false);
        }
        this.m_Mixer.OnFinishMixing();
        LookController.Get().m_LookDev.y = 0f;
        LookController.Get().m_WantedLookDev.y = 0f;
        base.ResetBodyRotationBonesParams();
        FPPController.Get().ResetBodyRotationBonesParams();
    }
Esempio n. 6
0
    private void UpdateEnterState()
    {
        Vector3 vector = this.m_Trigger.m_TransformObject.transform.position - base.transform.position;
        Vector3 a      = vector.normalized * this.m_Speed;
        float   f      = Vector3.Angle(Player.Get().transform.forward.GetNormalized2D(), this.m_Trigger.m_TransformObject.transform.forward.GetNormalized2D());
        Vector3 motion = a * Time.deltaTime;

        if (vector.To2D().magnitude > motion.magnitude || Mathf.Abs(f) > 1f)
        {
            if (vector.To2D().magnitude > motion.magnitude)
            {
                this.m_CharacterController.Move(motion, true);
            }
            else
            {
                this.m_CharacterController.Move(vector, true);
            }
            LookController.Get().UpdateWantedLookDir();
            FPPController.Get().UpdateBodyRotation();
            return;
        }
        this.m_CharacterController.Move(vector, true);
        this.SetState(AnimationTriggerController.State.Animation);
    }
Esempio n. 7
0
    public void PlayFootstepSound()
    {
        if ((Player.Get().GetFPPController().m_LastCollisionFlags & CollisionFlags.Below) == CollisionFlags.None)
        {
            return;
        }
        Vector3 wantedSpeed = this.m_FPPController.m_WantedSpeed;

        wantedSpeed.y = 0f;
        if (wantedSpeed.magnitude < 0.1f)
        {
            return;
        }
        if (Time.time - this.m_LastFootstepSound < 0.1f)
        {
            return;
        }
        List <AudioClip> list            = null;
        bool             flag            = Player.Get().GetFPPController().IsRunning();
        EObjectMaterial  eobjectMaterial = EObjectMaterial.Unknown;

        if (this.m_Player.IsInWater() && !this.m_Player.m_SwimController.IsActive())
        {
            list = ((!flag) ? this.m_ShallowWaterWalkSounds : this.m_ShallowWaterRunSounds);
        }
        else
        {
            eobjectMaterial = Player.Get().GetMaterial();
            switch (eobjectMaterial)
            {
            case EObjectMaterial.Unknown:
            case EObjectMaterial.Sand:
                list = ((!flag) ? this.m_SandStepWalkSounds : this.m_SandStepRunSounds);
                break;

            case EObjectMaterial.Bush:
            case EObjectMaterial.Grass:
                list = ((!flag) ? this.m_GrassStepWalkSounds : this.m_GrassStepRunSounds);
                break;

            case EObjectMaterial.Stone:
                list = ((!flag) ? this.m_StoneStepWalkSounds : this.m_StoneStepRunSounds);
                break;

            case EObjectMaterial.DryLeaves:
                list = ((!flag) ? this.m_DryLeavesStepWalkSounds : this.m_DryLeavesStepRunSounds);
                break;

            case EObjectMaterial.Mud:
                list = ((!flag) ? this.m_MudStepWalkSounds : this.m_MudStepRunSounds);
                break;

            case EObjectMaterial.Soil:
                list = ((!flag) ? this.m_SoilStepWalkSounds : this.m_SoilStepRunSounds);
                break;
            }
        }
        Noise.Type noise_type = Noise.Type.None;
        if (FPPController.Get().IsWalking())
        {
            noise_type = ((!FPPController.Get().IsDuck()) ? Noise.Type.Walk : Noise.Type.Sneak);
        }
        else if (flag)
        {
            noise_type = ((!FPPController.Get().IsDuck()) ? Noise.Type.Run : Noise.Type.Sneak);
        }
        else if (SwimController.Get().IsSwimming())
        {
            noise_type = Noise.Type.Swim;
        }
        if (list == null)
        {
            Debug.Log("ERROR PlayerAudioModule PlayFootstepSound no sounds clips player_pos=" + Player.Get().transform.position.ToString() + " Material = " + eobjectMaterial.ToString());
        }
        this.PlayRandomSound(list, 1f, false, noise_type);
        this.m_LastFootstepSound = Time.time;
    }
    private void UpdateState()
    {
        switch (this.m_Animator.GetInteger(this.m_StateHash))
        {
        case 1:
            if (FPPController.Get().IsWalking())
            {
                this.SetState(FishingController.State.Walk);
                return;
            }
            if (FPPController.Get().IsRunning())
            {
                this.SetState(FishingController.State.Run);
                return;
            }
            break;

        case 2:
            if (FPPController.Get().IsRunning())
            {
                this.SetState(FishingController.State.Run);
                return;
            }
            if (!FPPController.Get().IsWalking())
            {
                this.SetState(FishingController.State.Idle);
                return;
            }
            break;

        case 3:
            if (FPPController.Get().IsWalking())
            {
                this.SetState(FishingController.State.Walk);
                return;
            }
            if (!FPPController.Get().IsRunning())
            {
                this.SetState(FishingController.State.Idle);
                return;
            }
            break;

        case 4:
            if (this.IsAnimFinish(this.m_FishingJumpHash))
            {
                this.SetState(FishingController.State.Idle);
                return;
            }
            break;

        case 5:
            this.UpdateAim();
            return;

        case 6:
        case 8:
        case 9:
        case 10:
        case 12:
            break;

        case 7:
        {
            Vector3 normalized2D = (this.m_FishingRod.m_Float.transform.position - base.transform.position).GetNormalized2D();
            if (Vector3.Dot(base.transform.forward.GetNormalized2D(), normalized2D) < 0.2f)
            {
                this.Cancel();
                return;
            }
            break;
        }

        case 11:
            if (this.IsAnimFinish(this.m_FishingFailHash))
            {
                this.SetState(FishingController.State.Idle);
            }
            break;

        default:
            return;
        }
    }