コード例 #1
0
    void PlayerAiming()
    {
        if (!jumpCharging.IsPlaying())
        {
            chargeSnapshot.Play();
        }
        currentlyAiming = true;

        //Setting the aim art
        float aimRotation = -(Mathf.Atan2(input.playerAim.x, input.playerAim.y) * 180 / Mathf.PI);

        aim.eulerAngles = new Vector3(0, 0, aimRotation);

        //Building Jump Force
        jumpingForce += jumpingForceTimer;


        //Setting UI canon aim slider
        canonAimSlider.value = jumpingForce;

        //Setting bullet time

        Time.timeScale      = timeSlowdown;
        Time.fixedDeltaTime = .02f * Time.timeScale;



        //FMOD Charge
        if (!jumpCharging.IsPlaying())
        {
            jumpCharging.Play();
        }

        jumpCharging.SetParameter("ChargeUp", (jumpingForce - jumpingForceMinMax.x / (jumpingForceMinMax.y - jumpingForceMinMax.x)));
    }
コード例 #2
0
 void PlayAudio()
 {
     if (!SE.IsPlaying())
     {
         SE.Play();
     }
 }
コード例 #3
0
 public void PlayerMove()
 {
     if (!playerMove.IsPlaying())
     {
         playerMove.Play();
     }
 }
コード例 #4
0
    private void CheckStatus()
    {
        if (rig.velocity.magnitude > 0f && !frictionSound.IsPlaying())
        {
            frictionSound.Play();
        }

        if (rig.velocity.magnitude <= 0f && frictionSound.IsPlaying())
        {
            frictionSound.Stop();
        }
    }
コード例 #5
0
    public int checkNoteInput()
    {
        if (Input.GetKeyDown(firstNoteInput))
        {
            if (player.GetBool("viool") == false && grabAlto.IsPlaying() == false)
            {
                grabAlto.Play();
            }
            player.SetBool("viool", true);

            alto.enabled = false;
            return(0);
        }

        if (Input.GetKeyDown(secondNoteInput))
        {
            if (player.GetBool("viool") == false && grabAlto.IsPlaying() == false)
            {
                grabAlto.Play();
            }
            player.SetBool("viool", true);

            alto.enabled = false;
            return(1);
        }

        if (Input.GetKeyDown(thirdNoteInput))
        {
            if (player.GetBool("viool") == false && grabAlto.IsPlaying() == false)
            {
                grabAlto.Play();
            }
            player.SetBool("viool", true);

            alto.enabled = false;
            return(2);
        }

        if (Input.GetKeyDown(fourthNoteInput))
        {
            if (player.GetBool("viool") == false && grabAlto.IsPlaying() == false)
            {
                grabAlto.Play();
            }
            player.SetBool("viool", true);

            alto.enabled = false;
            return(3);
        }

        return(-1);
    }
コード例 #6
0
        private void Update()
        {
            usedThisFrame = false;

            if (!isDrawn)
            {
                return;
            }

            if (AvatarInputHandler.main.IsEnabled() && Player.main.GetRightHandHeld() && !Player.main.IsSpikyTrapAttached())
            {
                usedThisFrame = true;
            }

            if (!usedThisFrame)
            {
                firedOneShot = false;
            }

            fireSource.enabled = usedThisFrame;

            if (usedThisFrame && activeCuttingTarget && !sfx_laserLoop.IsPlaying())
            {
                sfx_laserLoop.Play();
            }

            else if (usedThisFrame && !firedOneShot && !sfx_laserLoop.IsPlaying())
            {
                sfx_oneShot.Play();
                firedOneShot = true;
            }

            else if (!usedThisFrame && fxIsPlaying)
            {
                StopLaserCuttingFX();
            }

            else if (!usedThisFrame)
            {
                sfx_laserLoop.Stop();
            }

            if (fxIsPlaying)
            {
                fxLight.intensity = Mathf.MoveTowards(fxLight.intensity, lightIntensity, Time.deltaTime * 25f);
            }

            UpdateTarget();
        }
コード例 #7
0
    public void Interact()
    {
        ItemDependencies id = gameObject.GetComponent <ItemDependencies>();

        if (id)
        {
            if (id.CheckDependency(Inventory.instance))
            {
                sceneSwitcher.ActivateSceneSwitch(targetSceneBuildIndex);
                enterSound.Play();
                Debug.Log("ENTER SOUND");
            }
            else
            {
                if (denialVoiceLineAlternatives.Length > 0 && !denialVoiceLine.IsPlaying())
                {
                    int i = Random.Range(0, denialVoiceLineAlternatives.Length);

                    denialVoiceLine.Play();
                    denialVoiceLine.SetParameter("Voice Line", denialVoiceLineAlternatives[i]);
                }
            }
        }

        else
        {
            enterSound.Play();
            Debug.Log("ENTER SOUND");
            sceneSwitcher.ActivateSceneSwitch(targetSceneBuildIndex);
        }
    }
コード例 #8
0
 public static void StopEvent(StudioEventEmitter audioEventEmitter)
 {
     if (audioEventEmitter.IsPlaying())
     {
         audioEventEmitter.Stop();
     }
 }
コード例 #9
0
 /// <summary>
 /// Play this emitter if it isn't already playing (avoid multiple instances triggering in eg. Update()).
 /// </summary>
 /// <param name="eventEmitter"></param>
 public static void PlayIfNotPlaying(this StudioEventEmitter eventEmitter)
 {
     if (!eventEmitter.IsPlaying())
     {
         eventEmitter.Play();
     }
 }
コード例 #10
0
 void OnClickFTUE(OnTapStepFTUE pEvent)
 {
     if (!_clickEmitter.IsPlaying())
     {
         _clickEmitter.Play();
     }
 }
コード例 #11
0
 public void Play()
 {
     if (!sound.IsPlaying())
     {
         sound.Play();
     }
 }
コード例 #12
0
 public void PlayMenuMusic()
 {
     if (gameBgm.IsPlaying())
     {
         gameBgm.Stop();
         menuBgm.Play();
     }
 }
コード例 #13
0
 public void PlayGameMusic()
 {
     if (menuBgm.IsPlaying())
     {
         menuBgm.Stop();
         gameBgm.Play();
     }
 }
コード例 #14
0
 public void Interact()
 {
     if (!see.IsPlaying())
     {
         see.Play();
         see.SetParameter("Voice Line", voiceLine);
     }
 }
コード例 #15
0
 /// <summary>
 /// Updates the master volume values and stores it.
 /// </summary>
 public void UpdateMasterVolume(float value)
 {
     masterBus.setVolume(value);
     if (!masterEmitter.IsPlaying() && Time.timeSinceLevelLoad > 3f)
     {
         masterEmitter.Play();
     }
     GameMaster.Instance.MasterSaveData.audioMasterVolume = value;
     GameMaster.Instance.SaveGame();
 }
コード例 #16
0
 public void OnCollisionEnter(Collision col)
 {
     if (col.relativeVelocity.magnitude > 8)
     {
         if (!emitterSource.IsPlaying())
         {
             emitterSource.Play();
         }
     }
 }
コード例 #17
0
 void Update()
 {
     if (hasParameter)
     {
         if (emitter.IsPlaying())
         {
             parameter.setValue(ExtensionsManager.GetOcclusionAmout(transform.position));
         }
     }
 }
コード例 #18
0
        public void OnJump(InputAction.CallbackContext context)
        {
            if (context.performed && IsGrounded)
            {
                if (!jumpEmitter.IsPlaying())
                {
                    jumpEmitter.Play();
                }

                rb.AddForce(Vector3.up * 2, ForceMode.Impulse);
            }
        }
コード例 #19
0
        public static void ToggleEmitter(EmitterType emitterType)
        {
            StudioEventEmitter emitter = AudioManager.Instance.EventPaths.GetEmitter(emitterType);

            if (emitter.IsPlaying())
            {
                emitter.Stop();
                return;
            }

            emitter.Play();
        }
コード例 #20
0
    private void Update()
    {
        if (GameManager.Instance.IsOnDialogue())
        {
            return;
        }

        if (Input.GetKeyDown(KeyCode.Escape))
        {
            if (stopped)
            {
                panel.SetActive(false);
                pausePanel.SetActive(true);
                optionsPanel.SetActive(false);
                stopped = false;
                if (!soundEmitter.IsPlaying())
                {
                    soundEmitter.Play();
                }
                soundEmitter.EventInstance.setParameterByName("TimeON", 1);
                tm.Resume();
                TimeEvent.Stop();
                playerThrow.StopCasting();
            }
            else
            {
                playerThrow.StopCasting();
                panel.SetActive(true);
                stopped = true;
                if (!soundEmitter.IsPlaying())
                {
                    soundEmitter.Play();
                }
                soundEmitter.EventInstance.setParameterByName("TimeON", 0);
                tm.Pause();
                TimeEvent.Play();
            }
        }
    }
コード例 #21
0
    void LateUpdate()
    {
        if (lastPosition == transform.position)
        {
            spiderStepEvent.Stop();
        }
        else if (!spiderStepEvent.IsPlaying())
        {
            spiderStepEvent.Play();
        }

        lastPosition = transform.position;
    }
コード例 #22
0
    /// <summary>
    /// Triggers the chasing sounds
    /// </summary>
    public void CueMonsterChase()
    {
        BackgroundMusic.Stop();

        chasingMonster++;
        if (!MonsterChaseMusic.IsPlaying())
        {
            MonsterChaseMusic.Play();
        }
        if (!SeenByMonster.IsPlaying())
        {
            SeenByMonster.Play();
        }
    }
コード例 #23
0
 private void Update()
 {
     if (velocity.x != 0 || velocity.y != 0)
     {
         if (!soundEvent.IsPlaying())
         {
             soundEvent.Play();
         }
     }
     else
     {
         soundEvent.Stop();
     }
 }
コード例 #24
0
ファイル: OnCameraSwitch.cs プロジェクト: TheDimin/GGJ2020
    void Awake()
    {
        cam     = GetComponent <CinemachineVirtualCamera>();
        emitter = transform.parent.gameObject.GetComponent <StudioEventEmitter>();
        if (emitter == null)
        {
            emitter = transform.parent.gameObject.AddComponent <StudioEventEmitter>();
        }
        emitter.Event = FModStrings.Music;

        if (!emitter.IsPlaying())
        {
            emitter.Play();
        }
    }
コード例 #25
0
    // Update is called once per frame
    void Update()
    {
        platformTrans = transform.parent;

        if (platformTrans.hasChanged)
        {
            Debug.Log("Transform changed");
            platformTrans.hasChanged = false;
        }

        if (platformTrans.hasChanged == false && !target.IsPlaying())
        {
            Debug.Log("playing sound");
            target.Play();
        }
    }
コード例 #26
0
    public void GameOver()
    {
        gameOver = true;

        Time.timeScale = 1;

        gameOverUI.SetActive(true);

        player.SetActive(false);

        if (!deadSound.IsPlaying())
        {
            deadSound.Play();
        }

        Cursor.lockState = CursorLockMode.None;
        Cursor.visible   = true;
    }
コード例 #27
0
    void Awake()
    {
        if (cameraText == null)
        {
            Debug.LogError("Missing reference to camera text UI");
        }

        cam     = GetComponent <CinemachineVirtualCamera>();
        emitter = transform.parent.gameObject.GetComponent <StudioEventEmitter>();
        if (emitter == null)
        {
            emitter = transform.parent.gameObject.AddComponent <StudioEventEmitter>();
        }
        emitter.Event = FModStrings.Music;

        if (!emitter.IsPlaying())
        {
            emitter.Play();
        }
    }
コード例 #28
0
 public void Interact()
 {
     if (fireplace.HasLitten)
     {
         Camera.main.gameObject.GetComponent <CameraController>().CutsceneLock = true;
         player.GetComponent <CharacterMovement>().CutsceneLock = true;
         GameObject temp = Instantiate(cutsceneToTrigger);
         player.transform.parent = temp.transform;
         temp.SetActive(true);
     }
     else
     {
         if (!see.IsPlaying())
         {
             //cant sleep its too cold voicelines
             int id = Random.Range(0, voiceLineIds.Count);
             see.Play();
             see.SetParameter("Voice Line", voiceLineIds[id]);
         }
     }
 }
コード例 #29
0
ファイル: SoundManager.cs プロジェクト: Soviby/CommFrame
    public static void _playSoundDo(string eventName, GameObject voicer = null)
    {
        StudioEventEmitter studioEvent = null;

        if (!voicer)
        {
            var eventNameGo = eventName.Replace('/', '_');
            studioEvent = _root.FindChild <StudioEventEmitter>(eventNameGo, false);
            if (!studioEvent)
            {
                var go = new GameObject(eventNameGo);
                go.name = eventNameGo;
                go.transform.SetParent(_root.transform);
                go.transform.localPosition = Vector3.zero;
                studioEvent = go.GetMissComponent <StudioEventEmitter>();
                studioEvent.OverrideAttenuation = true;
                studioEvent.OverrideMaxDistance = int.MaxValue;
                studioEvent.OverrideMinDistance = int.MaxValue;
                studioEvent.SetVolume(Volume_Music);
            }
        }
        else
        {
            studioEvent = voicer.GetMissComponent <StudioEventEmitter>();
            if (studioEvent.IsPlaying())
            {
                studioEvent.Stop();
            }
            studioEvent.OverrideAttenuation = true;
            studioEvent.OverrideMaxDistance = 20;
            studioEvent.OverrideMinDistance = 3;
            studioEvent.SetVolume(Volume_Music);
            if (!_3dstudioEventList.Contains(studioEvent))
            {
                _3dstudioEventList.Add(studioEvent);
            }
        }
        studioEvent.Event = eventName;
        studioEvent.Play();
    }
コード例 #30
0
        void Update()
        {
            if (Input.GetKeyDown(KeyCode.Space))
            {
                records.Clear();
                emiter.Play();
                int len;
                emiter.EventDescription.getLength(out len);
                audioLen = len / 1000.0f;
                Debug.Log(len);
                FMOD.SPEAKERMODE mode;
                int raw;
                RuntimeManager.CoreSystem.getSoftwareFormat(out rate, out mode, out raw);
                records.Clear();
            }
            if (emiter.IsPlaying())
            {
                recognizeResult = runtimeRecognizer.RecognizeByAudioSource(m_FFTDsp, rate);
                RecordingFmod(recognizeResult);
                UpdateForward();
            }
            else if (records.Count > 0)
            {
                if (save)
                {
                    OutputRecd();
                }
                records.Clear();

#if UNITY_EDITOR
                if (save)
                {
                    AssetDatabase.Refresh();
                    Debug.Log("output recd finish");
                }
#endif
            }
        }