コード例 #1
0
    protected override void PreInitialization()
    {
        base.PreInitialization();

        repo = this.GetComponent <SoundRepo>();

        if (repo.effect.source == null)
        {
            Debug.LogError("Error: Sound Manager has no effect audio source\n");
            return;
        }

        // Initialize effects source component
        repo.effect.source.loop        = false;
        repo.effect.source.playOnAwake = false;

        if (repo.music.source == null)
        {
            Debug.LogError("Error: Sound Manager has no music audio source\n");
            return;
        }

        sourceMusicVolume = repo.music.source.volume;

        // Initialize musics source component
        repo.music.source.loop        = true;
        repo.music.source.playOnAwake = false;
    }
コード例 #2
0
    // Start is called before the first frame update
    void Start()
    {
        equippedItem = ItemInfo.ItemType.None;

        audioSource = this.gameObject.GetComponent <AudioSource>();

        soundRepo = GameObject.FindObjectOfType <SoundRepo>();
    }
コード例 #3
0
ファイル: WeaponController.cs プロジェクト: W-Siqi/GGJ2020
    // Start is called before the first frame update
    void Start()
    {
        line = this.gameObject.GetComponent <LineRenderer>();

        line.enabled = false;

        audioSource = this.gameObject.GetComponent <AudioSource>();
        soundRepo   = GameObject.FindObjectOfType <SoundRepo>();
    }