示例#1
0
 public void ChangeSound(StudioEventEmitter emit)
 {
     if (current != emit)
     {
         if (current != null)
         {
             current.Stop();
         }
         current = emit;
         current.Play();
     }
 }
示例#2
0
    // Update is called once per frame
    private void Update()
    {
        if (CurrentSeason != 3)
        {
            if (GrassColorNormal != GrassMaterial.color || LeavesColorNormal != LeavesMaterial.color)
            {
                float seasonBegin = (Time.time - _gameStart) / SeasonDuration;
                seasonBegin = Mathf.Min(1f, (seasonBegin - (int)seasonBegin) * 5f);
                if (GrassColorNormal != GrassMaterial.color)
                {
                    GrassMaterial.color = Color.Lerp(GrassColorWinter, GrassColorNormal, seasonBegin);
                }
                if (LeavesColorNormal != LeavesMaterial.color)
                {
                    LeavesMaterial.color = Color.Lerp(LeavesColorWinter, LeavesColorNormal, seasonBegin);
                }
            }
        }
        else
        {
            if (GrassColorWinter != GrassMaterial.color || LeavesColorWinter != LeavesMaterial.color)
            {
                float seasonBegin = (Time.time - _gameStart) / SeasonDuration;
                seasonBegin = Mathf.Min(1f, (seasonBegin - (int)seasonBegin) * 5f);
                if (GrassColorWinter != GrassMaterial.color)
                {
                    GrassMaterial.color = Color.Lerp(GrassColorNormal, GrassColorWinter, seasonBegin);
                }
                if (LeavesColorWinter != LeavesMaterial.color)
                {
                    LeavesMaterial.color = Color.Lerp(LeavesColorNormal, LeavesColorWinter, seasonBegin);
                }
            }
        }
        StudioEventEmitter fmodEmitter = GameObject.Find("Main Camera").GetComponent <StudioEventEmitter>();
        // Winter
        float param = (Time.time - _gameStart) / (SeasonDuration * 4f);

        param = param - (int)param;
        fmodEmitter.EventInstance.setParameterValue("Winter", _toWinterParameter(param));
        // Selector
        param = (Time.realtimeSinceStartup - _gameStart) / 50f;
        param = param - (int)param;
        if (param < 0.25f)
        {
            param = 0.5f - param;
        }
        else if (param > 0.75f)
        {
            param = 1.5f - param;
        }
        fmodEmitter.EventInstance.setParameterValue("Selector", param);
    }
示例#3
0
        public static void ToggleEmitter(EmitterType emitterType)
        {
            StudioEventEmitter emitter = AudioManager.Instance.EventPaths.GetEmitter(emitterType);

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

            emitter.Play();
        }
示例#4
0
        private void Awake()
        {
            if (emitter == null)
            {
                emitter = GetComponent <StudioEventEmitter>();
            }

            if (emitter == null)
            {
                Debug.LogError("No StudioEventEmitter found");
            }
        }
示例#5
0
    private void Awake()
    {
        eventEmitter = GetComponent <StudioEventEmitter>();

        Signals.Get(out playerEnergyLevelChangedSignal);
        Signals.Get(out victorySignal);
        Signals.Get(out gameSceneSignal);
        Signals.Get(out menuSceneSignal);

        playerEnergyLevelChangedSignal.AddListener(OnEnergyLevelChanged);
        victorySignal.AddListener(OnVictory);
        gameSceneSignal.AddListener(OnSceneReload);
        menuSceneSignal.AddListener(OnSceneReload);
    }
示例#6
0
    private void RegisterStudioEventEmitter(StudioEventEmitter[] studioEventEmitter)
    {
        m_PlayerOneStudioEventEmitter = studioEventEmitter[0];
        m_PlayerOneStudioEventEmitter.OverrideAttenuation = true;
        m_PlayerOneStudioEventEmitter.OverrideMaxDistance = 100.0f;

        m_PlayerTwoStudioEventEmitter = studioEventEmitter[1];
        m_PlayerTwoStudioEventEmitter.OverrideAttenuation = true;
        m_PlayerTwoStudioEventEmitter.OverrideMaxDistance = 100.0f;

        m_TriggerStudioEventEmitter = studioEventEmitter[2];
        m_TriggerStudioEventEmitter.OverrideAttenuation = true;
        m_TriggerStudioEventEmitter.OverrideMaxDistance = 100.0f;
    }
示例#7
0
    void InstanciateSound(string eventName, float delay, float volume, bool loop, Vector3 pos, Vector3 endPos, float tweenDuration = 2)
    {
        GameObject newGO = new GameObject(eventName + "Emitter")  as GameObject;//Instantiate(prefabEmitter, pos, Quaternion.identity) as GameObject;

        newGO.transform.position = pos;
        StudioEventEmitter newEmitter = newGO.AddComponent <StudioEventEmitter>() as StudioEventEmitter;

        if (endPos != Vector3.zero)
        {
            newGO.transform.DOMove(endPos, tweenDuration);
        }
        newEmitter.Event = eventName;
        newEmitter.Play();
    }
 void PlayTown(StudioEventEmitter emitter, bool isInTown)
 {
     if (isInTown)
     {
         _inTown   = true;
         _inForest = false;
         PlayOnTown(null);
     }
     else
     {
         _inTown = false;
         emitter.Stop();
     }
 }
示例#9
0
文件: Ranking.cs 项目: SashaYak/GGJ19
    void Start()
    {
        _texts = Texts.GetComponentsInChildren <TextMeshProUGUI>();

        emitter = GetComponent <StudioEventEmitter>();
        //  PlayerPrefs.SetInt("Score", ScoreTest);
        scoreNumberText.text = PlayerPrefs.GetInt("Score").ToString();

        rank = Mathf.Clamp((PlayerPrefs.GetInt("Score") / 100), 0, 9);

        StartCoroutine(goRanking(timerForAnimation));

        UnityEngine.Debug.Log(rank);
    }
示例#10
0
    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();
        }
    }
示例#11
0
        void Start()
        {
            if (emitter == null)
            {
                emitter = GetComponent <StudioEventEmitter>();
            }

            RESULT result = RESULT.OK;

            result = emitter.EventInstance.getParameter(occlusionParameter, out parameter);
            if (result == RESULT.OK)
            {
                hasParameter = true;
            }
        }
示例#12
0
    protected void Awake()
    {
        var angles = transform.eulerAngles;

        x = angles.y;
        z = angles.x;

        _fmodEmitter  = GetComponent <StudioEventEmitter>();
        _fmodListener = GetComponent <StudioListener>();
        _transform    = transform;
        if (_transform.GetComponentInChildren <Animator>() != null)
        {
            _animator = _transform.GetComponentInChildren <Animator>();
        }
    }
示例#13
0
    public void Init(MonoGameManager manager)
    {
        _gameManager = manager;
        Instance     = this;

        _finalSound       = gameObject.AddComponent <StudioEventEmitter>();
        _finalSound.Event = "event:/vr_boot";

        itemRegistry = new ItemRegistry();
        foreach (var item in allItemConfig.items)
        {
            itemRegistry.Add(item);
        }

        AllItems.Init(itemRegistry);
    }
示例#14
0
    // Start is called before the first frame update
    void Start()
    {
        playerInput    = this.GetComponent <PlayerInput>();
        playerEffects  = this.GetComponent <PlayerEffects>();
        _throw         = this.GetComponent <Throw>();
        potionVariants = GameController.Instance.potionVariants;
        soundscape     = null;
        GameObject go = GameObject.Find("trilha");

        paramValue         = 1.0f;
        playedFullBarSound = false;
        if (go != null)
        {
            soundscape = go.GetComponent <StudioEventEmitter>();
        }
    }
示例#15
0
        protected override void Start()
        {
            if (!AudioManager.IsInitialized)
            {
                return;
            }

            wind       = AudioPlayer.GetEventInstance(EventType.SFX_DISASTER_WindBlowing);
            rain       = AudioPlayer.GetEventInstance(EventType.SFX_DISASTER_HeavyRain);
            rainWind   = AudioPlayer.GetEventInstance(EventType.SFX_DISASTER_RainAndWind);
            earthQuake = AudioPlayer.GetEventInstance(EventType.SFX_DISASTER_Earthquake);

            backgroundEmitter = AudioManager.Instance.EventPaths.GetEmitter(EmitterType.BackgroundMusic);

            base.Start();
        }
示例#16
0
    private void Awake()
    {
        if (_instance != null && _instance != this)
        {
            Destroy(this.gameObject);
        }
        else
        {
            _instance = this;
        }
        DontDestroyOnLoad(gameObject);

        emitter     = GetComponent <StudioEventEmitter>();
        audioSource = GetComponent <AudioSource>();
        InitPlayer();
    }
示例#17
0
        #pragma warning restore 0649

        #region Setup and Navigation.

        // Animates in the canvas and sets up the values.
        private void Awake()
        {
            eventEmitter                  = GetComponentInChildren <StudioEventEmitter>();
            canvasGroup                   = GetComponent <CanvasGroup>();
            canvasGroup.alpha             = 0f;
            GameMaster.Instance.GameState = ExecutionState.PopupPause;
            store          = FindObjectOfType <StoreController>();
            waitFrame      = new WaitForEndOfFrame();
            waitForItem    = new WaitForSeconds(itemInAnimationDuration);
            waitForStats   = new WaitForSeconds(statsAnimationDuration);
            waitForLetters = new WaitForSeconds(statsAnimationDuration * 0.1f);
            DOTween.To(() => canvasGroup.alpha, x => canvasGroup.alpha = x, 1f, popInAnimationDuration).onComplete =
                () => {
                StartCoroutine(nameof(FillItemSlots));
            };
        }
示例#18
0
        #pragma warning restore 0649

        #region Setup and Navigation.

        // Animates in the canvas and sets up the values.
        private void Awake()
        {
            eventEmitter                  = GetComponentInChildren <StudioEventEmitter>();
            canvasGroup                   = GetComponent <CanvasGroup>();
            canvasGroup.alpha             = 0f;
            GameMaster.Instance.GameState = ExecutionState.PopupPause;
            upgradeSettings               = Resources.Load <PlayerUpgradeSettings>(upgradeSettingsPath);
            waitFrame      = new WaitForEndOfFrame();
            waitForItem    = new WaitForSeconds(itemInAnimationDuration);
            waitForStats   = new WaitForSeconds(statsAnimationDuration);
            waitForLetters = new WaitForSeconds(statsAnimationDuration * 0.1f);
            DOTween.To(() => canvasGroup.alpha, x => canvasGroup.alpha = x, 1f, popinAnimationDuration).onComplete =
                () => {
                StartCoroutine(nameof(FillItemSlots));
            };
        }
示例#19
0
    private void Awake()
    {
        if (PlayerPrefs.GetInt("FmodOn") > 0)
        {
            fmodOn = true;
        }

        _emitter = GetComponent <StudioEventEmitter>();
        if (fmodOn)
        {
            _emitter.SetParameter("speed", 0f);
            string movementPath = "event:/SFX/Player_movement";
            if (FMOD_Debug.CheckFmodEvent(movementPath))
            {
                _emitter.Event = movementPath;
                _emitter.Play();
            }
        }
    }
示例#20
0
    protected void Awake()
    {
        sfx_PortalShot = GetComponent <StudioEventEmitter>();
        _portalTarget  = GetComponentInChildren <PortalTarget>();
        var pos = _portalTarget.transform.position;

        pos.z = 0f;
        _portalTarget.transform.position = pos;

        _clawTarget = GetComponent <ClawTarget>();

        if (_clawTarget == null)
        {
            Debug.LogError("Not a valid portal");
            return;
        }

        _clawTarget.OnShipUnDocked += OnShipLeave;
    }
示例#21
0
    // Start is called before the first frame update
    void Start()
    {
        MasterBus      = FMODUnity.RuntimeManager.GetBus("Bus:/");
        vitoriaEmitter = null;
        GameObject go = GameObject.Find("vitoria");

        if (go != null)
        {
            vitoriaEmitter = go.GetComponent <StudioEventEmitter>();
        }
        ambientacaoEmitter = null;
        go = GameObject.Find("ambiencia");
        if (go != null)
        {
            ambientacaoEmitter = go.GetComponent <StudioEventEmitter>();
        }
        AlreadyEnded = false;
        this.gameObject.SetActive(false);
    }
示例#22
0
 protected virtual void Reset()
 {
     if (this._animator == null)
     {
         this._animator = this.GetComponentInChildren <Animator>();
     }
     #if LUDIQ_CHRONOS
     if (this._timeline == null)
     {
         this._timeline = this.GetComponentInChildren <Timeline>();
     }
     #endif
     #if FMOD
     if (this._mounthVoiceEmitter == null)
     {
         this._mounthVoiceEmitter = this.GetComponentInChildren <StudioEventEmitter>();
     }
     #endif
 }
示例#23
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();
        }
    }
示例#24
0
    // Use this for initialization
    void Start()
    {
        SE             = GetComponent <StudioEventEmitter>();
        animator       = this.GetComponent <Animator>();
        gun            = this.transform.GetComponentInChildren <Gun>();
        aiVision       = this.transform.GetComponentInChildren <AIVision>();
        ai             = this.GetComponent <AI>();
        levelGenerator = GameObject.Find("LevelGenerator").GetComponent <LevelGenerator>();

        ai.target = GameObject.FindWithTag("Player").transform;

        startIdleTime = idleTime;

        startPatrolTime = patrolTime;

        if (gameObject.tag == "Enemy")
        {
            Decision();
        }
    }
示例#25
0
    void Start()
    {
        _sounds = new [] { SmallPetSound, MediumPetSound, LargePetSound };
        Vector3 petScale = transform.localScale;

        if (petScale.x == 0.5f)
        {
            _currentSound = SmallPetSound;
        }
        else if (petScale.x == 1f)
        {
            _currentSound = MediumPetSound;
        }
        else if (petScale.x == 1.5)
        {
            _currentSound = LargePetSound;
        }

        ResetInterval();
    }
示例#26
0
    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();
    }
        void InstanciateSound(string eventName, float delay, float volume, int intBoolLoop, Vector3 pos, Vector3 endPos, float tweenDuration = 2)
        {
            GameObject newGO = new GameObject(eventName + "Emitter") as GameObject;//Instantiate(prefabEmitter, pos, Quaternion.identity) as GameObject;

            newGO.transform.position = pos;
            StudioEventEmitter newEmitter = newGO.AddComponent <StudioEventEmitter>() as StudioEventEmitter;

            newEmitter.Event = eventName;
            newEmitter.SetParameter("Volume", volume);
            if (intBoolLoop == 0)
            {
            }

            if (endPos != Vector3.zero)
            {
                StartCoroutine(SoundCouroutine(newEmitter, delay, Vector3.zero, tweenDuration));
            }
            else
            {
                StartCoroutine(SoundCouroutine(newEmitter, delay, Vector3.zero, tweenDuration));
            }
        }
示例#28
0
    private void Awake()
    {
        if (Current == null)
        {
            Current = this;
            DontDestroyOnLoad(gameObject);
            if (TryGetComponent(out emitter) == false)
            {
                emitter       = gameObject.AddComponent <StudioEventEmitter>();
                emitter.Event = musicEventPath;
            }

            if (playOnAwake)
            {
                Play();
            }
        }
        else
        {
            DestroyImmediate(gameObject);
        }
    }
 static bool Prefix(Raft __instance, ref Rigidbody ___body, ref float ___speed, ref StudioEventEmitter ___eventEmitter_idle, ref Vector3 ___previousPosition)
 {
     if (!Semih_Network.IsHost)
     {
         return(false);
     }
     if (!__instance.IsAnchored && ___speed != 0f)
     {
         __instance.moveDirection = Vector3.forward;
         List <Sail> allSails = Sail.AllSails;
         Vector3     vector   = Vector3.zero;
         int         i        = 0;
         int         num      = 1;
         while (i < allSails.Count)
         {
             Sail sail = allSails[i];
             if (sail.open)
             {
                 vector += sail.GetNormalizedDirection() * (float)(num / Math.Pow(num, rate));
             }
             i++;
             num++;
         }
         if (vector.z < 0f)
         {
             vector.z = ((Mathf.Abs(vector.x) <= 0.7) ? -0.8f : (__instance.moveDirection.z = 0f));
         }
         __instance.moveDirection += vector;
         ___body.AddForce(__instance.moveDirection * ___speed);
     }
     if (___body.velocity.sqrMagnitude > __instance.maxVelocity)
     {
         ___body.velocity = Vector3.ClampMagnitude(___body.velocity, __instance.maxVelocity);
     }
     ___eventEmitter_idle.SetParameter("velocity", ___body.velocity.sqrMagnitude / __instance.maxVelocity);
     ___previousPosition = ___body.transform.position;
     return(false);
 }
示例#30
0
 // Update is called once per frame
 private void Update()
 {
     if (!Initialized && _densityCounter++ > Density.StepThreshold)
     {
         Initialized = true;
         Density[] density = GameObject.Find("Ground").GetComponentsInChildren <Density> ();
         float[]   ratios  = new float [density.Length];
         for (int i = 0; i < density.Length; i++)
         {
             ratios [i] = (
                 density [i].WaterDistance <= Manager.Instance.MinimumWaterDistance ||
                 density [i].TreeDistance <= Manager.Instance.MinimumForestDistance ||
                 density [i].StoneDistance <= Manager.Instance.MinimumStoneDistance ||
                 density [i].IronDistance <= Manager.Instance.MinimumIronDistance) ? 0f : (
                 0.3f * density [i].WaterDensity +
                 0.3f * density [i].TreeDensity +
                 0.2f * density [i].StoneDensity +
                 0.2f * density [i].IronDensity
                 );
         }
         Center = density [Array.IndexOf(ratios, Mathf.Max(ratios))].transform.position;
         //Debug.Log ("Placement du village en " + Center);
         PlaceVillage();
     }
     if (Initialized)
     {
         StudioEventEmitter fmodEmitter = GameObject.Find("Main Camera").GetComponent <StudioEventEmitter>();
         if (_villagers.Count <= 3)
         {
             fmodEmitter.EventInstance.setParameterValue("GameOver", 0.7f + (Manager.Instance.CurrentSeason * 0.2f / 3f) + (3 - _villagers.Count) * 0.2f);
         }
         else
         {
             fmodEmitter.EventInstance.setParameterValue("GameOver", 0f);
         }
     }
 }