Example #1
0
    public void Awake()
    {
        this._bagelAnim = bagel.GetComponent <Animator>();
        this._bagelAnim.SetInteger("status", 0);

        this._audio             = GetComponent <AudioSource>();
        this._audio.loop        = true;
        this._audio.playOnAwake = false;
        this._audio.volume      = Mathf.Clamp(OptionsController.musicVolume / 1f * 0.5f, 0f, 1f);
        this._audio.Play();

        this._processVolume = GameObject.Find("Camera").GetComponent <PostProcessVolume>();
        this._processVolume.profile.TryGetSettings(out _glichEffect);
        this._glichEffect.scanLineJitter.value = 0.107f;

        this._sfx = GetComponent <util_sfx>();

        // Preload assets! - Faster play
        AssetsController.GetResource <AudioClip>("Sounds/Ingame/Music/Comfortable Mystery 4");
        AssetsController.GetResource <AudioClip>("Sounds/Ingame/Music/dundundunnnnn");
        AssetsController.GetResource <AudioClip>("Sounds/Ingame/Effects/door_close");
        AssetsController.GetResource <AudioClip>("Sounds/Ingame/Effects/door_open");

        // Vars
        this._canLeave   = false;
        this._isSadMusic = false;
        this.eatBtn.SetActive(false);
    }
Example #2
0
    public void Awake()
    {
        if (this.reciever == null)
        {
            throw new UnityException("logic_button missing a reciever");
        }
        this._cable = this.GetComponent <logic_cable>();

        this._spriteRender        = this.GetComponent <SpriteRenderer>();
        this._spriteRender.sprite = this.offSprite;


        this._colliders        = new List <Collider2D>();
        this._allowedColliders = new List <string>()
        {
            "paradox_object",
            "timed_object"
        };

        this._audioSource             = GetComponent <AudioSource>();
        this._audioSource.playOnAwake = false;
        this._originalVolume          = 0.45f;

        this._audioClips = new AudioClip[] {
            AssetsController.GetResource <AudioClip>("Sounds/Ingame/Objects/Button/button_normal"),
            AssetsController.GetResource <AudioClip>("Sounds/Ingame/Objects/Button/button_preasure_on"),
            AssetsController.GetResource <AudioClip>("Sounds/Ingame/Objects/Button/button_preasure_off")
        };
    }
Example #3
0
    public void Awake()
    {
        #region Game_Settings
        Application.targetFrameRate = 60;
        Screen.sleepTimeout         = SleepTimeout.NeverSleep;
        #endregion

        // Get
        this._musicBackground             = GetComponent <AudioSource>();
        this._musicBackground.playOnAwake = true;
        this._musicBackground.volume      = 1f;

        this._soundEffect             = GetComponentInChildren <AudioSource>();
        this._soundEffect.playOnAwake = false;
        this._soundEffect.volume      = 0.5f;

        this._audioClip_win = new AudioClip[] {
            AssetsController.GetResource <AudioClip>("Sounds/local_exo_won1"),
            AssetsController.GetResource <AudioClip>("Sounds/local_exo_won2"),
            AssetsController.GetResource <AudioClip>("Sounds/local_exo_won3")
        };

        this._audioClip_lost = new AudioClip[] {
            AssetsController.GetResource <AudioClip>("Sounds/local_lose2"),
            AssetsController.GetResource <AudioClip>("Sounds/local_lose3"),
            AssetsController.GetResource <AudioClip>("Sounds/local_lose4")
        };
    }
Example #4
0
    public void Awake()
    {
        this._countdownText      = GameObject.Find("ui_countdown").GetComponent <TextMeshPro>();
        this._source             = GetComponent <AudioSource>();
        this._source.playOnAwake = false;

        this._audioClips = new AudioClip[] {
            AssetsController.GetResource <AudioClip>("Sounds/countdown_dos_sec1"),
            AssetsController.GetResource <AudioClip>("Sounds/countdown_dos_sec2"),
            AssetsController.GetResource <AudioClip>("Sounds/countdown_dos_sec3"),
            AssetsController.GetResource <AudioClip>("Sounds/countdown_dos_sec4"),
            AssetsController.GetResource <AudioClip>("Sounds/countdown_dos_sec5")
        };
    }
Example #5
0
    public void playClip(string source, float volume)
    {
        if (this._audio == null)
        {
            return;
        }

        AudioClip clip = AssetsController.GetResource <AudioClip>("Sounds/" + source);

        if (clip == null)
        {
            throw new UnityException("Failed to find clip {" + source + "}");
        }

        this._audio.volume = Mathf.Clamp(OptionsController.effectsVolume / 1f * volume, 0f, 1f);
        this._audio.clip   = clip;
        this._audio.Play();
    }
Example #6
0
    public void Awake()
    {
        this._colliders = new List <Collider2D>();
        this._nails     = new List <GameObject>();

        this._isTimed          = this.GetComponent <logic_time>() != null;
        this._allowedColliders = new List <string>()
        {
            "paradox_object",
            "timed_object"
        };

        #region Sound Loading
        this._audioSource             = this.GetComponent <AudioSource>();
        this._audioSource.playOnAwake = false;
        this._originalVolume          = 0.45f;

        this._audioClips = new AudioClip[] {
            AssetsController.GetResource <AudioClip>("Sounds/Ingame/Objects/Nailgun/nailgun_shoot_1"),
            AssetsController.GetResource <AudioClip>("Sounds/Ingame/Objects/Nailgun/nailgun_shoot_2"),
            AssetsController.GetResource <AudioClip>("Sounds/Ingame/Objects/Nailgun/nailgun_shoot_empty"),
        };
        #endregion
    }
Example #7
0
    // Start is called before the first frame update
    public void Awake()
    {
        this._audioSource             = GetComponent <AudioSource>();
        this._audioSource.volume      = 0.5f;
        this._audioSource.playOnAwake = false;

        this._bgAudioSource = GameObject.Find("background").GetComponent <AudioSource>();

        this._lifes = PlayerPrefs.GetInt("lifes", 3);
        this._speed = PlayerPrefs.GetFloat("minigameSpeed", 0);

        this.faster.text         = "";
        this.explosionAnim.speed = 0f;
        logic_drag.canDrag       = true;
        logic_drag.isDragging    = 0;

        this._audioClip_win = AssetsController.GetResource <AudioClip>("Sounds/plane");

        this._audioClip_lost = new AudioClip[] {
            AssetsController.GetResource <AudioClip>("Sounds/explosion_1"),
            AssetsController.GetResource <AudioClip>("Sounds/explosion_2"),
            AssetsController.GetResource <AudioClip>("Sounds/explosion_3")
        };
    }
Example #8
0
    public void OnLevelFinishedLoading(Scene scene, LoadSceneMode mode)
    {
        this._audio.Play();

        this.timeText.startText(() => {
            Debug.Log("Normal text completed, start blalbalbal");

            this.storyofmylifeText.startText(() => {
                Debug.Log("This should never be called :S");
            }, (string type) => {
                if (type == "sadmusic" && !this._isSadMusic)
                {
                    this._isSadMusic = true;

                    // Change track
                    this._audio.clip   = AssetsController.GetResource <AudioClip>("Sounds/Ingame/Music/Comfortable Mystery 4");
                    this._audio.volume = Mathf.Clamp(OptionsController.musicVolume / 1f * 0.4f, 0f, 1f);
                    this._audio.Play();
                }
                else if (type == "leave")
                {
                    this._canLeave = true;
                    this.eatBtn.SetActive(true);
                }
            });
        }, (string type) => {
            if (type == "reveal")
            {
                this._bagelAnim.SetInteger("status", 1);
            }
            else if (type == "dundundun")
            {
                this._sfx.playClip("Ingame/Music/dundundunnnnn", 0.3f);
            }
        });
    }