示例#1
0
    private void Start()
    {
        score    = FindObjectOfType <Score>();
        maxScore = score.Peek();

        text      = GetComponent <TextMesh>();
        text.text = "00000000"; // 8 digits

        dimmer = GameObject.Find("Dimmer").GetComponent <MeshRenderer>();

        audio = GetComponent <AudioSource> ();

        highscoreText = transform.GetChild(1).GetComponent <TextMesh>();

        particles = GetComponent <ParticleSystem>();

        var manager = FindObjectOfType <ScoreManager>();

        CmdGetLevel();
        manager.Load(level);
        highscore          = manager.GetScore(level);
        highscoreText.text = "HIGHSCORE: " + highscore;

        BackgroundMusic.OnScoreEnter();
    }
示例#2
0
    void resetDominosPositions()
    {
        if (this.allDominos.Count > 0)
        {
            foreach (GameObject domino in this.allDominos)
            {
                if (this.dominosRunning)
                {
                    domino.rigidbody.isKinematic = true;
                    Domino dominoAttributes = domino.GetComponent <Domino>();
                    dominoAttributes.hasCollided = false;
                    domino.transform.position    = dominoAttributes.originalPosition;
                    domino.transform.rotation    = dominoAttributes.originalRotation;
                }
                else
                {
                    domino.rigidbody.isKinematic = false;
                }
            }
            LevelPropertiesScript.sharedInstance().dominosFalling = false;
        }

        BackgroundMusic bm = this.GetComponent <BackgroundMusic>();

        bm.playGameMusic();
    }
示例#3
0
 public void ShowNextSection()
 {
     if (levelCount == 1)
     {
         Level1Player.GetComponent <PlayerMovement>().MovementEnabled = false;
         Level1Player.GetComponent <Rigidbody>().isKinematic          = true;
         SwitchSound.Play();
         Level2.SetActive(true);
         Level2Player.GetComponent <PlayerMovement>().MovementEnabled = true;
         levelCount++;
     }
     else if (levelCount == 2)
     {
         Level2Player.GetComponent <PlayerMovement>().MovementEnabled = false;
         SwitchSound.Play();
         Level3.SetActive(true);
         Level3Player.GetComponent <PlayerMovement>().MovementEnabled = true;
         levelCount++;
     }
     else
     {
         BaseCam.SetActive(true);
         BackgroundMusic.Stop();
         SceneManager.LoadScene("ZiedNextLevel", LoadSceneMode.Single);
     }
 }
示例#4
0
 // Use this for initialization
 void Start()
 {
     gameEngine      = gameEngineObject.GetComponent <GameEngine>();
     animator        = gameObject.GetComponent <Animator>();
     musicController = music.GetComponent <BackgroundMusic>();
     sfxController   = sfx.GetComponent <SoundEffects>();
 }
示例#5
0
    public void GameOver()
    {
        scoreText.text     = scoreText.text + string.Format("{0:0}", Score.score);
        highScoreText.text = highScoreText.text + string.Format("{0:0}", Score.highScore);

        gameOverMenu.SetActive(true);
        Time.timeScale = 0f;

        AudioSource audioSouce = FindObjectOfType <PlayerDeath>().GetComponent <AudioSource>();

        audioSouce.Stop();
        if (Score.score == Score.highScore)
        {
            audioSouce.clip = highScoreClip;
        }
        else
        {
            audioSouce.clip = gameOverClip;
        }
        BackgroundMusic bgMusic = FindObjectOfType <BackgroundMusic>();

        bgMusic.GetComponent <AudioSource>().volume = 0.2f;
        audioSouce.loop = true;
        audioSouce.Play();
    }
示例#6
0
    private void OnLevelFinishedLoading(Scene scene, LoadSceneMode mode)
    {
        i = 0;
        if (stIndexes[scene.buildIndex] != stIndex)
        {
            stIndex = stIndexes[scene.buildIndex];
            BackgroundMusic.clip = soundtracks[stIndex];
            BackgroundMusic.Play();
        }

        insts = new Dictionary <int, GPGSyncInstance>();

        if (scene.buildIndex > 1)
        {
            //CreatePlayers();
            if (!singlplayer)
            {
                pcs.Clear();
                CreateLocalPlayer();
            }
            else
            {
                Transform spawn = GameObject.Find(Gateway).transform;
                Vector3   pos   = spawn != null ? spawn.position : new Vector3();
                Instantiate(playerPrefab, pos, Quaternion.identity);
            }
        }
    }
示例#7
0
文件: Loader.cs 项目: wt616/JxqyHD
        /// <summary>
        /// Load game from "save/game" directory
        /// GuiManager must started first
        /// </summary>
        public static void LoadGame(bool isInitlizeGame)
        {
            if (isInitlizeGame)
            {
                //Clear
                ScriptManager.Clear();
                ScriptExecuter.Init();
                MagicManager.Clear();
                NpcManager.ClearAllNpc();
                ObjManager.ClearAllObjAndFileName();
                Globals.TheMap.Free();
                GuiManager.CloseTimeLimit();
                GuiManager.EndDialog();
                BackgroundMusic.Stop();
                Globals.IsInputDisabled = false;
            }

            LoadGameFile();
            LoadMagicGoodMemoList();
            LoadPlayer();
            //Apply xiulian magic to player
            Globals.ThePlayer.XiuLianMagic = MagicListManager.GetItemInfo(
                MagicListManager.XiuLianIndex);

            LoadPartner();
            LoadTraps();
            LoadTrapIgnoreList();

            Globals.TheCarmera.CenterPlayerInCamera();

            GameState.State = GameState.StateType.Playing;
            Globals.TheGame.IsGamePlayPaused = false;
            GuiManager.ShowAllPanels(false);
        }
示例#8
0
        public static void Begin_Clicked(object sender, EventArgs e)
        {
            EnabledSwitch(Form1.LeftField.CellField, false);

            if (MouseEvent.BeginArround)
            {
                MouseEvent.EndedArround();
            }

            BackgroundMusic.Stop();

            EndedGame = false;
            BeginGame(null, EventArgs.Empty);

            leftPlayer  = Form1.LeftPlayer;
            rightPlayer = Form1.RightPlayer;

            Side OneMove = (Side)random.Next(0, 2);

            if (OneMove == Side.Right)
            {
                Transfer_Move(leftPlayer, EventArgs.Empty);
            }
            else
            {
                Transfer_Move(rightPlayer, EventArgs.Empty);
            }

            EnabledSwitch(Form1.RightField.CellField, true);
        }
    public void PlayBackgroundMusic(BackgroundMusic bGM)
    {
        if (m_BackgroundSource.isPlaying)
        {
            m_BackgroundSource.Stop();
        }
        else
        {
            switch (bGM)
            {
            case BackgroundMusic.BGMSPOOPY:
                m_BackgroundSource.clip = m_BackGroundSpoops;
                m_BackgroundSource.Play();
                break;

            case BackgroundMusic.BGMTRIBAL:
                m_BackgroundSource.clip = m_BackGroundTribal;
                m_BackgroundSource.Play();
                break;

            default:
                Debug.Log("BGM: Nothing playing");
                break;
            }
            m_BackgroundSource.loop = true;
        }
    }
示例#10
0
    void Start()
    {
        BackgroundMusic.SetBackgroundMusic(music);
        Color color = Color.white;

        switch (LevelLoader.currentPackName)
        {
        case "Easy":
            color = new Color(0.757f, 1f, 0.588f);
            break;

        case "Hard":
            color = new Color(0.976f, 0.275f, 0.275f);
            break;
        }
        foreach (Image image in backImages)
        {
            image.color = color;
        }
        background.color = color;
        currentTime      = LevelLoader.currentLevelData.levelTime;
        Util.GenerateField(LevelLoader.currentLevelData, emptyElementField, GenerationCallback);
        elements = FindObjectsOfType <ElementField>();
        UpdateField(true);
        begin = false;
    }
示例#11
0
    /// <summary>
    /// Play a background music. NOTE: only one background music can be played at a time.
    /// </summary>
    /// <param name="forScene">Play the defaultbackgroundmusic for this level, if there's one</param>
    public void PlayBackGroundMusic(string forScene)
    {
        BackgroundMusic music = BackgroundMusics.Find(m => m.ForScenes.Contains(forScene));

        if (music == null)
        {
            if (_CurrentBackgroundMusic != null)
            {
                _BGMusic.GetComponent <AudioSource>().Stop();
            }

            Debug.LogWarning("[AudioManager] No background music found for scene [" + forScene + "] stopping the music!");

            _CurrentBackgroundMusic = null;
            return;
        }

        if (_CurrentBackgroundMusic != null && _CurrentBackgroundMusic.ForScenes.Contains(forScene))
        {
            Debug.Log("[AudioManager] Already playing the background music for scene [" + forScene + "]");
            return;
        }


        PlayBackGroundMusic(music);
    }
示例#12
0
    void Start()
    {
        if (MainInstance != null)
        {
            Destroy(gameObject);
            return;
        }
        MainInstance = this;
        DontDestroyOnLoad(gameObject);

        primary      = gameObject.AddComponent <AudioSource> ();
        primary.loop = true;
        if (mixer != null)
        {
            primary.outputAudioMixerGroup = mixer;
        }

        secondary      = gameObject.AddComponent <AudioSource> ();
        secondary.loop = true;
        if (mixer != null)
        {
            secondary.outputAudioMixerGroup = mixer;
        }

        primary.clip = primaryTrack;
    }
        private void Start()
        {
            _backgroundMusic = FindObjectOfType <BackgroundMusic>();

            // Получаем текущее значение звука
            Activity = PlayerPrefs.GetString("sounds") == "on";
        }
    // Update is called once per frame
    void Update()
    {
        if (target == null)
        {
            return;
        }

        BackgroundMusic.SetChasing(state == BidgeState.Chasing);

        switch (state)
        {
        case BidgeState.Chasing:
            Chase();
            break;

        case BidgeState.Wandering:
            Wander();
            break;
        }

        if (m_DeaggroTimer > 0.0f)
        {
            m_DeaggroTimer -= Time.deltaTime;
        }
    }
示例#15
0
 // Use this for initialization
 void Start()
 {
     instance = this;
     source   = GetComponent <AudioSource>();
     DontDestroyOnLoad(gameObject);
     SceneManager.LoadScene("MainMenu");
 }
示例#16
0
文件: Setting.cs 项目: zy1911/JxqyHD
        public Setting()
        {
            InitializeComponent();

            _toolTip.SetToolTip(_lblMaxMagicUnit, "限制能同时存在的最大武功单位个数\n比如一个球是一个武功单位,限制最多200\n则如果当前有200个武功单位,就不能再增加武功单位,即此时释放武功等于没释放武功");

            Globals.LoadSetting();

            _windowMode.Checked = !Globals.IsFullScreen;

            _collection = GraphicsAdapter.DefaultAdapter.SupportedDisplayModes.ToList();
            for (var i = 0; i < _collection.Count; i++)
            {
                var mode = _collection[i];
                _resolutionList.Items.Add(mode.Width + " x " + mode.Height);
                if (mode.Width == Globals.WindowWidth &&
                    mode.Height == Globals.WindowHeight)
                {
                    _resolutionList.SelectedIndex = i;
                }
            }

            _soundEffectVolume.Value = (int)(SoundEffect.MasterVolume * 100);
            _musicVolume.Value       = (int)(BackgroundMusic.GetVolume() * 100);
            _maxMagicUintCtl.Value   = MagicManager.MaxMagicUnit;
            _runSpeed.Value          = Globals.RunSpeedFold;
            UpdateLabelText();
            CenterToScreen();
        }
示例#17
0
 public void ChangeBackgroundMusic(BackgroundMusic music)
 {
     audioSource.Stop();
     audioSource.clip = backgroundMusic[(int)music];
     audioSource.loop = true;
     audioSource.Play();
 }
示例#18
0
 private void Awake()
 {
     if (backgroundMusic == null)
     {
         backgroundMusic = this;
     }                                                        // Be the one
 }
示例#19
0
    public override void SceneStart(Singleton instance)
    {
        // Check if we've already retrieve the settings
        if (settings != null)
        {
            // If so, don't do anything
            return;
        }

        // Retrieve settings
        settings      = Singleton.Get <GameSettings>();
        musicSettings = Singleton.Get <BackgroundMusic>();

        // Setup controls
        inSetupMode = true;
        musicControls.Setup(musicSettings.Volume, musicSettings.IsMuted);
        soundEffectsControls.Setup(SoundEffect.GlobalVolume, SoundEffect.GlobalMute);
        inSetupMode = false;

        // Setup update function
        if (updateAction != null)
        {
            instance.OnUpdate -= updateAction;
            updateAction       = null;
        }
        updateAction       = new System.Action <float>(UpdateOptions);
        instance.OnUpdate += updateAction;
    }
    public void PlayBackgroundMusic(BackgroundMusic bGM)
    {

        if (m_BackgroundSource.isPlaying)
        {
            m_BackgroundSource.Stop();
        }
        else
        {
            switch (bGM)
            {
                case BackgroundMusic.BGMSPOOPY:
                    m_BackgroundSource.clip = m_BackGroundSpoops;
                    m_BackgroundSource.Play();
                    break;

                case BackgroundMusic.BGMTRIBAL:
                    m_BackgroundSource.clip = m_BackGroundTribal;
                    m_BackgroundSource.Play();
                    break;

                default:
                    Debug.Log("BGM: Nothing playing");
                    break;
            }
            m_BackgroundSource.loop = true;

        }

    }
 public void RestartGame()
 {
     backgroundMusic            = Object.FindObjectOfType <BackgroundMusic>();
     backgroundMusic.acikMi     = false;
     gamaManagerSc.remaningLife = 3;
     SceneManager.LoadScene("GameLevel");
 }
示例#22
0
文件: Program.cs 项目: mwawerHub/Pong
        private static void Main(string[] args)
        {
            try {
                var bgMusic = new BackgroundMusic();
                bgMusic.Play();

                Initialize.InitializeGame();
                while (true)
                {
                    Thread.Sleep(10);
                    var key = (Console.KeyAvailable) ? Console.ReadKey(true).Key : 0;
                    Update.UpdateAll(key);
                    if (State.ScreenNeedsRedraw)
                    {
                        Console.Clear();
                    }
                    Draw.DrawAll();
                    State.ScreenNeedsRedraw = false;
                    State.PlayerNeedsRedraw = false;
                    State.BallNeedsRedraw   = false;
                }
            }
            catch (Exception e) {
                Console.WriteLine(e);
                throw;
            }
        }
 public override void OnMouseDown()
 {
     bgMusic = FindObjectOfType <BackgroundMusic>();
     spriteRenderer.sprite = selectedSprite;
     Invoke("flashes", 0.3f);
     musicToggle.musicChanged();
     bgMusic.change_music();
 }
示例#24
0
 // Use this for initialization
 void Awake()
 {
     if (mInst == null)
     {
         mInst = this;
     }
     creatorPosition = new Rect(Screen.width - creator.width, Screen.height - creator.height, creator.width, creator.height);
 }
示例#25
0
 void Awake()
 {
     animator = GetComponent <Animator>();
     BackgroundMusic.SetBackgroundMusic(music);
     GameProgress.Init();
     Options.Init();
     isLoaded = true;
 }
示例#26
0
 /// <summary>
 /// Changes the background music track.
 /// </summary>
 /// <param name="track">The new background track to play.</param>
 public static void PlayBGM(BackgroundMusic track)
 {
     if (instance != null)
     {
         StopBGM();
         instance.bgmSource.clip = instance.bgmClips[track];
         instance.bgmSource.Play();
     }
 }
示例#27
0
	void Awake() {
		if (instance != null && instance != this) {
			Destroy(this.gameObject);
			return;
		} else {
			instance = this;
			DontDestroyOnLoad(this.gameObject);
		}
	}
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
         instance.GetComponent <AudioSource>().Play();
     }
     DontDestroyOnLoad(instance.gameObject);
 }
示例#29
0
 void Start()
 {
     BackgroundMusic.SetBackgroundMusic(music);
     for (int i = 0; i < buttons.Capacity; i++)
     {
         buttons[i].sprite = inactiveLevelSprite;
     }
     ChoosePack("Easy");
 }
 /// <summary>Plays the given clip.</summary>
 public static void Play(AudioClip clip)
 {
     if (Current == null)
     {
         // It's not been setup yet - create it now:
         Current = new BackgroundMusic();
     }
     // E.g. Current.Source.Play(clip);
 }
示例#31
0
 public void ContinueMoving()
 {
     moving = true;
     if (particles.isPlaying)
     {
         particles.Stop();
     }
     BackgroundMusic.OnScoreExit();
 }
示例#32
0
    // Use this for initialization
    void Start()
    {
        GameObject audioManager = GameObject.FindWithTag("AudioManager");

        if (audioManager != null)
        {
            backgroundMusic = audioManager.GetComponent <BackgroundMusic> ();
        }
    }
示例#33
0
 private void OnEnable()
 {
     Instance  = this;
     isPlaying = false;
     if (source.isPlaying)
     {
         source.Stop();
     }
     source.clip = targetClip = null;
 }
示例#34
0
 void Awake()
 {
     if(instance != null && instance != this)
     {
             Destroy (gameObject);
     }
     else
     {
             instance = this;
     }
     DontDestroyOnLoad(gameObject);
 }
示例#35
0
	// Use this for initialization
	void Awake()
    {
        if(_instance == null)
        {
            _instance = this;
            DontDestroyOnLoad(gameObject);
        }
        else
        {
            Destroy(gameObject);
        }
    }
示例#36
0
 void Awake()
 {
     if (bgMusic == null)
     {
         DontDestroyOnLoad(gameObject);
         bgMusic = this;
     }
     else if (bgMusic != this)
     {
         Destroy(gameObject);
     }
 }
示例#37
0
 void Awake()
 {
     if( OnlyOneInstance)
     {
         DestroyImmediate(gameObject);
     }
     else
     {
         DontDestroyOnLoad(transform.gameObject);
         OnlyOneInstance = this;
     }
 }
示例#38
0
	void Awake()
	{
		/* Checks if their is already background music. */
		if (instance != null && instance != this)
		{
			Destroy (this.gameObject);
			return;
		}
		else
		{
			instance = this;
		}

		/* Does not destroy the music when the scene changes. */
		DontDestroyOnLoad (this.gameObject);
	}
示例#39
0
 void OnLevelWasLoaded(int level)
 {
     if(GameObject.FindGameObjectsWithTag(gameObject.tag).Length > 1)
     {
         if(mInst != this)
         {
             if(mInst != null && mInst.liveScene == level)
             {
                 Destroy(gameObject);
             }
             else if(liveScene == level && mInst != null)
             {
                 Destroy(mInst.gameObject);
                 mInst = this;
             }
             else
             {
                 Destroy(gameObject);
             }
         }
     }
 }
示例#40
0
    void Awake()
    {
        if (instance != null)
        {
            if (this.GetComponent<AudioSource>().clip == instance.GetComponent<AudioSource>().clip)
            {
                Destroy(this.gameObject);
                return;
            }
            else
            {
                Destroy(instance.gameObject);
                instance = this;
            }
        }
        else
        {
            instance = this;
        }

        DontDestroyOnLoad(this.gameObject);
    }
示例#41
0
 public void Play(BackgroundMusic type)
 {
     _backgroundMusic?.Dispose();
     try
     {
         switch (type)
         {
             case BackgroundMusic.Exploration:
                 _wfr = new WaveFileReader(Properties.Resources.Exploration);
                 break;
             default:
                 throw new Exception("Not expected audioType.");
         }
         LoopStream loop = new LoopStream(_wfr);
         _backgroundMusic = new WaveOut();
         _backgroundMusic.Init(loop);
         _backgroundMusic.Volume = 0.5F;
         _backgroundMusic.Play();
     }
     catch(Exception ex)
     {
         Console.WriteLine(ex.ToString());
     }
 }
示例#42
0
 void OnDestroy()
 {
     if (mInst == this)
         mInst = null;
 }
        private void ProjectOpened(object sender, ProjectOpenedEventArgs e)
        {
            MaxTrack = 0;

            if (e.Project.MusicNsf != null)
            {
                bgm = new BackgroundMusic(AudioContainer.LoadContainer(e.Project.MusicNsf));
                AudioManager.Instance.LoadBackgroundMusic(bgm);
                MaxTrack = bgm.AudioContainer.TrackCount;
            }

            OnPropertyChanged("MaxTrack");
        }
示例#44
0
 public void LoadMusicNSF(string path)
 {
     bgm = new BackgroundMusic(AudioContainer.LoadContainer(path));
     AudioManager.Instance.LoadBackgroundMusic(bgm);
 }
        public override void Load()
        {
            MathUtil.Init((float)DefaultSettings.Settings["PixelsPerMeter"]);
            Size = ((Vector2)(Size)Utilities.DefaultSettings.Settings["WindowSize"]) / MathUtil.PixelsPerMeter;

            PhysicsManager = new PhysicsEngine();
            UIManager = new UIEngine();
            _backGroundMusic = new BackgroundMusic();
            GraphicsEngine.Load();

            FPSCounter = new FPSManager();

            InitGame();
               // InitPhysicsEngine(); <- happens in initGame by map
            InitUI();
        }
示例#46
0
    public static void PlayBackgroundMusic(BackgroundMusic bgm)
    {
        // If a BGM is playing, stop the previous
        if (currentBGM)
        {
            currentBGM.Stop();
            currentBGM = null;
        }

        // Set the new BGM as the current
        currentBGM = bgmList[(int)bgm];
        currentBGM.Play();
    }