Пример #1
0
        private void DeSerial()
        {
            try
            {
                Bak.InstCol();
                string md = Environment.GetFolderPath(Environment.SpecialFolder.Personal);//путь к Документам

                FileStream fs = new FileStream(md + "\\UranSetUp\\" + "setting.dat", FileMode.Open);
                try
                {
                    BinaryFormatter bf = new BinaryFormatter();
                    set = (UserSetting)bf.Deserialize(fs);
                }
                catch (SerializationException)
                {
                    System.Windows.MessageBox.Show("ошибка");
                }
                finally
                {
                    fs.Close();
                }
                try
                {
                    XmlSerializer xs = new XmlSerializer(typeof(ObservableCollection <Bak>));
                    StreamReader  wr;
                    using (wr = new StreamReader(md + "\\UranSetUp\\" + "setting1.xml"))
                    {
                        Bak._DataColec1 = (ObservableCollection <Bak>)xs.Deserialize(wr);
                    }
                    wr.Close();
                }
                catch (Exception)
                {
                }
            }
            catch (Exception)
            {
                System.Windows.MessageBox.Show("Ошибка серилизации");
            }
        }
    void Start()
    {
        player     = GetComponent <AudioSource>();
        fadeScreen = GameObject.Find("BlackFade");

        if (GameObject.Find("Character") != null)
        {
            DungaScript = GameObject.Find("Character").GetComponent <Dunga>();
        }

        tutorialBarrel = GameObject.Find("barrelClosed");
        tutorialRock   = GameObject.Find("Spawning_Stone");
        currentScene   = SceneManager.GetActiveScene();
        index          = 0;

        #region Tutorial Scene Sentences
        TutorialSceneSentences[0]  = "Master! I'm here to help. You've been asleep for a long time. I'm Lys, your loyal assistant.";
        TutorialSceneSentences[1]  = "You’re probably wondering about what happened and what you are, so I’ll explain.";
        TutorialSceneSentences[2]  = "You are a lesser-god.  A half spirit who watches over the world and protects your \"Chosen.\"";
        TutorialSceneSentences[3]  = "What?? It's him?";
        TutorialSceneSentences[4]  = "\"Dunga\" ? He's an odd one isn't he.";
        TutorialSceneSentences[5]  = "Anyways, it will take you a bit of time to recover your full power.";
        TutorialSceneSentences[6]  = "Even with your limited ability you can swap health bars and interfere with incoming airborne attacks";
        TutorialSceneSentences[7]  = "Click and drag one health bar onto another to switch the amount of health they have. Give it a try.";
        TutorialSceneSentences[8]  = "Excellent. The health values have now been exchanged.";
        TutorialSceneSentences[9]  = "You can do the exact same thing with buffs.  Just grab the icon and move it to Dunga’s health bar.";
        TutorialSceneSentences[10] = "Fantastic!  That buff will increase the attack speed of the corresponding character.  Watch out if you see it on an enemy.";
        TutorialSceneSentences[11] = "That arrow is our next problem. You can click on it to stop its momentum. It will fall to the ground without harming our friend.";
        TutorialSceneSentences[12] = "Very good. Now we can protect our... chosen.";
        TutorialSceneSentences[13] = "In ages past you could affect the world in great ways. For now, you will have to deal with a much diminished power.";
        TutorialSceneSentences[14] = "See those stones behind Dunga?  Try dragging them towards him.";
        TutorialSceneSentences[15] = "You can also interact with other items likes barrels or crates.  Try smashing one of them atop an enemy.";
        TutorialSceneSentences[16] = "I believe you are now ready.  As you regain your powers, I will guide you on how to use them.";


        #endregion

        #region Tutorial Audio Clips
        TutorialAudioClips = new AudioClip[] { (AudioClip)Resources.Load("Audio/Sprite/Tutorial/ImLys"),
                                               (AudioClip)Resources.Load("Audio/Sprite/Tutorial/IllExplain"),
                                               (AudioClip)Resources.Load("Audio/Sprite/Tutorial/YouAreALesserGod"),
                                               (AudioClip)Resources.Load("Audio/Sprite/Tutorial/ItsHim"),
                                               (AudioClip)Resources.Load("Audio/Sprite/Tutorial/HesAnOddOne"),
                                               (AudioClip)Resources.Load("Audio/Sprite/Tutorial/FullPower"),
                                               (AudioClip)Resources.Load("Audio/Sprite/Tutorial/EvenWithYourLimitedAbility"),
                                               (AudioClip)Resources.Load("Audio/Sprite/Tutorial/ClickAndDrag"),
                                               (AudioClip)Resources.Load("Audio/Sprite/Tutorial/Excellent"),
                                               (AudioClip)Resources.Load("Audio/Sprite/Tutorial/SameWithBuffs"),
                                               (AudioClip)Resources.Load("Audio/Sprite/Tutorial/ThatBuff"),
                                               (AudioClip)Resources.Load("Audio/Sprite/Tutorial/ThatArrow"),
                                               (AudioClip)Resources.Load("Audio/Sprite/Tutorial/VeryGood"),
                                               (AudioClip)Resources.Load("Audio/Sprite/Tutorial/InAgesPast"),
                                               (AudioClip)Resources.Load("Audio/Sprite/Tutorial/SeeThoseStones"),
                                               (AudioClip)Resources.Load("Audio/Sprite/Tutorial/YouCanAlsoInteract"),
                                               (AudioClip)Resources.Load("Audio/Sprite/Tutorial/YouAreNowReady") };
        #endregion

        #region Scene 1 Sentences
        Scene1Sentences[0] = "It’s gone.  It’s all gone.";
        Scene1Sentences[1] = "Dunga…";
        Scene1Sentences[2] = "Every farm, every crop, every longhouse just burnt to the ground.";

        Scene1Sentences[3] = "At least the... barkeep is still alive.";
        Scene1Sentences[4] = "Oddly convenient...";
        Scene1Sentences[5] = "Dunga Dunga.";

        Scene1Sentences[6] = "When the raiders were chasing me, the rest of them attacked the village.";
        Scene1Sentences[7] = "I feel like such a coward.  I should’ve stood my ground just like you did in the forest.";
        Scene1Sentences[8] = "Wait.. they couldn't have gone far with everything they took.";
        Scene1Sentences[9] = "Dunga, it's their ship!";

        Scene1Sentences[10] = "You need to go reclaim what they've taken.  Our people deserve better than this!";
        Scene1Sentences[11] = "Dunga Dunga?";
        Scene1Sentences[12] = "Me? I would certainly come, but uhh... I need to...";
        Scene1Sentences[13] = "AID THE WOUNDED! Yea, yea that makes sense.  Now go, Dunga!";
        Scene1Sentences[14] = "Duuuuunnnnggggaaaaa!!!";
        Scene1Sentences[15] = "Give 'em Hel!  Or... or condemn them to Hellheim!  Yes something like that...";
        #endregion

        #region Scene 1 Names
        Scene1Names1[0]  = "Bak";
        Scene1Names1[1]  = "Dunga";
        Scene1Names1[2]  = "Bak";
        Scene1Names1[3]  = "Bak";
        Scene1Names1[4]  = "Bak";
        Scene1Names1[5]  = "Dunga";
        Scene1Names1[6]  = "Bak";
        Scene1Names1[7]  = "Bak";
        Scene1Names1[8]  = "Bak";
        Scene1Names1[9]  = "Bak";
        Scene1Names1[10] = "Bak";
        Scene1Names1[11] = "Dunga";
        Scene1Names1[12] = "Bak";
        Scene1Names1[13] = "Bak";
        Scene1Names1[14] = "Dunga";
        Scene1Names1[15] = "Bak";
        #endregion

        #region Scene 1 Audio Clips
        Scene1AudioClips = new AudioClip[] { (AudioClip)Resources.Load("Audio/Bak/OpeningScene/AllGone"),
                                             (AudioClip)Resources.Load("Audio/Dunga/DungaSurprised"),
                                             (AudioClip)Resources.Load("Audio/Bak/OpeningScene/EveryFarm"),
                                             (AudioClip)Resources.Load("Audio/Bak/OpeningScene/Barkeep"),
                                             (AudioClip)Resources.Load("Audio/Bak/OpeningScene/OddlyConvenient"),
                                             (AudioClip)Resources.Load("Audio/Dunga/DungaHeyy2"),
                                             (AudioClip)Resources.Load("Audio/Bak/OpeningScene/RaiderChasing"),
                                             (AudioClip)Resources.Load("Audio/Bak/OpeningScene/ForestGround"),
                                             (AudioClip)Resources.Load("Audio/Bak/OpeningScene/EverythingTheyTook"),
                                             (AudioClip)Resources.Load("Audio/Bak/OpeningScene/ItsTheirShip"),
                                             (AudioClip)Resources.Load("Audio/Bak/OpeningScene/Reclaim"),
                                             (AudioClip)Resources.Load("Audio/Dunga/Dunga2TimesQuestion"),
                                             (AudioClip)Resources.Load("Audio/Bak/OpeningScene/IWouldCome"),
                                             (AudioClip)Resources.Load("Audio/Bak/OpeningScene/AidTheWounded"),
                                             (AudioClip)Resources.Load("Audio/Dunga/DungaLongYell"),
                                             (AudioClip)Resources.Load("Audio/Bak/OpeningScene/Helheim") };
        #endregion

        #region Scene 2 Sentences
        Scene2Sentences[0]  = "Dunga Dungaaa!!";
        Scene2Sentences[1]  = "Why you trying to attack our ship!?  Our Chieftain won’t like that, won’t like that at all.  My head’s on the chopping block now, so I’ll \ntake you down with me!";
        Scene2Sentences[2]  = "Dunga...";
        Scene2Sentences[3]  = "Dunga, Dunga.  Dunga!";
        Scene2Sentences[4]  = "I have the eyes of Odin’s raven, so piercing an arrow through your skull at this range should be no trouble at all!";
        Scene2Sentences[5]  = "Dunga Dunga Dunga, Dunga Dunga.";
        Scene2Sentences[6]  = "What!? How dare you say that about my mother!";
        Scene2Sentences[7]  = "You ever face a hoard of ravaging vikings?  Well here’s your first lesson: ROLL OVER AND DIE!";
        Scene2Sentences[8]  = "I saw it one night, the shrine, the divine power that shields you now; it calls to those who are worthy, and it called to me.";
        Scene2Sentences[9]  = "But why you?  Why does such an imbecile gain the powers of the divine protector?  What makes YOU WORTHY!!??  WHY AM I NOT THE CHOSEN ONE!!!???";
        Scene2Sentences[10] = "...Dunga.";
        Scene2Sentences[11] = "You...you stumbled upon it?  B–by some sort of accident?";
        Scene2Sentences[12] = "Dunga.";
        Scene2Sentences[13] = "I will end your reign of pitiful ignorance, once...and for all.";
        Scene2Sentences[14] = "That’s right, you’re not the only one with magic on their side.";
        #endregion

        #region Village Scene Sentences
        VillageSceneSentences[0] = "Welcome to the new village, master! The people have been rebuilding ever since you helped Dunga fight off the raiders.";
        VillageSceneSentences[1] = "This is our new home. Dunga has spread the word of your powers and the people have dedicated a shrine to you in the centre of town. ";
        VillageSceneSentences[2] = "It's not much right now, but as you help Dunga along his adventures, he will gain more followers for you.";
        VillageSceneSentences[3] = "This will increase your power significantly, allowing you to unlock more of your long-forgotten abilities!";
        VillageSceneSentences[4] = "Here in the village, Dunga can visit the Tavern and Blacksmith to trade for supplies and gear up for his next quest. You might have to help him find his way around, though...";
        VillageSceneSentences[5] = "Yeah he's not the brightest lad, is he?";
        VillageSceneSentences[6] = "Once you think Dunga is ready for his next adventure, go ahead and visit the map and choose his destination. His fate is in your hands, master!";
        #endregion

        #region Village Audio Clips
        VillageAudioClips = new AudioClip[] { (AudioClip)Resources.Load("Audio/Sprite/Village/Sprite_Village_Line1"),
                                              (AudioClip)Resources.Load("Audio/Sprite/Village/Sprite_Village_Line2"),
                                              (AudioClip)Resources.Load("Audio/Sprite/Village/Sprite_Village_Line3"),
                                              (AudioClip)Resources.Load("Audio/Sprite/Village/Sprite_Village_Line4"),
                                              (AudioClip)Resources.Load("Audio/Sprite/Village/Sprite_Village_Line5"),
                                              (AudioClip)Resources.Load("Audio/Sprite/Village/Sprite_Village_Line6"),
                                              (AudioClip)Resources.Load("Audio/Sprite/Village/Sprite_Village_Line7"), };
        #endregion

        #region Scene 2 Names
        Scene2Names[0]  = "Dunga";
        Scene2Names[1]  = "Marauder";
        Scene2Names[2]  = "Dunga";
        Scene2Names[3]  = "Dunga";
        Scene2Names[4]  = "Archer";
        Scene2Names[5]  = "Dunga";
        Scene2Names[6]  = "Marauder";
        Scene2Names[7]  = "Marauder";
        Scene2Names[8]  = "Chieftain";
        Scene2Names[9]  = "Chieftain";
        Scene2Names[10] = "Dunga";
        Scene2Names[11] = "Chieftain";
        Scene2Names[12] = "Dunga";
        Scene2Names[13] = "Chieftain";
        Scene2Names[14] = "Chieftain";
        #endregion

        #region Scene 2 Audio Clips
        Scene2AudioClips = new AudioClip[] { (AudioClip)Resources.Load("Audio/Dunga/Dunga2Times2"),
                                             (AudioClip)Resources.Load("Audio/Marauder/GameScene/MarauderStage1"),
                                             (AudioClip)Resources.Load("Audio/Dunga/DungaPant"),
                                             (AudioClip)Resources.Load("Audio/Dunga/Dunga3TimesDefensive"),
                                             (AudioClip)Resources.Load("Audio/Archer/GameScene/Archer(Take2)"),
                                             (AudioClip)Resources.Load("Audio/Dunga/DungaSingingShort"),
                                             (AudioClip)Resources.Load("Audio/Marauder/GameScene/MarauderStage3"),
                                             (AudioClip)Resources.Load("Audio/Marauder/GameScene/RaiderStage4Take1"),
                                             (AudioClip)Resources.Load("Audio/Chieftain/GameScene/Chieftain_Line1"),
                                             (AudioClip)Resources.Load("Audio/Chieftain/GameScene/Chieftain_Line7"),
                                             (AudioClip)Resources.Load("Audio/Dunga/Dunga1Time2"),
                                             (AudioClip)Resources.Load("Audio/Chieftain/GameScene/Chieftain_Line2"),
                                             (AudioClip)Resources.Load("Audio/Dunga/DungaQuestioning"),
                                             (AudioClip)Resources.Load("Audio/Chieftain/GameScene/Chieftain_Line3"),
                                             (AudioClip)Resources.Load("Audio/Chieftain/GameScene/Chieftain_Line4"), };
        #endregion


        if (currentScene.name == "TutorialScene")
        {
            gameManager = GameObject.Find("GameManager");
            Invoke("StartTutorialNarrative", 2.5f);
            GameObject.Find("Lys").GetComponent <Animator>().Play("TutorialEntrance");
            DeactivateClickables();
        }

        if (currentScene.name == "OpeningScene")
        {
            playable  = GameObject.Find("Timeline").GetComponent <PlayableDirector>();
            BakScript = GameObject.Find("Bak").GetComponent <Bak>();
            Invoke("StartNarrative", 8.0f);
            Invoke("ToggleTimeline", 8.0f);
            ChangeSpeed(5.0f);
        }

        if (currentScene.name == "GameScene")
        {
            playable    = GameObject.Find("Timeline").GetComponent <PlayableDirector>();
            gameManager = GameObject.Find("GameManager");
            gameManager.GetComponent <PauseGame>().ChangeStageEnemySpeed(2.5f);
            Invoke("StartGameNarrative", 4.5f);
            Invoke("ToggleTimeline", 6f);
            DungaScript.moveSpeed = 7.5f;
        }

        if (currentScene.name == "Village")
        {
            gameManager = GameObject.Find("GameManager");
            Invoke("StartVillageNarrative", 4f);
            GameObject.Find("Lys").GetComponent <Animator>().Play("VillageEntrance");
        }

        Invoke("FadeOnOff", 2.0f);
    }