示例#1
0
        private void JediInitialization()
        {
            //Jedi
            if (Jedi.FinalCharacter == 1)
            {
                this.jedi = JediFactory.CreatJedi(JediType.JoNakov);
                JediImageValidation(this.jedi, enemyBox);
            }
            else if (Jedi.FinalCharacter == 2)
            {
                this.jedi = JediFactory.CreatJedi(JediType.AchoUanKenobi);
                JediImageValidation(jedi, enemyBox);
            }
            else if (Jedi.FinalCharacter == 3)
            {
                this.jedi = JediFactory.CreatJedi(JediType.RoyalSkyWalker);
                JediImageValidation(jedi, enemyBox);
            }
            else if (Jedi.FinalCharacter == 4)
            {
                this.jedi = JediFactory.CreatJedi(JediType.NaskoSolo);
                JediImageValidation(jedi, enemyBox);
            }

            //AssistentJedi
            if (Jedi.FinalAssistantCharacter == 1)
            {
                this.assistantsJedi = AssistantJediFactory.CreateJediАsistant(AssistantJediType.ChubiEdo);
                AssistantImageValidation(this.assistantsJedi, pictureBox1);

            }
            else if (Jedi.FinalAssistantCharacter == 2)
            {
                this.assistantsJedi = AssistantJediFactory.CreateJediАsistant(AssistantJediType.R2Trifon2);
                AssistantImageValidation(this.assistantsJedi, pictureBox1);
            }
        }
示例#2
0
        private void JediImageValidation(IJedi jediCharacter, PictureBox paduin)
        {
            try
            {
                image = Image.FromFile(jediCharacter.CharacterImage);

                paduin.Image = image;
                paduin.Height = image.Height;
                paduin.Width = image.Width;
            }
            catch (FileNotFoundException)
            {
                throw new FileNotFoundException("The path of " + jediCharacter.GetType().Name + " is not in the correct format !");
            }
        }