Ejemplo n.º 1
0
 public void currentState(GameState state)
 {
     if (this.state != state)
     {
         bool isLoop        = (state == GameState.anim_idle || state == GameState.anim_walk || state == GameState.anim_run || state == GameState.anim_attackidle);
         bool lastIsLoop    = (this.state == GameState.anim_idle || this.state == GameState.anim_walk || this.state == GameState.anim_run || this.state == GameState.anim_attackidle);
         bool isAttackState = (state == GameState.anim_attack1 || state == GameState.anim_attack2 || state == GameState.anim_attack3);
         if (!lastIsLoop)
         {
             if (model.isAnimated())
             {
                 model.playClip((short)state, isLoop);
                 this.state = state;
             }
         }
         else
         {
             model.playClip((short)state, isLoop);
             this.state = state;
         }
         if (isAttackState)
         {
             model.playClip((short)state, isLoop);
             this.state = state;
             if (model != null)
             {
                 Random rand = new Random();
                 audioEmitter.Position = model._Position;
                 Cue cue = audioSystem.getSoundBank().GetCue("att-0." + rand.Next(1, 2));
                 cue.Apply3D(audioSystem.getAudioListener(), audioEmitter);
                 cue.Play();
             }
         }
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Allows the game to perform any initialization it needs to before starting to run.
 /// This is where it can query for any required services and load any non-graphic
 /// related content.  Calling base.Initialize will enumerate through any components
 /// and initialize them as well.
 /// </summary>
 protected override void Initialize()
 {
     // TODO: Add your initialization logic here
     base.Initialize();
     manager.Initialize();
     // Add Login window
     pageLogin = new GUILogin(manager, network, this);
     manager.Add(pageLogin);
     // Add Character selector window
     pageCharacterSelector = new GUICharacterSelector(manager, network, this);
     manager.Add(pageCharacterSelector);
     pageCharacterSelector.Visible = false;
     // Add Character creator window
     pageCharacterCreator = new GUICharacterCreator(manager, network, this, classConfigs);
     manager.Add(pageCharacterCreator);
     pageCharacterCreator.Visible = false;
     // Add Message dialog
     messageDialog = new GUIMessageDialog(manager, "", "");
     manager.Add(messageDialog);
     messageDialog.Visible = false;
     // game gui
     guiGameAttribute = new GUIGameAttribute(manager, network);
     manager.Add(guiGameAttribute);
     guiGameAttribute.Visible = false;
     guiGameInventory         = new GUIGameInventory(manager, network, Content, graphics, config.getItemList());
     manager.Add(guiGameInventory);
     guiGameInventory.Visible = false;
     guiGameEquipment         = new GUIGameEquipment(manager, network, Content, graphics, config.getItemList());
     manager.Add(guiGameEquipment);
     guiGameEquipment.Visible = false;
     guiGameChat = new GUIGameChat(manager, network);
     manager.Add(guiGameChat);
     guiGameChat.Visible = false;
     guiGameMenu         = new GUIGameMenu(manager, network, gameHandler, this);
     manager.Add(guiGameMenu);
     guiGameMenu.Visible = false;
     guiGameNPC          = new GUIGameNPC(manager, network, Content, config.getDialogList());
     manager.Add(guiGameNPC);
     guiGameNPC.Visible = false;
     guiGameEnvironment = new GUIGameEnvironment(manager, guiGameAttribute, null, guiGameEquipment, guiGameInventory, guiGameMenu);
     manager.Add(guiGameEnvironment);
     guiGameEnvironment.Visible = false;
     // Init Inventory & Equipment System
     guiGameInventory.init(guiGameEquipment);
     guiGameEquipment.init(guiGameInventory);
     // Shadow map
     //shadow.Initialize();
     // SFX
     audioSystem.Initialize();
     // BGM
     cue = audioSystem.getSoundBank().GetCue("01");
     cue.Play();
     //Debug.WriteLine("Initialized");
 }