public static void Activate(ActionTypes.ActionType actionType, BattleEngine battleEngine)
        {
            Character currentCharacter = battleEngine.Characters[TurnSystem.CurrentCharIndex];

            ActionGrid.Children.Clear();

            List <Action> actions = currentCharacter.CharacterStats.Actions
                                    .Where(action => action.ActionType == actionType).ToList();
            List <AnimatedButtonController> animatedButtonControllers = new List <AnimatedButtonController>();

            ActionGrid.Width = actions.Count * 40;
            int left = 0;

            actions.ForEach(action =>
            {
                AnimatedButton animatedButton = new AnimatedButton
                {
                    Width = 40,
                    HorizontalAlignment = HorizontalAlignment.Left,
                    Margin       = new Thickness(left, 0, 0, 0),
                    Button       = { Width = 40 },
                    Action       = action,
                    BattleEngine = battleEngine
                };
                animatedButton.Button.PreviewMouseDown += InitiateFight;
                animatedButtonControllers.Add(new AnimatedButtonController(action.Icon, animatedButton,
                                                                           action.ActionType, battleEngine));
                ActionGrid.Children.Add(animatedButton);
                left += 40;
            });
        }
Beispiel #2
0
        public SkillEffects(string gifEffectPath, BattleEngine battleEngine)
        {
            _gifEffectPath = gifEffectPath;
            _battleEngine  = battleEngine;
            _sendTrigger   = true;
            GifImage       = new Image
            {
                Margin              = new Thickness(0, 0, 0, 0),
                VerticalAlignment   = VerticalAlignment.Center,
                HorizontalAlignment = HorizontalAlignment.Center
            };
            string path = Path.Combine(Environment.CurrentDirectory, gifEffectPath);

            GifImage.IsHitTestVisible = false;
            GifImage.Stretch          = Stretch.UniformToFill;
            GifImage.Width            = 50;
            GifImage.Height           = 50;
            Panel.SetZIndex(GifImage, 2);
            ImageSource imageSource = new BitmapImage(new Uri(path));

            ImageBehavior.SetAnimatedSource(GifImage, imageSource);
            ImageBehavior.AddAnimationCompletedHandler(GifImage, AnimationCompletedEvent);
            ImageBehavior.SetRepeatBehavior(GifImage, new RepeatBehavior(1));
            Grid.SetRow(GifImage, 1);
            BattleEngine.WaitForAnimation = true;
            //_battleEngine.

            BattleEngine.BattleWindowUi.Grid.Children.Add(GifImage);
        }
 public AnimatedButtonController(ButtonStatesImages buttonStatesImages, AnimatedButton animatedButton, ActionTypes.ActionType actionType, BattleEngine battleEngine)
 {
     this.ButtonStatesImages   = buttonStatesImages;
     this.AnimatedButton       = animatedButton;
     this.ActionType           = actionType;
     AnimatedButton.ActionType = actionType;
     this.BattleEngine         = battleEngine;
     SetImageSourcesForAnimatedButton();
 }
Beispiel #4
0
 public Character(CharacterStats characterStats, CharacterTypes.Type type, BattleEngine battleEngine)
 {
     CharacterStats = characterStats;
     CharacterStats.CharacterParent = this;
     Status             = CharacterTypes.Status.Alive;
     Type               = type;
     BattleEngine       = battleEngine;
     CharacterUiControl = AvatarSpotsManager.GetSpot(Type);
     CharacterSetup();
     CharacterUiControl.AssignCharactersToUi(this);
 }
Beispiel #5
0
 public UIBackEnd(BattleEngine battleEngine)
 {
     _battleEngine = battleEngine;
 }