public Map2()
        {
            this.InitializeComponent();
            ControllerGame.AdjustFullScreenMode(_Canvas, this);
            this.NavigationCacheMode = NavigationCacheMode.Enabled;

            Window.Current.CoreWindow.KeyDown += CoreWindow_KeyDown;
            Window.Current.CoreWindow.KeyUp   += CoreWindow_KeyUp;
            StartAnimation();
            SetCollision();
            SetEnemies();
            SetChests();
            AddImageOnList();

            Generator.ChestPopulate(ChestControl);

            WidthRatio  = _Canvas.Width / 800;
            HeightRatio = _Canvas.Height / 600;

            //Mob PablloVittar, Ninja, Salamander, Mouse, SecondMouse, Mimic;
            PablloVittar = Creator.CreateMob("PablloVittar");
            Ninja        = Creator.CreateMob("Ninja");
            Salamander_  = Creator.CreateMob("Salamander");
            Mouse        = Creator.CreateMob("Mouse");
            SecondMouse  = Creator.CreateMob("Mouse");
            Mimic        = Creator.CreateMob("Mimic");
        }
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            if (ControllerGame.CheckLastPage(typeof(Map), this))
            {
                Player         = e.Parameter as Character;
                Person1.Source = Player.IdleRight;
                MobAndChar.Add(Player);

                ControllerGame.RefreshItems(Player, qt_lifePot, qt_manaPot, ListInvetoryImage);
            }

            if (ControllerGame.CheckLastPage(typeof(BattleScreen), this))
            {
                MobAndChar = e.Parameter as List <Object>;
                Player     = MobAndChar.ElementAt(0) as Character;
                ControllerGame.RefreshItems(Player, qt_lifePot, qt_manaPot, ListInvetoryImage);
                Player.UpLevel += Player_UpLevel;

                if (MobAndChar.ElementAt(1) is Ninja)
                {
                    Ninja = MobAndChar.ElementAt(1) as Ninja;
                }
                else if (MobAndChar.ElementAt(1) is PablloVittar)
                {
                    PablloVittar = MobAndChar.ElementAt(1) as PablloVittar;
                }
                MobAndChar.RemoveAt(MobAndChar.Count - 1);
                //ControllerGame.PlaySoundsVitorHugo("CaioInimigosAFrente.mp4");
            }
            IsAnotherPage = false;
        }
Пример #3
0
 protected override void OnNavigatedTo(NavigationEventArgs e)
 {
     if (ControllerGame.CheckLastPage(typeof(BattleScreen), this))
     {
         Player        = e.Parameter as Character;
         img_dy.Source = Player.Dying;
     }
 }
        public MainPage()
        {
            ApplicationView.PreferredLaunchWindowingMode = ApplicationViewWindowingMode.FullScreen;
            this.InitializeComponent();
            ControllerGame.AdjustFullScreenMode(_Canvas, this);

            //ControllerGame.PlayMusic("1 Hora de Musicas de Cidades e Vilarejos de RPG.mp3");
        }
Пример #5
0
        public BattleScreen()
        {
            this.InitializeComponent();
            ControllerGame.AdjustFullScreenMode(_Canvas, this);
            heart_icon.Source = heart_stopped;
            WidthRatio        = _Canvas.Width / 800;
            HeightRatio       = _Canvas.Height / 600;

            _Canvas.Children.Remove(SkillBackground);
            InitialKnifePosition = 534 * WidthRatio;
        }
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            if (ControllerGame.CheckLastPage(typeof(SelecClass), this))
            {
                Player         = e.Parameter as Character;
                Person1.Source = Player.IdleRight;
                MobAndChar.Clear();
                Ninja2 = Creator.CreateMob("Ninja");//new Ninja();
                Ninja  = Creator.CreateMob("Ninja");;
                MobAndChar.Add(Player);
            }

            if (ControllerGame.CheckLastPage(typeof(BattleScreen), this))
            {
                MobAndChar = e.Parameter as List <Object>;

                Player = MobAndChar.ElementAt(0) as Character;

                Player.UpLevel += Player_UpLevel;

                if (MobAndChar.ElementAt(1) is Ninja)
                {
                    Ninja = MobAndChar.ElementAt(1) as Ninja;
                }
                else if (MobAndChar.ElementAt(1) is Ninja)
                {
                    Ninja2 = MobAndChar.ElementAt(1) as Ninja;
                }
                MobAndChar.RemoveAt(MobAndChar.Count - 1);
                SoundController.PlaySound(VoiceSound, "CaioInimigosAFrente.mp4");
            }

            if (ControllerGame.CheckLastPage(typeof(Map2), this))
            {
                Player         = e.Parameter as Character;
                Person1.Source = Player.IdleRight;
                MobAndChar.Clear();
                MobAndChar.Add(Player);
            }

            ControllerGame.RefreshItems(Player, qt_lifePot, qt_manaPot, ListInvetoryImage);
            IsAnotherPage = false;
        }
Пример #7
0
        public void CastSkill(int Button)
        {
            if (!ControllerGame.IsSkillHitting(CharacterSkill, Mob1))
            {
                Canvas.SetLeft(CharacterSkill, Canvas.GetLeft(CharacterSkill) + 45);
                AttackingAnimation(true);
            }


            else if (ControllerGame.IsSkillHitting(CharacterSkill, Mob1))
            {
                BattleController.CheckTurn(BattlePlayer, Mob_, Button);
                PaintDamageGiven(1);
                AttackingAnimation(false);
                Canvas.SetLeft(CharacterSkill, Canvas.GetLeft(Person1) + 82);
                CharacterSkill.Source = null;
                ChosenSkill           = null;
            }

            BattleController.FinishBattle(BattlePlayer, Mob_);
        }
Пример #8
0
        private async void DisplayEndedBattleDialog()
        {
            Debug.WriteLine("DEBUG AQUIIIII");
            ContentDialog BattleEnded = new ContentDialog
            {
                Title           = "FIM DA BATALHA",
                Content         = "Você venceu!!!",
                CloseButtonText = "Voltar ao mapa"
            };

            ContentDialogResult result = await BattleEnded.ShowAsync();

            UnsignPageEvents();

            if (ControllerGame.CheckLastPage(typeof(Map2), this))
            {
                this.Frame.Navigate(typeof(Map2), CharList);
            }
            else if (ControllerGame.CheckLastPage(typeof(Map), this))
            {
                this.Frame.Navigate(typeof(Map), CharList);
            }
        }
        public Map()
        {
            this.InitializeComponent();
            ControllerGame.AdjustFullScreenMode(_Canvas, this);

            Window.Current.CoreWindow.KeyDown += CoreWindow_KeyDown;
            Window.Current.CoreWindow.KeyUp   += CoreWindow_KeyUp;

            this.NavigationCacheMode = NavigationCacheMode.Enabled;

            StartAnimation();     //Startar a animação
            SetCollision();       //Inicialização das colisões pré-definidas
            SetChetsInMap();      //Inicialização dos baús pré-definidos
            AddImageOnList();     //Inicializa as imagens do Inventário do mapa em um List
            SetEnemiesPosition(); //Inicializa os inimigos
            SetKeyOnMap();

            Generator.ChestPopulate(ChestControl); //Método para gerar os itens randomicamente dentro do baú

            WidthRatio  = _Canvas.Width / 800;
            HeightRatio = _Canvas.Height / 600;

            SoundController.PlaySound(VoiceSound, "CaioAbraOBaivis.mp4");
        }
Пример #10
0
        private void MobAttackHandler(object sender, object e)
        {
            if (MobsDefeated)
            {
                return;
            }
            if (!ControllerGame.IsSkillHitting(Knife, Person1))
            {
                Canvas.SetLeft(Knife, Canvas.GetLeft(Knife) - 45);
            }

            else if (ControllerGame.IsSkillHitting(Knife, Person1))
            {
                Knife.Opacity = 0;
                Canvas.SetLeft(Knife, InitialKnifePosition);
                PaintDamageGiven(2);

                btnSkillBasic.IsEnabled = true;
                btnSkillOne.IsEnabled   = true;
                btnSkillTwo.IsEnabled   = true;
                AnimationEnabled        = false;
                MobAttackTimer.Stop();
            }
        }
Пример #11
0
        //Evento para sair da página e voltar ao mapa
        private void LeaveBtn_Tapped(object sender, TappedRoutedEventArgs e)
        {
            if (CharList.Count == 0)
            {
                CharList.Add(BattlePlayer);
                CharList.Add(Mob_);
            }
            else
            {
                CharList.Clear();
                CharList.Add(BattlePlayer);
                CharList.Add(Mob_);
            }

            UnsignPageEvents();
            if (ControllerGame.CheckLastPage(typeof(Map2), this))
            {
                this.Frame.Navigate(typeof(Map2), CharList);
            }
            else if (ControllerGame.CheckLastPage(typeof(Map), this))
            {
                this.Frame.Navigate(typeof(Map), CharList);
            }
        }
Пример #12
0
        public LosePage()
        {
            this.InitializeComponent();

            ControllerGame.AdjustFullScreenMode(_Canvas, this);
        }
        private void AnimationEvent(object sender, object e)
        {
            if (IsAnotherPage)
            {
                return;
            }

            PosY = Canvas.GetTop(Person1);  //Armazena a posição Y do personagem em uma variavel
            PosX = Canvas.GetLeft(Person1); //Armazena a posição X do personagem em uma variavel

            if (ControllerGame.IsMovimentAllowed(Player, Person1, LockedChests, Enemies, Collision, Keys))
            {
                if (YSpeed < 0 && PosY > 115 * HeightRatio)  //Movimento, checagem e animação para cima
                {
                    ControllerGame.MovePlayer(Person1, 0, YSpeed);
                    ControllerGame.PaintAnimation(Person1, Player, Right, Left, Up, Down);
                }

                if (YSpeed > 0 && PosY < 455 * HeightRatio) //Movimento, checagem e animação para baixo
                {
                    ControllerGame.MovePlayer(Person1, 0, YSpeed);
                    ControllerGame.PaintAnimation(Person1, Player, Right, Left, Up, Down);
                }

                if (XSpeed < 0 && PosX > 60 * WidthRatio) //Movimento, checagem e animação para esquerda
                {
                    ControllerGame.MovePlayer(Person1, XSpeed, 0);
                    ControllerGame.PaintAnimation(Person1, Player, Right, Left, Up, Down);
                }

                if (XSpeed > 0 && PosX < 690 * WidthRatio) //Movimento, checagem e animação para direita
                {
                    ControllerGame.MovePlayer(Person1, XSpeed, 0);
                    ControllerGame.PaintAnimation(Person1, Player, Right, Left, Up, Down);
                }
            }

            //Checa se o player está na frente do bau, para poder lootear
            else if (ControllerGame.CheckListCollision(Player, Person1, LockedChests))
            {
                foreach (Image Hit in LockedChests)
                {
                    if (ControllerGame.Collision(Person1, Hit) == "Bottom")
                    {
                        if (!ChestControl.isOpen)
                        {
                            ControllerGame.LootVault(Player, ChestControl, qt_lifePot, qt_manaPot, ListInvetoryImage);
                            open_chest.Source = new BitmapImage(new Uri(@"ms-appx:///Assets/open_chest3.png"));
                        }
                    }
                }
            }

            if (ControllerGame.CheckCollision(Player, Person1, Enemies.Find(x => x.Name == "OpenedChest")) && !Mimic.IsDead())
            {
                if (MobAndChar.Count >= 2)
                {
                    MobAndChar.RemoveAt(MobAndChar.Count - 1);
                }
                StoreChars(Mimic as Mob);
                IsAnotherPage = true;
                this.Frame.Navigate(typeof(BattleScreen), MobAndChar);
            }

            if (ControllerGame.CheckCollision(Player, Person1, Enemies.Find(x => x.Name == "Salamander")) && !Salamander_.IsDead())
            {
                if (MobAndChar.Count >= 2)
                {
                    MobAndChar.RemoveAt(MobAndChar.Count - 1);
                }
                StoreChars(Salamander_ as Mob);
                IsAnotherPage = true;
                this.Frame.Navigate(typeof(BattleScreen), MobAndChar);
            }

            //Checar se o personagem encontra o Pabblo
            if (ControllerGame.CheckCollision(Player, Person1, Enemies.Find(x => x.Name == "FirstRat")) && !Mouse.IsDead())
            {
                if (MobAndChar.Count >= 2)
                {
                    MobAndChar.RemoveAt(MobAndChar.Count - 1);
                }
                StoreChars(Mouse as Mob);
                IsAnotherPage = true;
                this.Frame.Navigate(typeof(BattleScreen), MobAndChar);
            }

            if (ControllerGame.CheckCollision(Player, Person1, Enemies.Find(x => x.Name == "SecondRat")) && !SecondMouse.IsDead())
            {
                if (MobAndChar.Count >= 2)
                {
                    MobAndChar.RemoveAt(MobAndChar.Count - 1);
                }
                StoreChars(SecondMouse as Mob);
                IsAnotherPage = true;
                this.Frame.Navigate(typeof(BattleScreen), MobAndChar);
            }


            else if (ControllerGame.CheckCollision(Player, Person1, Collision.Find(x => x.Name == "MapExit")))
            {
                this.Frame.Navigate(typeof(Map), Player);
            }

            else if ((ControllerGame.CheckCollision(Player, Person1, Collision.Find(x => x.Name == "MapExit1")) || ControllerGame.CheckCollision(Player, Person1, Collision.Find(x => x.Name == "MapExit2"))) &&
                     Mouse.IsDead() && SecondMouse.IsDead() && Salamander_.IsDead())
            {
                if (MobAndChar.Count >= 2)
                {
                    MobAndChar.RemoveAt(MobAndChar.Count - 1);
                }
                StoreChars(PablloVittar as Mob);
                IsAnotherPage = true;
                this.Frame.Navigate(typeof(BattleScreen), MobAndChar);
            }
        }
 public SelecClass()
 {
     this.InitializeComponent();
     ControllerGame.AdjustFullScreenMode(_Canvas, this);
 }
        //Método que trata toda a animação, movimento e colisão do jogo
        private void AnimationEvent(object sender, object e)
        {
            if (IsAnotherPage)
            {
                return;
            }

            PosY = Canvas.GetTop(Person1);  //Armazena a posição Y do personagem em uma variavel
            PosX = Canvas.GetLeft(Person1); //Armazena a posição X do personagem em uma variavel

            if (ControllerGame.IsMovimentAllowed(Player, Person1, LockedChests, Enemies, Collision, DroppedKeys))
            {
                if (YSpeed < 0 && PosY > 115 * HeightRatio)  //Movimento, checagem e animação para cima
                {
                    ControllerGame.MovePlayer(Person1, 0, YSpeed);
                    ControllerGame.PaintAnimation(Person1, Player, Right, Left, Up, Down);
                }

                if (YSpeed > 0 && PosY < 455 * HeightRatio) //Movimento, checagem e animação para baixo
                {
                    ControllerGame.MovePlayer(Person1, 0, YSpeed);
                    ControllerGame.PaintAnimation(Person1, Player, Right, Left, Up, Down);
                }

                if (XSpeed < 0 && PosX > 60 * WidthRatio) //Movimento, checagem e animação para esquerda
                {
                    ControllerGame.MovePlayer(Person1, XSpeed, 0);
                    ControllerGame.PaintAnimation(Person1, Player, Right, Left, Up, Down);
                }

                if (XSpeed > 0 && PosX < 690 * WidthRatio) //Movimento, checagem e animação para direita
                {
                    ControllerGame.MovePlayer(Person1, XSpeed, 0);
                    ControllerGame.PaintAnimation(Person1, Player, Right, Left, Up, Down);
                }
            }

            //Checa se o player está na frente do bau, para poder lootear
            else if (ControllerGame.CheckListCollision(Player, Person1, LockedChests))
            {
                foreach (Image Hit in LockedChests)
                {
                    if (ControllerGame.Collision(Person1, Hit) == "Bottom")
                    {
                        if (!ChestControl.isOpen)
                        {
                            ControllerGame.LootVault(Player, ChestControl, qt_lifePot, qt_manaPot, ListInvetoryImage);
                            open_chest.Source = new BitmapImage(new Uri(@"ms-appx:///Assets/open_chest3.png"));
                        }
                    }
                }
            }

            else if (ControllerGame.CheckListCollision(Player, Person1, DroppedKeys))
            {
                foreach (Image Hit in DroppedKeys)
                {
                    _Canvas.Children.Remove(FirstMapKey);
                    //Key _Key = new Key();
                    //Player.inventory.Add_Item(_Key, Player);
                }
                DroppedKeys.Clear();
            }

            //Checar se o personagem encontra o Ninja
            if (ControllerGame.CheckCollision(Player, Person1, Enemies.Find(x => x.Name == "NinjaIMG")) && !Ninja.IsDead())
            {
                if (MobAndChar.Count >= 2)
                {
                    MobAndChar.RemoveAt(MobAndChar.Count - 1);
                }
                StoreChars(Ninja as Mob);
                IsAnotherPage = true;
                this.Frame.Navigate(typeof(BattleScreen), MobAndChar);
            }

            //Checar se o personagem encontra o Pabblo
            if (ControllerGame.CheckCollision(Player, Person1, Enemies.Find(x => x.Name == "PabbloVitarIMG")) && !Ninja2.IsDead())
            {
                if (MobAndChar.Count >= 2)
                {
                    MobAndChar.RemoveAt(MobAndChar.Count - 1);
                }

                StoreChars(Ninja2 as Mob);
                IsAnotherPage = true;
                this.Frame.Navigate(typeof(BattleScreen), MobAndChar);
            }


            else if (ControllerGame.CheckCollision(Player, Person1, Collision.Find(x => x.Name == "MapExit")))
            {
                if (/*Ninja.IsDead() && PablloVittar.IsDead())*/ true)
                {
                    IsAnotherPage = true; this.Frame.Navigate(typeof(Map2), Player);
                }
            }
        }
Пример #16
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            if (ControllerGame.CheckLastPage(typeof(Map), this))
            {
                CharList = e.Parameter as List <Object>;

                BattlePlayer = CharList.ElementAt(0) as Character;
                Mob_         = CharList.ElementAt(1) as Mob;
                CharList.Clear();

                Debug.WriteLine("DANO MOB: " + Mob_.Damage);
                Debug.WriteLine("Dano Player " + BattlePlayer.Damage);
                Debug.WriteLine("EU SOU " + Mob_.name);

                AdjustProgessBar();

                Person1.Source = BattlePlayer.IdleUp;
            }

            if (ControllerGame.CheckLastPage(typeof(Map2), this))
            {
                CharList = e.Parameter as List <Object>;

                BattlePlayer = CharList.ElementAt(0) as Character;
                Mob_         = CharList.ElementAt(1) as Mob;
                CharList.Clear();

                Debug.WriteLine("DANO MOB: " + Mob_.Damage);
                Debug.WriteLine("Dano Player " + BattlePlayer.Damage);
                Debug.WriteLine("EU SOU " + Mob_.name);

                AdjustProgessBar();

                Person1.Source = BattlePlayer.IdleUp;
            }

            if (BattlePlayer is Berserker)
            {
                btnSkillBasic.Content = "Basic Attack";
                btnSkillOne.Content   = "Corrupted Strike";
                btnSkillTwo.Content   = "Double Edged Sword";
            }
            if (BattlePlayer is Dicer)
            {
                btnSkillBasic.Content = "Waterball";
                btnSkillOne.Content   = "Mystic Snake";
                btnSkillTwo.Content   = "Nether Blast";
            }

            btnLifePot.IsEnabled = false;
            if (BattlePlayer.inventory.checkPotCount("LifePot"))
            {
                btnLifePot.IsEnabled = true;
            }

            BtnManaPot.IsEnabled = false;
            if (BattlePlayer.inventory.checkPotCount("ManaPot"))
            {
                BtnManaPot.IsEnabled = true;
            }

            Mob1.Source = Mob_.GifBattle;
            SignPageEvents();
            turn = BattleController.InicializeBattle(BattlePlayer, Mob_, button);
        }