Inheritance: MonoBehaviour
Esempio n. 1
0
	void Awake() {
		if (Instance != null) {
			DestroyImmediate(gameObject);
			return;
		}
		Instance = this;
	}
Esempio n. 2
0
    void Start()
    {
        helpText.SetActive(false);
        skipButton.gameObject.SetActive(false);
        micModeButton.gameObject.SetActive(false);
        shuffleModeButton.gameObject.SetActive(false);
        Invoke("StartGame", splashDuration);

        // Subscribe to AudioController.StartShuffleModeFailed event
        // so we can hide the UI buttons and show the help message when
        // falling back to mic mode.
        audioController = GetComponent<AudioController>();
        audioController.StartShuffleModeFailed += (s, e) =>
        {
            skipButton.gameObject.SetActive(false);
            micModeButton.gameObject.SetActive(false);
            shuffleModeButton.gameObject.SetActive(false);

            Invoke("ShowHelp", helpDelay);
            Invoke("HideHelp", helpDelay + helpDuration);
        };

        // Set up the BubbleController dependencies and create the BubbleController.
        ExplosionController explosionController = GetComponent<ExplosionController>();
        GameObject spectrumObject = GameObject.FindGameObjectWithTag("Spectrum");
        SpectrumVisualiser visualiser = spectrumObject.GetComponent<SpectrumVisualiser>();
        bubbleController = new BubbleController(bubblePrefab, bubbleOptions, worldBoundary, explosionController, visualiser);
    }
Esempio n. 3
0
 // Use this for initialization
 public virtual void Start()
 {
     player = GameObject.Find("GameManager").GetComponent<Player>();
     audio = GameObject.Find("FXController").GetComponent<AudioController>();
     spriteRenderer = gameObject.GetComponent<SpriteRenderer>();
     defaultImg = spriteRenderer.sprite;
 }
 void Start()
 {
     speedRegulator = GameObject.Find ("SpeedRegulator").GetComponent<SpeedRegulator>();
     scoreRegulator = GameObject.Find ("ScoreRegulator").GetComponent<ScoreRegulator>();
     gasRegulator = GameObject.Find ("GasRegulator").GetComponent<GasRegulator>();
     audioController = GameObject.Find ("AudioContainer").GetComponent<AudioController>();
     comboRegulator = GameObject.Find ("ComboRegulator").GetComponent<ComboRegulator> ();
 }
Esempio n. 5
0
 // Use this for initialization
 void Awake()
 {
     AudioController.instance = this;
     //		idle	  = this.gameObject.AddComponent <AudioSource>();
     //		idleClip  = Resources.Load ("Audio/ambient") as AudioClip;
     //		idle.clip = idleClip;
     //		idle.loop = true;
     //		idle.Play();
 }
Esempio n. 6
0
    // Use this for initialization
    void Start()
    {
        myTransform = this.transform;
        SetUnitValues();
        players = GameObject.FindGameObjectsWithTag("Player");
		//highScore = GameObject.FindGameObjectWithTag("HighScore").GetComponent<HighScore>();
        audioController = GameObject.FindGameObjectWithTag("AudioController").GetComponent<AudioController>();
        gameController = GameObject.FindGameObjectWithTag("GameController").GetComponent<GameController>();
    }
	void OnLevelWasLoaded (int level) {
		audioController = GameObject.Find("AudioController").GetComponent<AudioController>();
		if (PSSceneUtil.InGame(level)) {
			ShowInventoryPanel();
		} else {
			HideInventoryPanel();
			CleanupScene();
		}
	}
Esempio n. 8
0
 void Awake()
 {
     anim = GetComponent<Animator> ();
     audioController = GetComponent<AudioController> ();
     playerMovement = GetComponent<PlayerMovement> ();
     hitParticles = GetComponentsInChildren<ParticleSystem> ()[0];
     score = GameObject.Find ("ScoreKeeper").GetComponent<Score>(); //
     CurrentHealth = StartHealth;
 }
 void Awake()
 {
     rb = GetComponent<Rigidbody> ();
     anim = GetComponent<Animator> ();
     audioController = GetComponent<AudioController> ();
     rb.constraints = RigidbodyConstraints.FreezePositionZ | RigidbodyConstraints.FreezeRotationX | RigidbodyConstraints.FreezeRotationY | RigidbodyConstraints.FreezeRotationZ;
     cam = Camera.main.transform;
     gun = transform.GetComponentInChildren<PlayerShooting> ();
 }
Esempio n. 10
0
	protected override void Start()
    {
        base.Start();

		_audio = GetComponentInChildren<AudioController>();
		//_audio.Play(_audioEngineRunning);

		m_Clock.ClockUpdatedEvent += OnClockUpdated;
    }
	// Use this for initialization
	void Start ()
	{
		fader = transform.Find ("texture_black").GetComponent<SceneFadeInOut> ();
		
		audio_Controller_Script = AudioControllerObject.GetComponent<AudioController> ();
		audio_Controller_Script.FadeSpeed = FadeSpeed;
		fader = FindObjectOfType<GUITexture> ().GetComponent<SceneFadeInOut> ();
		fader.FadeSpeed = FadeSpeed;
	}
Esempio n. 12
0
 public static void PlayTrack(this AudioSource source, string track)
 {
     if (!source.isPlaying) {
         store_ = AudioController.Instance;
         source.clip = store_.TrackName(track);
         source.Play();
     }
     else
         Debug.LogError("This audiosource is already occupied");
 }
Esempio n. 13
0
    // Use this for initialization
    void Start()
    {
        myTransform = this.transform;
        mainCamera = GameObject.FindGameObjectWithTag("MainCamera");
        spawnLocation = GameObject.FindGameObjectWithTag("Spawn");
        gameManager = GameObject.FindGameObjectWithTag("GameManager").GetComponent<GameManager>();
        audioController = GameObject.FindGameObjectWithTag("AudioController").GetComponent<AudioController>();

        gameManager.numPinBalls++;
    }
Esempio n. 14
0
    public void Awake()
    {
        if(_instance != null)
        {
            Destroy(this);
            return;
        }

        _instance = this;
    }
Esempio n. 15
0
	protected void Awake ()
	{
		if (instance == null) {
			instance = this;
		} else if (instance != this) {
			DestroyObject (gameObject);
		}

		DontDestroyOnLoad (gameObject);
	}
        protected AudioContext(AudioController controller, IPreferredDeviceManager preferredDeviceManager)
        {
            Controller = controller;
            PreferredDeviceManager = preferredDeviceManager;

            if (Controller != null)
                Controller.Context = this;

            if (PreferredDeviceManager != null)
                PreferredDeviceManager.Context = this;
        }
    public override void DoSpecialAction(string actionTag) {
		switch (actionTag) {
            case "RiggerDescend":
                StartCoroutine(RiggerDescend());
                break;
			case "RiggerSpeech":
				audio = GameObject.Find ("AudioController").GetComponent<AudioController> ();
				audio.VoiceEffect ("RiggerSpeech");
				break;
        }
    }
 // Use this for initialization
 void Start()
 {
     grapplingHooks = new List<GraplingHook>();
     thePlayer = GameObject.Find("Player");
     playerClimbing = thePlayer.GetComponent<Climbing>();
     playerRopeController = thePlayer.GetComponent<RopeController>();
     Name = "GrapplingHook";
     Image = Resources.Load<Sprite>("grapplinghook");
     IsConsumable = true;
     Prefab = null;
     audioController = GameObject.Find ("Audio Delegate").GetComponent<AudioController>();
 }
 void Awake()
 {
     if (controller == null)
     {
         DontDestroyOnLoad(gameObject);
         controller = this;
     }
     else if (controller != this)
     {
         Destroy(gameObject);
     }
 }
Esempio n. 20
0
 void Start()
 {
     sanity = sanityBar.GetComponent<Slider>();
     background = sanityBar.GetComponentsInChildren<Image>()[0];
     foreground = sanityBar.GetComponentsInChildren<Image>()[1];
     degenPerSec = sanity.maxValue / sanityLifetime;
     health = GetComponent<Health>();
     fadeTime = health.sanityTickTime;
     faded = false;
     sanity.value = value;
     audioController = GameObject.Find ("Audio Delegate").GetComponent<AudioController>();
 }
	// Use this for initialization
	void Start ()
	{
		fader = transform.Find ("texture_black").GetComponent<SceneFadeInOut> ();

		audio_Controller_Script = AudioControllerObject.GetComponent<AudioController> ();
		audio_Controller_Script.FadeSpeed = FadeSpeed;
		fader = FindObjectOfType<GUITexture> ().GetComponent<SceneFadeInOut> ();
		fader.FadeSpeed = FadeSpeed;

		// reset the score manager.
		ScoreManager.Instance.Reset ();
	}
Esempio n. 22
0
    void Awake()
    {
        if (instance != null && instance != this)
        {
            Destroy(this.gameObject);
        }
        else
        {
            instance = this;
        }

        DontDestroyOnLoad(this.gameObject);
    }
Esempio n. 23
0
    public void Start()
    {
        m_AudioController = gameObject.GetComponent<AudioController>();
        m_FiringPoints = new List<Transform>();
        foreach (Transform tran in transform)
            if (tran.gameObject.name.Contains(WeapMountName))
                m_FiringPoints.Add(tran);

        if (EquippedPrimaryWeapon != null)
            EquipPrimaryWeapon(EquippedPrimaryWeapon);
        if (EquippedSecondaryWeapon != null)
            EquipSecondaryWeapon(EquippedSecondaryWeapon);
    }
Esempio n. 24
0
	void Start()
	{
		AudioSource[] audioSources = gameObject.GetComponents<AudioSource> ();
		normalAudioSource = audioSources [0];
		loopAudioSource = audioSources [1];
		loopAudioSource.loop = true;

		foreach (AudioClip clip in clips)
		{
			map.Add (clip.name, clip);
		}
		instance = this;
	}
Esempio n. 25
0
    void Awake()
    {
        rb = GetComponent<Rigidbody>();
        rend = GetComponent<Renderer>();
        grenade.SetActive(false);
        explosion.SetActive(false);

        sfx = GameObject.FindGameObjectWithTag ("SFXController").GetComponent<AudioController> ();

        pacman = Resources.Load("Materials/pacman", typeof(Material)) as Material;
        pacmanBomb = Resources.Load("Materials/pacmanbomb", typeof(Material)) as Material;

        ShowAsBomb (false);
    }
Esempio n. 26
0
	// Use this for initialization
	void Start ()
	{
		foreach (GUIText current_text in FindObjectsOfType<GUIText>()) {
			if (current_text.name.Contains ("text_money"))
				current_text.text = "$" + ScoreManager.Instance.Money;
		}

		fader = transform.Find ("texture_black").GetComponent<SceneFadeInOut> ();
		
		audio_Controller_Script = AudioControllerObject.GetComponent<AudioController> ();
		audio_Controller_Script.FadeSpeed = FadeSpeed;
		fader = FindObjectOfType<GUITexture> ().GetComponent<SceneFadeInOut> ();
		fader.FadeSpeed = FadeSpeed;
	}
Esempio n. 27
0
    public override void Interact(Player player)
    {
        base.Interact(player);

        bool activateMotor = (m_Passengers.Count > 0);

		// Play audio
		if(_audio == null)
			_audio = GetComponentInChildren<AudioController>();

		_audio.Play(_audioEngineRunning);

		foreach (SimpleAnimation simpleAnimation in m_SimpleAnimations)
        {
            simpleAnimation.Play(activateMotor);
        }
    }
Esempio n. 28
0
    // Initialize this class
    public void Initialize(PlayerPresenter playerPresenter,int index, Vector4 cameraConfiguration)
	{
        // Set player identifier
        this.PlayerId = (ID) index;
        this.transform.name = this.PlayerId.ToString();

        // Set initial player variables
        this.playerPresenter = playerPresenter;

        this.InputController = this.GetComponentInChildren<PlayerInput>();
        this.MovementController = this.GetComponentInChildren<PlayerMovementController>();
        this.CameraController = this.GetComponentInChildren<PlayerCameraController>();
        this.PlayerAvatarController = this.GetComponentInChildren<AvatarController>();
        this.PlayerUIPresenter = this.GetComponentInChildren<PlayerUIPresenter>();
        this.PlayerAudioController = this.GetComponentInChildren<AudioController>();

        // Initialize player components
        this.PlayerAudioController.Initialize();
        this.InputController.Initialize(this);
        this.MovementController.Initialize(this);
        this.CameraController.Initialize(this, cameraConfiguration);
        this.PlayerAvatarController.Initialize(this);
        this.PlayerUIPresenter.Initialize(this);
	}
Esempio n. 29
0
 public override void Start()
 {
     base.Start();
     render          = transform.Find("CharacterSprite").gameObject.GetComponent <SpriteRenderer>();
     audioController = AudioController.Instance;
 }
Esempio n. 30
0
    private void _PlayClip(AudioController audioController, string audioName, float volume = 1f, float delay = 0f, float pitch = 1f)
    {
        AudioClip clip = (AudioClip)Singleton <ResourceManager> .instance.GetRawObjectByName(audioName);

        audioController.PlayClip(clip, volume, delay, pitch);
    }
Esempio n. 31
0
 public void SetVolume(float sliderValue)
 {
     AudioController.SetSoundVol(thistag, sliderValue);
     GameEvents.ScreamEvent("changevolume");
 }
Esempio n. 32
0
    void DrawGuiLeftSide()
    {
        var headerStyle = new GUIStyle(GUI.skin.label);

        headerStyle.normal.textColor = new UnityEngine.Color(1, 1, 0.5f);
        string txt = string.Format("ClockStone Audio Toolkit - Demo");

        GUI.Label(new Rect(22, 10, 500, 20), txt, headerStyle);



        int ypos           = 10;
        int yposOff        = 35;
        int buttonWidth    = 200;
        int scrollbarWidth = 130;

        ypos += 30;

        if (!AudioController.DoesInstanceExist())
        {
            GUI.Label(new Rect(250, ypos, buttonWidth, 30), "No Audio Controller found!");
            return;
        }

        GUI.Label(new Rect(250, ypos, buttonWidth, 30), "Global Volume");

        AudioController.SetGlobalVolume(GUI.HorizontalSlider(new Rect(250, ypos + 20, scrollbarWidth, 30), AudioController.GetGlobalVolume(), 0, 1));


        if (GUI.Button(new Rect(20, ypos, buttonWidth, 30), "Cross-fade to music track 1"))
        {
            AudioController.PlayMusic("MusicTrack1");
        }

        ypos += yposOff;

        GUI.Label(new Rect(250, ypos + 10, buttonWidth, 30), "Music Volume");

        float musicVolumeNew = GUI.HorizontalSlider(new Rect(250, ypos + 30, scrollbarWidth, 30), musicVolume, 0, 1);

        if (musicVolumeNew != musicVolume)
        {
            musicVolume = musicVolumeNew;
            AudioController.SetCategoryVolume("Music", musicVolume);
        }

        GUI.Label(new Rect(250 + scrollbarWidth + 30, ypos + 10, buttonWidth, 30), "Ambience Volume");

        float ambienceVolumeNew = GUI.HorizontalSlider(new Rect(250 + scrollbarWidth + 30, ypos + 30, scrollbarWidth, 30), ambienceVolume, 0, 1);

        if (ambienceVolumeNew != ambienceVolume)
        {
            ambienceVolume = ambienceVolumeNew;
            AudioController.SetCategoryVolume("Ambience", ambienceVolume);
        }

        if (GUI.Button(new Rect(20, ypos, buttonWidth, 30), "Cross-fade to music track 2"))
        {
            AudioController.PlayMusic("MusicTrack2");
        }

        ypos += yposOff;

        if (GUI.Button(new Rect(20, ypos, buttonWidth, 30), "Fade out music category"))
        {
            AudioController.FadeOutCategory("Music", 2);
        }

        ypos += yposOff;

        if (GUI.Button(new Rect(20, ypos, buttonWidth, 30), "Fade in music category"))
        {
            AudioController.FadeInCategory("Music", 2);
        }

        ypos += yposOff;

        if (GUI.Button(new Rect(20, ypos, buttonWidth, 30), "Stop Music"))
        {
            AudioController.StopMusic(0.3f);
        }

        //if ( GUI.Button( new Rect( 250, ypos, buttonWidth, 30 ), "Stop Ambience" ) )
        //{
        //    AudioController.StopAmbienceSound( 0.5f );
        //}

        ypos += yposOff;

        bool musicPausedNew = GUI.Toggle(new Rect(20, ypos, buttonWidth, 30), musicPaused, "Pause All Audio");

        if (musicPausedNew != musicPaused)
        {
            musicPaused = musicPausedNew;

            if (musicPaused)
            {
                AudioController.PauseAll(0.1f);
            }
            else
            {
                AudioController.UnpauseAll(0.1f);
            }
        }


        ypos += 20;

        if (GUI.Button(new Rect(20, ypos, buttonWidth, 30), "Play Sound with random pitch"))
        {
            AudioController.Play("RandomPitchSound");
        }
        ypos += yposOff;

        if (GUI.Button(new Rect(20, ypos, buttonWidth, 30), "Play Sound with alternatives"))
        {
            AudioObject soundObj = AudioController.Play("AlternativeSound");
            if (soundObj != null)
            {
                soundObj.completelyPlayedDelegate = OnAudioCompleteleyPlayed;
            }
        }
        ypos += yposOff;

        if (GUI.Button(new Rect(20, ypos, buttonWidth, 30), "Play Both"))
        {
            AudioObject soundObj = AudioController.Play("RandomAndAlternativeSound");
            if (soundObj != null)
            {
                soundObj.completelyPlayedDelegate = OnAudioCompleteleyPlayed;
            }
        }
        ypos += yposOff;

        GUI.Label(new Rect(20, ypos, 100, 20), "Playlists: ");

        ypos += 20;

        playlistScrollPos = GUI.BeginScrollView(new Rect(20, ypos, buttonWidth, 100), playlistScrollPos,
                                                new Rect(0, 0, buttonWidth, 33f * AudioController.Instance.musicPlaylists.Length));

        for (int i = 0; i < AudioController.Instance.musicPlaylists.Length; ++i)
        {
            if (GUI.Button(new Rect(20, i * 33f, buttonWidth - 20, 30f), AudioController.Instance.musicPlaylists[i].name))
            {
                AudioController.SetCurrentMusicPlaylist(AudioController.Instance.musicPlaylists[i].name);
            }
        }

        ypos += 105;

        GUI.EndScrollView();

        if (GUI.Button(new Rect(20, ypos, buttonWidth, 30), "Play Music Playlist"))
        {
            AudioController.PlayMusicPlaylist();
        }

        ypos += yposOff;

        if (AudioController.IsPlaylistPlaying() && GUI.Button(new Rect(20, ypos, buttonWidth, 30), "Next Track on Playlist"))
        {
            AudioController.PlayNextMusicOnPlaylist();
        }

        ypos += 32;

        if (AudioController.IsPlaylistPlaying() && GUI.Button(new Rect(20, ypos, buttonWidth, 30), "Previous Track on Playlist"))
        {
            AudioController.PlayPreviousMusicOnPlaylist();
        }

        ypos += yposOff;
        AudioController.Instance.loopPlaylist = GUI.Toggle(new Rect(20, ypos, buttonWidth, 30), AudioController.Instance.loopPlaylist, "Loop Playlist");
        ypos += 20;
        AudioController.Instance.shufflePlaylist = GUI.Toggle(new Rect(20, ypos, buttonWidth, 30), AudioController.Instance.shufflePlaylist, "Shuffle Playlist ");
        ypos += 20;
        AudioController.Instance.soundMuted = GUI.Toggle(new Rect(20, ypos, buttonWidth, 30), AudioController.Instance.soundMuted, "Sound Muted");
    }
Esempio n. 33
0
 // Use this for initialization
 void Start()
 {
     controller = gameObject.GetComponent <AudioController>();
 }
Esempio n. 34
0
 void Awake()
 {
     Coisa           = GameObject.Find("AudioController");
     audioController = Coisa.GetComponent <AudioController>();
 }
Esempio n. 35
0
 void Awake()
 {
     audioController = GameObject.Find("DataController").GetComponent <AudioController>();
 }
    // Songs cheatsheet
    // this is sooo fragile, but time is short!
    // 0 = somber viola, starting song
    // 1 = renaissance strings, hopeful
    // 2 = duduk with orch, optimistic
    // 3 = sweeping sad, dark

    // Start is called before the first frame update
    void Start()
    {
        source          = GetComponent <AudioSource>();
        audioController = GetComponent <AudioController>();
        source.loop     = false;
    }
Esempio n. 37
0
 private void Start()
 {
     AudioController.PlayAudio(theme);
 }
Esempio n. 38
0
 private void Awake()
 {
     instance = this;
 }
Esempio n. 39
0
 public void onClickWorld()
 {
     GameController.GetInstance().OpenWorldScene();
     AudioController.PlaySound(AudioController.SOUND_button);
 }
Esempio n. 40
0
 // Start is called before the first frame update
 void Start()
 {
     audioController = GameObject.Find("AudioController").GetComponent <AudioController>();
 }
Esempio n. 41
0
 public void onShopClick()
 {
     DialogController.GetInstance().showShopPanel();
     AudioController.PlaySound(AudioController.SOUND_button);
 }
 // Use this for initialization
 void Start()
 {
     playerPosition = GameObject.Find("FirePoint");
     prefab = Resources.Load("RopeSegment", typeof(GameObject)) as GameObject;
     parent = new GameObject();
     parent.name = "Grappling Hook";
     ground_layers = 1 << LayerMask.NameToLayer("Cave");
     rope_layers = 1 << LayerMask.NameToLayer("Player");
     audioController = GameObject.Find ("Audio Delegate").GetComponent<AudioController>();
 }
Esempio n. 43
0
 public void onClickSetting()
 {
     DialogController.GetInstance().showSettingPanel();
     AudioController.PlaySound(AudioController.SOUND_button);
 }
Esempio n. 44
0
 void Awake()
 {
     AudioController = GetComponent <AudioController>();
 }
Esempio n. 45
0
 public void onClickFight()
 {
     GameController.GetInstance().BeginBattle();
     AudioController.PlaySound(AudioController.SOUND_button);
 }
 public void PlayTitle()
 {
     StartCoroutine(AudioController.FadeIn(titleMusic, 2f));
 }
Esempio n. 47
0
 public AudioCategory(AudioController audioController)
 {
     AudioController = audioController;
 }
Esempio n. 48
0
 void Start()
 {
     current     = this;
     audioSource = GetComponent <AudioSource>();
 }
Esempio n. 49
0
    void DrawGuiRightSide()
    {
        int ypos        = 50;
        int yposOff     = 35;
        int buttonWidth = 300;

        if (!wasCategoryAdded)
        {
            if (customAudioClip != null && GUI.Button(new Rect(Screen.width - (buttonWidth + 20), ypos, buttonWidth, 30), "Create new category with custom AudioClip"))
            {
                var category = AudioController.NewCategory("Custom Category");
                AudioController.AddToCategory(category, customAudioClip, "CustomAudioItem");
                wasClipAdded     = true;
                wasCategoryAdded = true;
            }
        }
        else
        {
            if (GUI.Button(new Rect(Screen.width - (buttonWidth + 20), ypos, buttonWidth, 30), "Play custom AudioClip"))
            {
                AudioController.Play("CustomAudioItem");
            }

            if (wasClipAdded)
            {
                ypos += yposOff;

                if (GUI.Button(new Rect(Screen.width - (buttonWidth + 20), ypos, buttonWidth, 30), "Remove custom AudioClip"))
                {
                    if (AudioController.RemoveAudioItem("CustomAudioItem"))
                    {
                        wasClipAdded = false;
                    }
                }
            }
        }

        ypos = 130;

#if !UNITY_AUDIO_FEATURES_4_1
        BeginDisabledGroup(true);
#endif

        if (GUI.Button(new Rect(Screen.width - (buttonWidth + 20), ypos, buttonWidth, 30), "Play gapless audio loop"))
        {
            var ao = AudioController.Play("GaplessLoopTest");
            if (ao)
            {
                ao.Stop(1, 4);
            }
            else
            {
                // this can happen if you press the button twice really quickly so the audio is skipped because of the "Min Time Between Play" setting
            }
        }
        ypos += yposOff;

        if (GUI.Button(new Rect(Screen.width - (buttonWidth + 20), ypos, buttonWidth, 30), "Play random loop sequence"))
        {
            AudioController.Play("RandomLoopSequence");
        }
        ypos += yposOff;

        if (GUI.Button(new Rect(Screen.width - (buttonWidth + 20), ypos, buttonWidth, 50), "Play intro-loop-outro sequence\ngatling gun"))
        {
            introLoopOutroAudio = new PoolableReference <AudioObject>(AudioController.Play("IntroLoopOutro_Gun"));
        }

        ypos += 20;
        ypos += yposOff;

        BeginDisabledGroup(!(introLoopOutroAudio != null && introLoopOutroAudio.Get() != null));

        if (GUI.Button(new Rect(Screen.width - (buttonWidth + 20), ypos, buttonWidth, 30), "Finish gatling gun sequence"))
        {
            introLoopOutroAudio.Get().FinishSequence();
        }

        EndDisabledGroup();

#if !UNITY_AUDIO_FEATURES_4_1
        EndDisabledGroup();
#endif
    }
Esempio n. 50
0
    void FixedUpdate()
    {
        //Si está muerto, el monstruo se para
        if (bIsDead)
        {
            _agent.velocity = Vector3.zero;
            return;
        }

        //Si el jugador está leyendo un diario o con el juego en pausa, el monstruo también se para
        if (_isreadingDiary._isReadingDiary)
        {
            _agent.velocity = Vector3.zero;
            return;
        }


        if (_paused._paused)
        {
            _agent.velocity = Vector3.zero;
            return;
        }


        _animator.SetFloat("SpeedMovement", _agent.velocity.magnitude);

        _agent.speed = CurrentVelocity;

        _agent.isStopped = !_bCanAttack;


        //Si el enemigo está en un punto de patrulla, se inmoviliza
        if (_animator.GetCurrentAnimatorStateInfo(0).normalizedTime < 1 &&
            (_animator.GetCurrentAnimatorStateInfo(0).IsName("Idle") &&
             _bIsIdling))
        {
            _agent.velocity = Vector3.zero;
        }


        if (_bIsValid)
        {
            bool bPursuitPlayer = false;

            //Calculo la distancia al player
            Vector3 directionToPlayer = _player.transform.position - _viewPoint.position;
            if (directionToPlayer.magnitude < _minDistanceSight)
            {
                Vector3 directionToPlayerClamp = directionToPlayer;
                //Calculo el ángulo al player
                if (Vector3.Angle(transform.forward, directionToPlayer) < _minAngleDetection * 2)
                {
                    int hits = Physics.RaycastNonAlloc(_viewPoint.position, directionToPlayerClamp, OutRaycastHit, _minDistanceSight);


                    for (int i = 0; i < hits; i++)
                    {
                        //Si es un obstáculo, ignora
                        RaycastHit target = OutRaycastHit[i];
                        if (target.transform.CompareTag("Occluder"))
                        {
                            break;
                        }

                        //Si es el player, ataca y persigue
                        if (target.transform.CompareTag("Player") ||
                            target.transform.CompareTag("Hands"))
                        {
                            _head.LookAt(_player.transform);
                            _hasSeenPlayer = true;
                            _animator.SetBool("bCombatMode", true);

                            if (_animator.GetBool("bCombatMode") &&
                                !_isPlayingCombatMusic)
                            {
                                _isPlayingBackgroundMusic = false;
                                _isPlayingCombatMusic     = true;
                                StartCoroutine(AudioController.FadeIn(_chaseMusic, 1f));
                            }

                            //Ataca
                            if (directionToPlayer.magnitude < _minDistanceAttack)
                            {
                                RotateTowards(_player.transform);

                                Attack();
                                _currentState = EState.Attacking;
                            }
                            //Persigue (no está dentro de la distancia de atacar)
                            else if (_bCanAttack)
                            {
                                bPursuitPlayer = true;
                                _currentState  = EState.Pursuit;
                                _agent.SetDestination(_player.transform.position);
                                _lastPlayerPosition = _player.transform.position;
                            }

                            _animator.SetBool("bCombatMode", true);
                            RotateTowards(_player.transform);
                            return;
                        }
                    }
                }
            }
            //Vuelve al estado de patrulla
            _currentState = EState.Patrol;
            _animator.SetBool("bCombatMode", false);



            //Va al último punto en el que ha visto al jugador y hace una animación Idle ahí (en rango de 3m)
            if (_hasSeenPlayer)
            {
                if (Vector3.Distance(_agent.nextPosition, _lastPlayerPosition) < 3.0f)
                {
                    _hasSeenPlayer = false;
                    _animator.SetTrigger("Idle");
                }
                else
                {
                    //Si no ha llegado, sigue andando
                    _agent.SetDestination(_lastPlayerPosition);
                }
            }

            // Si no lo ha visto, patrulla
            if (_animator.GetCurrentAnimatorStateInfo(0).normalizedTime > 0.9f &&
                _animator.GetCurrentAnimatorStateInfo(0).IsName("Idle"))
            {
                if (!bPursuitPlayer)
                {
                    //Si no ha visto al Player en el punto _lastPlayerPosition, se para la música de persecución y entra la de fondo, y continua su patrulla
                    if (!_hasSeenPlayer)
                    {
                        if (!_animator.GetBool("bCombatMode") &&
                            !_isPlayingBackgroundMusic)
                        {
                            _isPlayingBackgroundMusic = true;
                            _isPlayingCombatMusic     = false;
                            StartCoroutine(AudioController.FadeOut(_chaseMusic, 1f));
                            StartCoroutine(AudioController.FadeIn(_backgroundMusic, 1f));
                        }

                        _agent.SetDestination(_patrolPoints[_currentPathIndex].position);
                        Patrol();
                    }
                }
            }
        }
    }
Esempio n. 51
0
 public void OnEnable()
 {
     slider       = this.gameObject.GetComponent <Slider>();
     slider.value = AudioController.GetSoundVol(thistag);
 }
Esempio n. 52
0
 public void ChangePlayDevice(object source, EventArgs args)
 {
     ChangeDevice(AudioController.GetActivePlaybackDevices(), _playDevices);
 }
 private void Awake()
 {
     healthBehaviour = GetComponent <BossHealthBehaviour>();
     anim            = GetComponent <Animator>();
     audioController = GetComponentInChildren <AudioController>();
 }
Esempio n. 54
0
 public void ChangeRecordDevice(object source, EventArgs args)
 {
     ChangeDevice(AudioController.GetActiveRecordingDevices(), _inputDevices);
 }
Esempio n. 55
0
    void Awake()
    {
        spriteRenderer = GetComponent<SpriteRenderer>();
        if (spriteRenderer == null) {
            throw new MissingComponentException("Unable to find SpriteRenderer on Planet. The planet game object should have a sprite renderer for the planet texture.");
        }
        spriteCollider = GetComponent<CircleCollider2D>();
        if (spriteCollider == null) {
            throw new MissingComponentException("Unable to find SpriteCopllider on Planet. The planet game object should have a sprite renderer for the planet texture.");
        }

        glowTransform = this.transform.FindChild("Glow");
        if (glowTransform == null) {
            throw new MissingComponentException("Unable to find glow gameobject on Planet. The planet game object should have a child game object called 'Glow'");
        }
        glow = glowTransform.gameObject.GetComponent<SpriteRenderer>();
        if (glow == null) {
            throw new MissingComponentException("Unable to find glow sprite renderer on Planet. The planet game object should have a child game object called 'Glow and a sprite renderer attached to it.'");
        }

        spriteRenderer.transform.localScale = new Vector3(100, 100, 0);

        audioCon = AudioController.GetInstance();

        CurrentGlowScale = 0;
        GlowIsGrowing = true;
        planetUpdateEventSubscriptionToken = MessageHub.Subscribe<PlanetUpdateEvent>((PlanetUpdateEvent evt) => UpdateGraphicalRepresentation());
        setPlanetSignToken = MessageHub.Subscribe<SetPlanetSignEvent>(SetPlanetSign);
    }
Esempio n. 56
0
 public override void OnSkipEnter()
 {
     StopAllCoroutines();
     CorePlaySceneManager.bossEnterFinishEvent.Invoke();
     AudioController.StopCategory("Boss00");
 }
Esempio n. 57
0
 // Use this for initialization
 void Start()
 {
     controller    = GameObject.Find("AudioController").GetComponent <AudioController>();
     _slider.value = controller.sfxVolume;
     _slider.onValueChanged.AddListener(delegate { controller.changeSfx(_slider.value); });
 }
Esempio n. 58
0
 private async void LoadAudioAsync()
 {
     MyController = await SettingsSingleton.Instance.LoadAudioAsync();
 }
 void Awake()
 {
     Instance = this;
     bank     = GetComponent <SoundBank>();
 }
Esempio n. 60
0
 public void onFishbuttonClick()
 {
     DialogController.GetInstance().showFishEggsInfoPanel();
     AudioController.PlaySound(AudioController.SOUND_button);
 }