Esempio n. 1
0
 public void ChangeAnimation(BattlerAnimType at)
 {
     if (Animations.ContainsKey(at))
     {
         Sprite.ChangeTexture2D(Animations[at], true);
         if (at != BattlerAnimType.Idle || at != BattlerAnimType.Injured)
         {
             Sprite.ChangeLooping(false);
         }
         if (at == BattlerAnimType.Attack || at == BattlerAnimType.CastSpell || at == BattlerAnimType.UseItem)
         {
             Sprite.SetInterval(100);
         }
         if (at == BattlerAnimType.Idle)
         {
             for (int i = 0; i < BattleStats.Modifiers.Count; i++)
             {
                 for (int e = 0; e < BattleStats.Modifiers[i].effects.Count; e++)
                 {
                     if (BattleStats.Modifiers[i].effects[e] is PlayInjuredAnimWhileIdle)
                     {
                         var playAnim = (PlayInjuredAnimWhileIdle)BattleStats.Modifiers[i].effects[e];
                         if (BattleStats.Modifiers.Contains(playAnim.Modifier))
                         {
                             if (Animations.ContainsKey(BattlerAnimType.Injured))
                             {
                                 Sprite.ChangeTexture2D(Animations[BattlerAnimType.Injured], true);
                                 Sprite.SetInterval(140);
                                 currentAnim = at;
                                 return;
                             }
                         }
                     }
                 }
             }
             Sprite.SetInterval(140);
         }
         else
         {
             Sprite.ChangeLooping(true);
         }
         currentAnim = at;
     }
     if (at == BattlerAnimType.Injured && !Animations.ContainsKey(BattlerAnimType.Injured))
     {
         Sprite.ChangeTexture2D(Animations[BattlerAnimType.Idle], true);
         Sprite.ChangeLooping(true);
     }
 }
Esempio n. 2
0
 public void PlaySound(Random random, Audio audio, BattlerAnimType at)
 {
     if (Sounds.ContainsKey(at))
     {
         float pan = 0f;
         if (BattleStats.team == Team.Player)
         {
             pan = -0.5f;
         }
         else
         {
             pan = 0.5f;
         }
         var sounds = Sounds[at].Split('|');
         audio.PlaySound(sounds[random.Next(0, sounds.Length)], true, pan);
     }
 }
Esempio n. 3
0
 public BattleAction(string name, Direction dir, TargetType targ, int man, string t, string[] g, Point[] SpriteSizes, int[] SpriteSpeeds, ActionFXType afx, BattlerAnimType at, string[] sounds, string tag)
 {
     Name                = name;
     direction           = dir;
     type                = targ;
     IntText             = t;
     ManaCost            = man;
     actionSpriteEffects = g;
     actionSpriteSizes   = SpriteSizes;
     actionSpriteSpeeds  = SpriteSpeeds;
     fxType              = afx;
     animType            = at;
     this.sounds         = sounds;
     this.tag            = tag;
     if (this.tag == null)
     {
         this.tag = "";
     }
 }