Exemple #1
0
        private void Awake()
        {
            targetGameObject = new GameObject();
            audioPlayer      = targetGameObject.AddComponent <AudioSourcePlayer>();
            AudioClip clip = Resources.Load <AudioClip>("Audio/Music/Loop");

            audioPlayer.FadeIn(clip, 3, 0, 1, 0, OnFadeInCompleteCallback);
        }
        private void Awake()
        {
            targetGameObject = new GameObject();
            audioPlayer      = targetGameObject.AddComponent <AudioSourcePlayer>();
            AudioClip clip = Resources.Load <AudioClip>("Audio/Music/Loop");

            audioPlayer.PlayAudio(clip);
            Invoke("FadeOutLater", 3f);
        }
        private void Awake()
        {
            targetGameObject = new GameObject();
            audioPlayer      = targetGameObject.AddComponent <AudioSourcePlayer>();
            audioPlayer.AudioPlayCompleted.AddListener(OnAudioPlayCompleted);
            AudioClip clip = Resources.Load <AudioClip>("Audio/Sounds/Ring");

            audioPlayer.PlayAudio(clip);
        }
Exemple #4
0
    void Start()
    {
        audioPlayer   = AudioSourcePlayer.AddAsComponent(gameObject, audioManager);
        controller    = GetComponent <Controller2D>();
        sr            = GetComponent <SpriteRenderer>();
        animator      = GetComponent <Animator>();
        impulseSource = GetComponent <CinemachineImpulseSource>();

        gravity         = -(2 * maxJumpHeight) / Mathf.Pow(timeToJumpApex, 2);
        maxJumpVelocity = Mathf.Abs(gravity) * timeToJumpApex;
        minJumpVelocity = Mathf.Sqrt(2 * Mathf.Abs(gravity) * minJumpHeight);
        print("Gravity: " + gravity + "  Jump Velocity: " + maxJumpVelocity);
    }
 /// <summary>
 /// 销毁所有闲置中的多通道音效的音源
 /// </summary>
 public void ClearIdleMultipleAudioSource()
 {
     for (int i = 0; i < _multipleAudio.Count; i++)
     {
         if (!_multipleAudio[i].isPlaying)
         {
             AudioSourcePlayer player = _multipleAudio[i];
             _multipleAudio.RemoveAt(i);
             i -= 1;
             player.Dispose();
         }
     }
 }
Exemple #6
0
    protected void Awake()
    {
        sensor        = GetComponentInChildren <Sensor>();
        animator      = GetComponentInChildren <Animator>();
        CurrentHealth = maxHealth;

        maxHealthUpgrade       = new CharacterUpgrade();
        speedUpgrade           = new CharacterUpgrade();
        rateOfFireUpgrade      = new CharacterUpgrade();
        rangeUpgrade           = new CharacterUpgrade();
        damageUpgrade          = new CharacterUpgrade();
        projectileSpeedUpgrade = new CharacterUpgrade();
        player = gameObject.AddComponent <AudioSourcePlayer>();
    }
        private void OnResult(UnityHttpClient httpClient, UnityHttpResponse response)
        {
            UnityHttpResponseAudioClip audioResp = (UnityHttpResponseAudioClip)response;
            AudioClip clip = audioResp.AudioClip;

            audioGameObject = new GameObject();
            AudioSourcePlayer player = audioGameObject.AddComponent <AudioSourcePlayer>();

            if (player)
            {
                player.AudioPlayCompleted.AddListener((AudioSourcePlayer p, EventArgs e) =>
                {
                    Destroy(audioGameObject);
                    IntegrationTest.Pass();
                });
                player.PlayAudio(clip);
            }
        }
Exemple #8
0
    public bool canPlay = true; // Setup board and instantiate items

    // Setup board and instantiate items
    void BoardSetup()
    {
        audioPlayer = AudioSourcePlayer.AddAsComponent(gameObject, audioManager);

        //Instantiate Board and set boardHolder to its transform.
        boardHolder = new GameObject("Board").transform;

        _items = new Item[width, height];

        //Loop along x axis.
        for (int x = 0; x < width; x++)
        {
            //Loop along y axis
            for (int y = 0; y < height; y++)
            {
                _items[x, y] = InstantiateDoddle(x, y);
            }
        }
    }
Exemple #9
0
 private void Awake()
 {
     audioPlayer = AudioSourcePlayer.AddAsComponent(gameObject, audioManager);
 }
Exemple #10
0
 protected override void OnAwake()
 {
     audioPlayer = AudioSourcePlayer.AddAsComponent(gameObject, audioManager);
 }
Exemple #11
0
 private void Awake()
 {
     bouton = GetComponent <Button>();
     player = gameObject.AddComponent <AudioSourcePlayer>();
 }
 private void OnAudioPlayCompleted(AudioSourcePlayer audioPlayer, EventArgs e)
 {
     IntegrationTest.Pass(gameObject);
 }
Exemple #13
0
 private void Awake()
 {
     audioPlayer   = AudioSourcePlayer.AddAsComponent(gameObject, audioManager);
     dialogTrigger = gameObject.GetComponent <DialogueTrigger>();
 }
Exemple #14
0
 public void UnregisterAudioSourcePlayer(AudioSourcePlayer player)
 {
     soundSources.Remove(player);
 }
Exemple #15
0
 public void RegisterAudioSourcePlayer(AudioSourcePlayer player)
 {
     soundSources.Add(player);
 }