Ejemplo n.º 1
0
        internal void OnEntityDeath(string EntityName)
        {
            UserObject us = MainWindowModelView.FineObjectByName(EntityName);

            us.IsAlive                      = false;
            InfoText.Text                   = EntityName + " Says: " + us.DeathText;
            InfoText.Visibility             = Visibility.Visible;
            MainWindowModelView.IsDeathText = true;
            DoubleAnimation doubleAnimation = new DoubleAnimation();

            doubleAnimation.Completed += (o, s) => { };
            doubleAnimation.From       = 1;
            doubleAnimation.To         = 0;
            doubleAnimation.Duration   = new Duration(new TimeSpan(0, 0, 0, 2));
            foreach (Image i in EnemyBox.Children)
            {
                if (i.Name.Equals(EntityName))
                {
                    i.BeginAnimation(OpacityProperty, doubleAnimation);
                    break;
                }
                else
                {
                    continue;
                }
            }
            foreach (Button button in EntitySelectionMenu.Children)
            {
                if (button.Name.Equals(us.ObjectName))
                {
                    EntitySelectionMenu.Children.Remove(button);
                    break;
                }
            }
        }
Ejemplo n.º 2
0
        public void Get_Students(object sender, RoutedEventArgs e)
        {
            TextBlock           textBlock = sender as TextBlock;
            MainWindowModelView model     = this.DataContext as MainWindowModelView;

            model.CurStudents    = new ObservableCollection <Student>((textBlock.DataContext as GroupWithStudents).Students);
            this.DataContext     = model;
            students.ItemsSource = model.CurStudents;
        }
Ejemplo n.º 3
0
        public MainWindow()
        {
            InitializeComponent();
            InitalizePanels();
            MainWindowModelView mainWindowModelView = new MainWindowModelView(this);

            SetUpHealth();
            LoadImages();
            mainPanel.Children.Add(SoundPlayer);
        }
Ejemplo n.º 4
0
        public App()
        {
            InitializeComponent();
            Settings.Init();
            var mainWindow    = new MainWindowView();
            var mainViewModel = new MainWindowModelView(mainWindow);

            Behaviors.Init(mainViewModel, (IBehavior)Settings.Instance);
            mainWindow.Init(mainViewModel);
            mainWindow.Show();
        }
Ejemplo n.º 5
0
        public void AttackHitPlayer(object sender, MouseEventArgs e)
        {
            Shape shape = (Shape)sender;

            shape.Visibility = Visibility.Hidden;
            UserObject us = MainWindowModelView.FineObjectByName(shape.Name);

            MainWindowModelView.UserHealth -= us.UserAttack;
            MainWindowModelView.DataRecorderObject.Write(us, DataRecorder.RecordType.TookDamageFromEntity, null);
            CurrentHP.Content = MainWindowModelView.UserHealth;
            if (MainWindowModelView.UserHealth <= 0)
            {
                MainWindowModelView.GameOverEndState = MainWindowModelView.EndState.PlayerLose;
            }
            shape.MouseEnter -= AttackHitPlayer;
        }
Ejemplo n.º 6
0
 public MainWindow()
 {
     InitializeComponent();
     Modelo           = new MainWindowModelView();
     this.DataContext = Modelo;
 }