예제 #1
0
 void SimulateFootsteps()
 {
     if (!AvatarIsInView() && (blackBoard.movementSpeed / Time.deltaTime) > 1f && blackBoard.isGrounded)
     {
         if (Time.time >= nextFootstepTime)
         {
             if ((blackBoard.movementSpeed / Time.deltaTime) > 6f)
             {
                 if (footstepRun != null)
                 {
                     footstepRun.Play(true);
                 }
                 if (clothesRustleShort != null)
                 {
                     clothesRustleShort.Play(true);
                 }
                 nextFootstepTime = Time.time + RUN_INTERVAL_SEC;
             }
             else
             {
                 if (footstepWalk != null)
                 {
                     footstepWalk.Play(true);
                 }
                 if (clothesRustleShort != null)
                 {
                     clothesRustleShort.PlayScheduled(Random.Range(0.05f, 0.1f));
                 }
                 nextFootstepTime = Time.time + WALK_INTERVAL_SEC;
             }
         }
     }
 }
예제 #2
0
    // Faking footsteps when in first-person mode, since animations won't play
    void OnWalk(float distance)
    {
        if (cameraController == null)
        {
            GameObject camObj = GameObject.Find("CameraController");
            if (camObj != null)
            {
                cameraController = camObj.GetComponent <CameraController>();
            }
            return;
        }

        if (cameraController.currentCameraState.name != "FirstPerson")
        {
            return;
        }

        if (intervalTimer < 0f)
        {
            if (distance > WALK_RUN_CROSSOVER_DISTANCE)
            {
                if (footstepRun != null)
                {
                    footstepRun.Play(true);
                }
                if (clothesRustleShort != null)
                {
                    clothesRustleShort.Play(true);
                }
                intervalTimer = RUN_INTERVAL_SEC;
            }
            else
            {
                if (footstepWalk != null)
                {
                    footstepWalk.Play(true);
                }
                if (clothesRustleShort != null)
                {
                    clothesRustleShort.PlayScheduled(Random.Range(0.05f, 0.1f));
                }
                intervalTimer = WALK_INTERVAL_SEC;
            }
        }

        intervalTimer -= Time.deltaTime;
    }
    // Faking footsteps when in first-person mode, since animations won't play
    void OnWalk(float distance)
    {
        if (CommonScriptableObjects.cameraMode.Get() != CameraMode.ModeId.FirstPerson)
        {
            return;
        }

        if (intervalTimer < 0f)
        {
            distance /= Time.deltaTime;

            if (distance > WALK_RUN_CROSSOVER_DISTANCE)
            {
                if (footstepRun != null)
                {
                    footstepRun.Play(true);
                }

                if (clothesRustleShort != null)
                {
                    clothesRustleShort.Play(true);
                }

                intervalTimer = RUN_INTERVAL_SEC;
            }
            else
            {
                if (footstepWalk != null)
                {
                    footstepWalk.Play(true);
                }

                if (clothesRustleShort != null)
                {
                    clothesRustleShort.PlayScheduled(Random.Range(0.05f, 0.1f));
                }

                intervalTimer = WALK_INTERVAL_SEC;
            }
        }

        intervalTimer -= Time.deltaTime;
    }
    void PlayVoiceReaction(string bodyShape)
    {
        float      chanceToPlay  = 0.75f;
        AudioEvent eventReaction = null;

        if (bodyShape.Contains("Female"))
        {
            eventReaction = eventReactionFemale;
        }
        else
        {
            eventReaction = eventReactionMale;
        }

        if (lastSelectedWearable != null)
        {
            if (lastSelectedWearable.rarity == Rarity.EPIC ||
                lastSelectedWearable.rarity == Rarity.LEGENDARY ||
                lastSelectedWearable.rarity == Rarity.MYTHIC ||
                lastSelectedWearable.rarity == Rarity.UNIQUE)
            {
                eventReaction.RandomizeIndex(14, 28);
                chanceToPlay = 1f;
            }
            else
            {
                eventReaction.RandomizeIndex(0, 14);
            }
        }

        if (eventReaction != null && Random.Range(0f, 1f) <= chanceToPlay)
        {
            if (!eventReaction.source.isPlaying)
            {
                eventReaction.PlayScheduled(0.6f);
            }
        }
    }
 public void PlayHappySound(float delay)
 {
     audioEventHappy.PlayScheduled(delay);
 }