コード例 #1
0
ファイル: AudioZone.cs プロジェクト: Towkin/Adrift
 public bool Enter(GameObject actor)
 {
     if (m_Audio != null && m_Audio.EventInstance.hasHandle())
     {
         m_Audio.SetParameter(m_Parameter, 1f);
     }
     return(true);
 }
コード例 #2
0
        public void BeginMenu()
        {
            if (m_State == GameState.Menu)
            {
                return;
            }

            m_State = GameState.Menu;

            if (m_Music != null && m_Music.EventInstance.hasHandle())
            {
                m_Music.SetParameter("Room Switch", 0f);
            }
        }
コード例 #3
0
        void Start()
        {
            if (WindLoop != null)
            {
                WindLoop.enabled = true;
            }

            DontDestroyOnLoad(gameObject);

            if (musicEvent != null)
            {
                musicEvent.SetParameter("StartGame", 1.0f);
            }
        }
コード例 #4
0
        void Update()
        {
            // check for Y kill
            if (!IsDead && transform.position.y < KillHeight)
            {
                m_Health.Kill();
            }

            HasJumpedThisFrame = false;

            bool wasGrounded = IsGrounded;

            GroundCheck();

            // landing
            if (IsGrounded && !wasGrounded)
            {
                // Fall damage
                float fallSpeed      = -Mathf.Min(CharacterVelocity.y, m_LatestImpactSpeed.y);
                float fallSpeedRatio = (fallSpeed - MinSpeedForFallDamage) /
                                       (MaxSpeedForFallDamage - MinSpeedForFallDamage);
                if (RecievesFallDamage && fallSpeedRatio > 0f)
                {
                    float dmgFromFall = Mathf.Lerp(FallDamageAtMinSpeed, FallDamageAtMaxSpeed, fallSpeedRatio);
                    damageFromFall = true;
                    m_Health.TakeDamage(dmgFromFall, null);

                    // fall damage SFX
                    FMODUnity.RuntimeManager.PlayOneShotAttached(FallDamageSfx, gameObject);
                }
                else
                {
                    // land SFX
                    FMODUnity.RuntimeManager.PlayOneShotAttached(LandSfx, gameObject);
                }
            }

            // crouching
            if (m_InputHandler.GetCrouchInputDown())
            {
                SetCrouchingState(!IsCrouching, false);
            }

            UpdateCharacterHeight(false);

            HandleCharacterMovement();

            lowHealth.SetParameter("Health", m_Health.CurrentHealth / m_Health.MaxHealth);
        }
コード例 #5
0
 /// <summary>
 /// Applies all the parameters of this trigger to the parameters of the specified event emitter.
 /// </summary>
 public override void Trigger()
 {
     foreach (KeyValuePair <string, string> paramsKvp in parameters)
     {
         float param;
         if (float.TryParse(paramsKvp.Value, out param))
         {
             targetEmitter.SetParameter(paramsKvp.Key, param);
         }
         else
         {
             Debug.Log("Unable to cast the parameter \"" + paramsKvp.Key + "\" of the trigger \"" + gameObject.name + "\" into a float. The value of the parameter is" +
                       " \"" + paramsKvp.Value + "\"");
         }
     }
     base.Trigger();
 }
コード例 #6
0
        // Update is called once per frame
        void Update()
        {
            if (GameStateMachine.Instance.CurrentState == GameState.MENU ||
                GameStateMachine.Instance.CurrentState == GameState.BADWIN ||
                GameStateMachine.Instance.CurrentState == GameState.GOODWIN)
            {
                fireSprite.SetActive(false);
            }

            if (Resources.Instance.FuelAmount > 0)
            {
                fireSprite.SetActive(true);
            }
            else
            {
                fireSprite.SetActive(false);
            }
            fireCrackling_emitter.SetParameter("fuelLevel", Resources.Instance.FuelAmount);
        }
コード例 #7
0
ファイル: HelicopterAudio.cs プロジェクト: Foldover/ggj19
        private void Update()
        {
            var velocityMagnitude = rigidbod2D.velocity.magnitude;

            helicopterSound.SetParameter("velocity", velocityMagnitude);
        }
コード例 #8
0
 /// <summary>
 /// Changes parameter values for the FMODUnity.StudioEventEmitter-object that is passed into the function.
 /// <para></para>
 /// This will only work for events that are currently playing, ie. you cannot set this before playing a OneShot. Use <see cref="FMODUnity.RuntimeManager.CreateInstance(string)"/> for that instead.
 /// </summary>
 public static void SetParameter(FMODUnity.StudioEventEmitter eventEmitter, string parameterName, float parameterValue)
 {
     eventEmitter.SetParameter(parameterName, parameterValue);
 }