Ejemplo n.º 1
0
 public static void SetAudioSource(AudioBehaviour source)
 {
     if (_Instance != null)
     {
         _Instance.UpdateAudioSource(source);
     }
     else
     {
         Debug.LogWarning("SetAudioSource called, but instance hasn't been created");
     }
 }
Ejemplo n.º 2
0
    protected virtual void Start()
    {
        _objectPool = ObjectPooler.Instance;

        _rigidBody2D            = GetComponent <Rigidbody2D>();
        _spriteRenderer         = GetComponent <SpriteRenderer>();
        _input                  = GetComponent <Input>();
        _movementBehaviour      = GetComponent <MovementBehaviour>();
        _jumpBehaviour          = GetComponent <JumpBehaviour>();
        _playerCheckBehaviour   = GetComponent <PlayerCheckBehaviour>();
        _dashBehaviour          = GetComponent <DashBehaviour>();
        _damageBehaviour        = GetComponent <DamageBehaviour>();
        _audioBehaviour         = GetComponent <AudioBehaviour>();
        _specialEffectBehaviour = GetComponent <SpecialEffectBehaviour>();
        _scoreBehaviour         = GetComponent <ScoreBehaviour>();
    }
Ejemplo n.º 3
0
    public override void Execute(StateMachineActionObject smao)
    {
        audioBehaviour = smao.Animator.GetComponent <AudioBehaviour>();
        if (audioBehaviour != null)
        {
            eventName = new NativeString64(audioBehaviour.AudioPrefix + EventName + audioBehaviour.AudioSuffix);
        }
        else
        {
            eventName = new NativeString64(EventName);
        }
        var gao    = smao.Animator.GetComponent <GameObjectEntity>();
        var target = gao != null ? gao.Entity : Entity.Null;

        EventSystem.PublishData(new AudioEvent()
        {
            EventName = eventName, Options = Options, Target = target
        });
    }
Ejemplo n.º 4
0
        private void UpdateAudioSource(AudioBehaviour source)
        {
            audioSource = source;

            if (audioSource.GetType() == typeof(AudioListener))
            {
                samplingRate = AudioSettings.outputSampleRate;
            }
            else if (audioSource.GetType() == typeof(AudioSource))
            {
                if ((audioSource as AudioSource).clip != null)
                {
                    samplingRate = (audioSource as AudioSource).clip.frequency;
                }
                else
                {
                    samplingRate = 44100;
                }
            }
        }
 /// <summary>
 /// Used for initialization by Unity. The Start method is called just
 /// before any of the Update methods is called the first time.
 /// 
 /// This method starts the SideMovement coroutine, which is used to
 /// handle user inputs.
 /// </summary>
 void Start()
 {
     this.audioManager = transform.Find("2DAudio").GetComponent<AudioBehaviour>();
     StateManager.Instance.PauseOrUnpause();
     try
     {
         this.avatar = new Avatar(this, GameObject.Find("Kinect(Clone)").GetComponent<KinectUserInput>());
     }
     catch (OpenNI.GeneralException e)
     {
         Logger.Log(e.Message);
         HandleKinectInitializationFailure();
     }
     catch (System.DllNotFoundException)
     {
         Logger.Log("OpenNI DLL not found. Check if OpenNI is installed properly");
         HandleKinectInitializationFailure();
     }
     finally
     {
         StartCoroutine(SideMovement());
     }
 }
Ejemplo n.º 6
0
 // Use this for initialization
 void Start()
 {
     _renderer = GetComponent <Renderer> ();
     _audio    = GetComponent <AudioBehaviour> ();
 }
 /// <summary>
 /// Initializes the instance variables. (This function is automatically called by Unity)
 /// </summary>
 void Start()
 {
     powerup = new PointsPowerup();
     this.audioManager = GameObject.Find("2DAudio").GetComponent<AudioBehaviour>();
 }