Exemplo n.º 1
0
 void ICmpInitializable.OnShutdown(Component.ShutdownContext context)
 {
     if (context == ShutdownContext.Deactivate)
     {
         if (instance == this)
         {
             instance = null;
             DualityApp.Keyboard.KeyDown -= this.Keyboard_KeyDown;
         }
     }
 }
Exemplo n.º 2
0
        void ICmpInitializable.OnInit(Component.InitContext context)
        {
            if (context == InitContext.Activate)
            {
                if (instance == null)
                {
                    instance = this;
                    DualityApp.Keyboard.KeyDown += this.Keyboard_KeyDown;

                    this.beginIntroTime = Time.GameTimer;

                    CommentGuy.Init(Scene.Current.AllObjects.FirstByName("Commentary").GetComponent<TextRenderer>());

                    // Play some music
                    SoundBudgetPad bgMusic = DualityApp.Sound.Music.Push(GameRes.Data.Music.tetrisloop_Sound, SoundBudgetPriority.Background, 0.0f);
                    bgMusic.Sound.Looped = true;

                    // Play some intro
                    if (this.FirstGameInSession) DualityApp.Sound.Music.Push(GameRes.Data.Music.tetrisintro_Sound, SoundBudgetPriority.Tension, 0.0f);
                }
            }
        }