private void Awake()
 {
     _pickUp = GetComponent <ParticleSystem>();
     _colliderToDeactivate = GetComponent <Collider>();
     _gameAudio            = FindObjectOfType <GameAudio>();
     EnableObject();
 }
 private void Awake()
 {
     _playerShipScript = _playerShip.GetComponent <PlayerShip>();
     _spawnObjects     = GetComponent <SpawnObjects>();
     _gameAudio        = GetComponent <GameAudio>();
     _uiController     = FindObjectOfType <UIController>();
 }
Example #3
0
 private void OnStartDialogEnd()
 {
     GameTimer.StartDecreasingTimerEvent(timeToSupportInSeconds, OnTimerEnd);
     GameAudio.StartAudiosEvent(audioClips, 0.12f, false);
     playerController.SetLockControl(false);
     isBattle = true;
 }
Example #4
0
        void Start()
        {
            if (s_Singleton == null)
            {
                s_Singleton = this;
            }
            else
            {
                if (s_Singleton != this)
                {
                    Destroy(gameObject);
                }
            }
            _lobbyHooks  = GetComponent <Prototype.NetworkLobby.LobbyHook>();
            currentPanel = mainMenuPanel;

            backButton.gameObject.SetActive(false);
            GetComponent <Canvas>().enabled = true;

            DontDestroyOnLoad(gameObject);

            SetServerInfo("Offline", "None");

            Audio = GetComponent <GameAudio>();
        }
Example #5
0
    void OnClick()
    {
        GameAudio.PlayEffect(GameAudioEffects.audio_effect_ui_button_1);
        Messenger <GameObject> .Broadcast(ButtonEvents.EVENT_BUTTON_CLICK_OBJECT, gameObject);

        //Messenger<string>.Broadcast(ButtonEvents.EVENT_BUTTON_CLICK, transform.name);
    }
Example #6
0
    private void Awake()
    {
        _laserTrans = _laserContainer.GetComponent <Transform>();
        _gameAudio  = FindObjectOfType <GameAudio>();

        _offset = this.transform.position - _laserTrans.position;
    }
Example #7
0
    public virtual void playSoundType(string type)
    {
        // play sound by world, level or character if overidden
        // TODO custom overrides

        if (playSoundTypeTimes == null)
        {
            playSoundTypeTimes = new Dictionary <string, float>();
        }

        foreach (GameDataSound sound in GetSounds(type))
        {
            float lastPlayed = 0f;

            if (playSoundTypeTimes.ContainsKey(sound.code))
            {
                lastPlayed = playSoundTypeTimes.Get(sound.code);
            }

            if (lastPlayed + sound.play_delay < Time.time)
            {
                GameAudio.PlayEffect(
                    sound.code,
                    GameProfiles.Current.GetAudioEffectsVolume() * sound.modifier,
                    sound.isPlayTypeLoop);

                playSoundTypeTimes.Set(sound.code, Time.time);
            }
        }
    }
Example #8
0
    private void Start()
    {
        systemStarships.InitializeStarshipsTeams(GetComponent <StarshipsSpawnMover>().MoveStarshipsOnSpawns());

        GameAudio.StartAudioEvent(audioClip, 0.4f, true);
        if (!StaticSettings.isRestart)
        {
            SetGameStop(true);
            GameDialogs.StartDialogEvent(StartGame);
        }
        else
        {
            GameGoals.SetActiveGoalEvent(true);
            StaticSettings.isRestart = false;
            systemStarships.SetStarshipsLock(false);
            systemStarships.SetStarshipsLock(1, true);
            GameDialogs.ShowInGameDialogEvent(0);
        }
        systemStarships.SetStarshipsActive(2, false);
        systemStarships.SetStarshipsLock(2, true);
        systemStarships.SetStarshipsActive(3, false);
        systemStarships.SetStarshipsLock(3, true);
        systemStarships.StarshipsTeams[1].OnTeamDevastated += FirstWaveDead;
        systemStarships.StarshipsTeams[2].OnTeamDevastated += SecondWaveDead;
    }
Example #9
0
 private void Awake()
 {
     if (GameAudio.instance == null)
     {
         GameAudio.instance = this;
     }
 }
Example #10
0
 public void QueueNotification(GameNotificationItem notification)
 {
     notificationQueue.Enqueue(notification);
     LogUtil.Log("Notification Queue(" + notificationQueue.Count + ") Notification Added :" + notification.title);
     ProcessNotifications();
     GameAudio.PlayEffect(GameAudioEffects.audio_effect_ui_button_1);
 }
Example #11
0
    void Awake()
    {
        if (instance != null && instance != this)
        {
            this.GetComponent <AudioSource> ().Stop();
            if (instance.GetComponent <AudioSource>().clip != this.GetComponent <AudioSource>().clip)
            {
                instance.GetComponent <AudioSource> ().clip = this.GetComponent <AudioSource> ().clip;
                instance.GetComponent <AudioSource> ().Play();
            }
//			audioS.Stop ();
//			if (instance.audioS.clip != audioS.clip) {
//				instance.audioS.clip = audioS.clip;
//				instance.audioS.Play ();
//			}
            Destroy(this.gameObject);
            return;
        }
        else
        {
            instance = this;
            instance.GetComponent <AudioSource> ().Play();
//			audioS.Play ();
        }
        DontDestroyOnLoad(this.gameObject);
    }
Example #12
0
    private IEnumerator Start()
    {
        systemStarships.InitializeStarshipsTeams(GetComponent <StarshipsSpawnMover>().MoveStarshipsOnSpawns());

        GameAudio.StartAudioEvent(audioClip, 0.125f, true);
        if (!StaticSettings.isRestart)
        {
            playerController.SetLockControl(true);
            playerCamera.SetLockMove(false);
            systemStarships.SetStarshipsLock(true);

            MoverStartPlayer.ToStartPosition(playerStarship);

            playerCamera.SetPositionWithOffset(PlayerStarshipTr.position);

            playerController.SetActiveCanvas(false);

            MoverStartZ2.Move(Z2Starship);

            Z5_Scene.SetActive(true);
            Z2_Scene.SetActive(true);
            Z5animator.SetFloat("Part(speed)", 1);

            yield return(MoverStartPlayer.IStarshipMove(playerStarship));


            cruiserAttack.StartAim();

            Z5Image.SetActive(true);
            Z2Image.SetActive(true);


            playerCamera.EnableTargetMove(cameraTarget);

            GameDialogs.StartDialogEvent(OnStartDialogEnd);
            GameDialogs.OnNextDialog += OnNextDialog;
        }
        else
        {
            GameGoals.SetActiveGoalEvent(true);

            StaticSettings.isRestart = false;

            systemStarships.SetStarshipsLock(false);

            MoverStartPlayer.ToEndPosition(playerStarship);
            MoverStartZ2.ToEndPosition(Z2Starship);

            Z2StarshipAI.SetTargetToFollowWithMaxDistance(PlayerStarshipTr);

            systemStarships.SetStarshipsFollowEnemy(true);

            cruiserAttack.StartAim();

            FrigateHealth.SetActive(true);

            cruiserAttack.StartAttack(OnBattleEnd);
            isBattle = true;
        }
    }
Example #13
0
        //static Color OddRowColor = new Color(250.0f / 255.0f, 250.0f / 255.0f, 250.0f / 255.0f, 1.0f);
        //static Color EvenRowColor = new Color(180.0f / 255.0f, 180.0f / 255.0f, 180.0f / 255.0f, 1.0f);


        public override void OnClientEnterLobby()
        {
            base.OnClientEnterLobby();

            if (LobbyManager.s_Singleton != null)
            {
                LobbyManager.s_Singleton.OnPlayersNumberModified(1);
            }

            LobbyPlayerList._instance.AddPlayer(this);
            LobbyPlayerList._instance.DisplayDirectServerWarning(isServer && LobbyManager.s_Singleton.matchMaker == null);

            if (isLocalPlayer)
            {
                SetupLocalPlayer();
            }
            else
            {
                SetupOtherPlayer();
            }

            //setup the player data on UI. The value are SyncVar so the player
            //will be created with the right value currently on server
            OnMyName(playerName);
            OnMyColor(playerColor);

            Audio = GetComponent <GameAudio>();
        }
Example #14
0
 private void Awake()
 {
     _gameController = FindObjectOfType <GameController>();
     _mesh           = GetComponent <MeshRenderer>();
     _collider       = GetComponent <Collider>();
     _gameAudio      = FindObjectOfType <GameAudio>();
 }
Example #15
0
    public static void PlayCustomOrDefaultEffect(string audioEffectName)
    {
        bool  hasCustomAudioItem = GameAudio.CheckIfEffectHasCustom(audioEffectName);
        float volume             = GetCurrentVolumeAdjust();

        PlayCustomOrDefaultEffect(audioEffectName, volume, hasCustomAudioItem);
    }
Example #16
0
    static int PlayAudio(IntPtr L)
    {
        int count = LuaDLL.lua_gettop(L);

        if (count == 2 && LuaScriptMgr.CheckTypes(L, 1, typeof(GameAudio), typeof(int)))
        {
            GameAudio obj  = LuaScriptMgr.GetNetObject <GameAudio>(L, 1);
            int       arg0 = (int)LuaScriptMgr.GetNumber(L, 2);
            obj.PlayAudio(arg0);
            return(0);
        }
        else if (count == 2 && LuaScriptMgr.CheckTypes(L, 1, typeof(GameAudio), typeof(AudioName)))
        {
            GameAudio obj  = LuaScriptMgr.GetNetObject <GameAudio>(L, 1);
            AudioName arg0 = LuaScriptMgr.GetNetObject <AudioName>(L, 2);
            obj.PlayAudio(arg0);
            return(0);
        }
        else
        {
            LuaDLL.luaL_error(L, "invalid arguments to method: GameAudio.PlayAudio");
        }

        return(0);
    }
Example #17
0
    public void play(AudioClip clip, double tick_time, double attack_time, double release_time, int midi_note_number = 60)
    {
        float pitch = midi_note_to_pitch(midi_note_number, Midi_Note_C4);

        int cnt = 0;

        while (sfx_audio_list[next_index].state != ASREnvelope.State.Idle)
        {
            if (cnt >= sfx_index)
            {
                GameObject audio_obj  = Instantiate(Prefab_GameAudio, transform);
                GameAudio  game_audio = audio_obj.GetComponent <GameAudio>();
                audio_obj.name         = "Sfx Game Audio - Destroy";
                game_audio.mixer_group = sfx_group;
                game_audio.play(clip, pitch, tick_time, attack_time, release_time, true);
                next_index = (next_index + 1) % sfx_audio_list.Count;
                return;
            }
            cnt++;
            next_index = (next_index + 1) % sfx_audio_list.Count;
        }

        sfx_audio_list[next_index].play(clip, pitch, tick_time, attack_time, release_time);
        next_index = (next_index + 1) % sfx_audio_list.Count;
    }
Example #18
0
 public void NextBar()
 {
     GameAudio.StopAudioEvent();
     StaticSettings.isCompleteSomething = true;
     Settings.OnSensitivityChanged     -= OnSensitivityChanged;
     SceneController.LoadNextStoryScene();
 }
Example #19
0
 private void Awake()
 {
     if (Instance != null)
     {
         Destroy(gameObject);
     }
     Instance = this;
 }
 private void Awake()
 {
     _gameController    = FindObjectOfType <GameController>();
     _asteroidExplosion = GetComponent <ParticleSystem>();
     _mesh      = GetComponent <MeshRenderer>();
     _collider  = GetComponent <Collider>();
     _gameAudio = FindObjectOfType <GameAudio>();
 }
Example #21
0
 public void StartBigWildSpawn()
 {
     if (GetComponent <GameAudio>() != null)
     {
         Audio = GetComponent <GameAudio>();
     }
     StartCoroutine(BigWildSpawn());
 }
Example #22
0
    static int InitBetAudios(IntPtr L)
    {
        LuaScriptMgr.CheckArgsCount(L, 1);
        GameAudio obj = LuaScriptMgr.GetNetObject <GameAudio>(L, 1);

        obj.InitBetAudios();
        return(0);
    }
Example #23
0
    void Start()
    {
        tower     = GetComponent <Tower>();
        intialHp  = tower.Hp;
        currentHp = intialHp;
        tower.onCollisionEnemy += OnTrigger;

        gameAudio = FindObjectOfType <GameAudio>();
    }
Example #24
0
 private void OpenMenu()
 {
     SetTimeScale(0);
     GameAudio.PauseAudioEvent();
     isMenuOpened = true;
     mainGameMenu.SetActive(true);
     GameCursor.SetCursorLock(false, CursorLockMode.None);
     OnMenuOpen?.Invoke();
 }
Example #25
0
 private void Awake()
 {
     if (instance == null)
     {
         instance            = this;
         sfxAudio.loop       = false;
         playerSfxAudio.loop = false;
     }
 }
Example #26
0
    private IEnumerator IEndEvent()
    {
        isEnd = true;
        playerController.SetLockControl(false);
        GameAudio.StopAudioEvent();
        Z2Health.Kill();
        yield return(new WaitForSeconds(timeToEnd));

        SceneController.LoadNextStoryScene();
    }
Example #27
0
    public void PlayGameAudio()
    {
        if (!gameLoopsStarted)
        {
            GameAudio.StartGameLoops();
        }

        //GameAudio.StopAmbience();
        //GameAudio.StartGameLoop(GameUIPanel.Instance.currentLevelNumber);
    }
	void Awake ()
	{
		if (mInst == null)
		{
			mInst = this;
			mTrans = transform;
			DontDestroyOnLoad(gameObject);
		}
		else Destroy(gameObject);
	}
Example #29
0
    void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }

        DontDestroyOnLoad(gameObject);

        //InitSoundVolume();
    }
    private void Awake()
    {
        _rb           = GetComponent <Rigidbody>();
        _gameAudio    = FindObjectOfType <GameAudio>();
        _uiController = FindObjectOfType <UIController>();
        _spawnObjects = FindObjectOfType <SpawnObjects>();

        _trailLeft.enabled  = false;
        _trailRight.enabled = false;
        _currentHeath       = _maxHealth;
    }
    public void Setup(GameManager setManager, GameAudio setGameAudio)
    {
        gameManager = setManager;

        Body playerBody = GetComponentInChildren <Body>();

        Debug.Assert(playerBody != null, "playerBody script is NULL");
        playerBody.Setup(setManager, this);

        gameAudio = setGameAudio;
    }
Example #32
0
 void Awake()
 {
     that = this;
 }