예제 #1
0
    public static void SetSoundVolume(float newFXVolume, float newBGVolume)
    {
        if (newFXVolume > 1 || newFXVolume < 0 || newBGVolume > 1 || newBGVolume < 0)
        {
            Logger.Log("you cannot have the volume higher than 1 or lower than 0", LogType.Error);
            return;
        }

        List <SoundObject> sounds = SceneUtils.FindObjects <SoundObject>();

        foreach (SoundObject sound in sounds)
        {
            if (sound.soundType == SoundType.FX)
            {
                sound.SetVolume(newFXVolume);
            }
            else
            {
                sound.SetVolume(newBGVolume);
            }
        }

        fxSoundVolume         = newFXVolume;
        backgroundSoundVolume = newBGVolume;
    }
예제 #2
0
    public override void OnActivated()
    {
        Vector3 praisePositionTarget = Vector3.zero;

        WizardKing     wizardKing     = SceneUtils.FindObject <WizardKing>();
        WizardKingSolo wizardKingSolo = SceneUtils.FindObject <WizardKingSolo>();

        if (wizardKingSolo)
        {
            praisePositionTarget = wizardKingSolo.transform.position;
            wizardKingSolo.CannotDie();
        }
        else if (wizardKing)
        {
            praisePositionTarget = wizardKing.transform.position;
        }

        foreach (Transformer transformer in SceneUtils.FindObjects <Transformer>())
        {
            if (!transformer.IsTranformed())
            {
                Direction directionToKing = MathUtils.GetHorizontalDirection(praisePositionTarget, transformer.transform.position);
                transformer.GetComponent <BodyControl>().Turn((float)directionToKing);
                transformer.DoPraise();
            }
        }

        DeActivate();
    }
예제 #3
0
    public static void SetSoundVolume(SoundType soundType, float newVolume, bool saveNewVolume = true)
    {
        if (newVolume > 1 || newVolume < 0)
        {
            Logger.Log("you cannot have the volume higher than 1 or lower than 0", LogType.Error);
            return;
        }

        List <SoundObject> sounds = SceneUtils.FindObjects <SoundObject>();

        foreach (SoundObject sound in sounds)
        {
            if (sound.soundType == soundType)
            {
                sound.SetVolume(newVolume);
            }
        }

        if (saveNewVolume)
        {
            if (soundType == SoundType.FX)
            {
                fxSoundVolume = newVolume;
            }

            if (soundType == SoundType.BG)
            {
                backgroundSoundVolume = newVolume;
            }
        }
    }
예제 #4
0
    // Use this for initialization
    void Awake()
    {
        worldStates = new List <WorldState>();
        worldStates.Add(startWorldState);
        worldEventProducers = SceneUtils.FindObjects <WorldEventProducer>();

        worldEventProducers.ForEach(weProducer => weProducer.AddEventListener(this.gameObject));
    }
예제 #5
0
    public static void UnMuteAll()
    {
        List <SoundObject> sounds = SceneUtils.FindObjects <SoundObject>();

        foreach (SoundObject sound in sounds)
        {
            sound.UnMute();
        }
    }
예제 #6
0
    public static void ResetTimeScale()
    {
        List <SoundObject> sounds = SceneUtils.FindObjects <SoundObject>();

        foreach (SoundObject sound in sounds)
        {
            sound.ResetTimeScale();
        }
    }
예제 #7
0
    public static void SetTimeScale(float newTimeScale)
    {
        List <SoundObject> sounds = SceneUtils.FindObjects <SoundObject>();

        foreach (SoundObject sound in sounds)
        {
            sound.SetTimeScale(newTimeScale);
        }
    }
    public static void PauseGame()
    {
        List <DispatchBehaviour> pausableObjects = SceneUtils.FindObjects <DispatchBehaviour>();

        foreach (DispatchBehaviour pausable in pausableObjects)
        {
            pausable.OnPauseGame();
        }
    }
예제 #9
0
    public static T FindObject <T>()
    {
        List <T> foundObjects = SceneUtils.FindObjects <T>();

        if (foundObjects.Count > 0)
        {
            return(foundObjects[0]);
        }
        Debug.Log("[SceneUtils] {WARN} could not find the object!");
        return(default(T));
    }
예제 #10
0
    public static void MuteAll(SoundType soundType)
    {
        List <SoundObject> sounds = SceneUtils.FindObjects <SoundObject>();

        foreach (SoundObject sound in sounds)
        {
            if (sound.soundType == soundType)
            {
                sound.Mute();
            }
        }
    }
    // Use this for initialization
    void Start()
    {
        alienUIManager    = SceneUtils.FindObject <AlienUIManager>();
        cameraShaker      = SceneUtils.FindObject <CameraShaker>();
        alienGameManager  = SceneUtils.FindObject <AlienGameManager>();
        alienInputActions = AlienInputActions.CreateWithDefaultBindings();
        alienTargetsVisited.Add(currentAlienTarget);
        alienTargetPath.Add(currentAlienTarget);

        allAlienTargets = SceneUtils.FindObjects <AlienTarget>();
        allAlienTargets.ForEach(alienTarget => alienTarget.AddEventListener(this.gameObject));
    }
예제 #12
0
    public static void FadeOutBackgroundMusic(float amount = 0)
    {
        List <FadingAudio> sounds = SceneUtils.FindObjects <FadingAudio>();

        foreach (FadingAudio fadingAudio in sounds)
        {
            if (fadingAudio.soundType == SoundType.BG)
            {
                if (amount > 0)
                {
                    fadingAudio.FadeOut(amount);
                }
            }
        }
    }
    public void FadeSound()
    {
        List <SoundObject> allSounds = SceneUtils.FindObjects <SoundObject> ();

        foreach (SoundObject soundObject in allSounds)
        {
            float soundVolume = soundObject.GetVolume();
            soundObject.SetVolume(soundVolume + fadeAmount);
        }

        bool allSoundsFaded = allSounds.TrueForAll(soundObject => soundObject.GetVolume() < .01f);

        if (!allSoundsFaded)
        {
            Invoke("FadeSound", fadeTimeout);
        }
    }
    private void DoZoom(float newSize)
    {
        if (!isBusy)
        {
            isBusy = true;
            iTween.ValueTo(this.gameObject, new ITweenBuilder()
                           .SetFromAndTo(usedCamera.orthographicSize, newSize)
                           .SetTime(zoomTime)
                           .SetOnUpdate("OnCameraZoomChanged")
                           .SetOnCompleteTarget(this.gameObject)
                           .SetOnComplete("OnZoomed")
                           .Build()
                           );
        }

        SceneUtils.FindObjects <UIPositioner>().ForEach(uiPositioner => uiPositioner.Start());
    }
 void Start()
 {
     playersToFollow = SceneUtils.FindObjects <Player>();
     usedCamera      = this.GetComponentInChildren <Camera>();
 }