상속: Props
예제 #1
0
    public void AdvanceSkill(int option, int Stage)
    {
        int actualSkillNo = Chargen.GetChoices(Stage, CharClassAns)[option] - 30;                      //was -31
        //actualSkillNo++;
        //Increase the skill by up to (no more than the skill seed) Apply the attibute bonus if needed.
        int SkillScore = Mathf.Min(Random.Range(1, SkillSeed) + Skills.getSkillAttributeBonus(actualSkillNo), SkillSeed);

        UWCharacter.Instance.PlayerSkills.AdvanceSkill(actualSkillNo, SkillScore);
        string skillname = StringController.instance.GetString(2, Chargen.GetChoices(Stage, CharClassAns)[option]);

        for (int i = 0; i < 5; i++)                 //Update the display
        {
            if (CharSkillName[i].text == "")
            {                                    //First free slot
                CharSkillName[i].text = skillname;
                CharSkillVal[i].text  = UWCharacter.Instance.PlayerSkills.GetSkill(actualSkillNo).ToString();
                return;
            }
            else if (CharSkillName[i].text == skillname)
            {                                    //Skill found add to it.
                CharSkillVal[i].text = UWCharacter.Instance.PlayerSkills.GetSkill(actualSkillNo).ToString();
                return;
            }
        }
    }
예제 #2
0
    public void ButtonClickMainMenu(int option)
    {            //Button clicks on front menu.
        if (MenuMode == 0)
        {
            switch (option)
            {
            case 0:                             //PLay introduction
                //UWHUD.instance.CutScenesFull.SetAnimation="cs013_n01";
                Cutscene_Intro ci = UWHUD.instance.gameObject.AddComponent <Cutscene_Intro>();
                UWHUD.instance.CutScenesFull.cs = ci;
                UWHUD.instance.CutScenesFull.Begin();

                break;

            case 1:                             // Create Character
                MenuMode = 1;
                CharGen.SetActive(true);
                OpScr.SetActive(false);
                CharGenQuestion.text = getQuestion(0);
                InitChargenScreen();
                chrBtns           = new GRLoader(GRLoader.CHRBTNS_GR);
                chrBtns.PaletteNo = 9;
                PlaceButtons(Chargen.GetChoices(Chargen.STAGE_GENDER, -1), false);
                break;

            case 2:                            // Acknowledgements
                Cutscene_Credits cc = UWHUD.instance.gameObject.AddComponent <Cutscene_Credits>();
                UWHUD.instance.CutScenesFull.cs = cc;
                UWHUD.instance.CutScenesFull.Begin();
                break;

            case 3:                            // Journey onwards. In the future will be a link to load menu
                MenuMode = 2;
                DisplaySaveGames();
                break;

            case 4:                            //Reset MainMenu
                IntroductionButton.SetActive(true);
                CreateCharacterButton.SetActive(true);
                CreditsButton.SetActive(true);
                JourneyOnButton.SetActive(true);
                for (int i = 0; i <= SaveGameButtons.GetUpperBound(0); i++)
                {
                    SaveGameButtons[i].SetActive(false);
                }
                OpScr.SetActive(true);
                CharGen.SetActive(false);
                break;
            }
        }
        else
        {                        //Chargen
            ChargenClick(option);
        }
    }
예제 #3
0
    public void ChargenClick(int option)
    {
        //0 = Gender
        //1 = Handeness
        //2 = Class
        //3,4,5,6,7 = Skills. Some are skipped over.
        //8 is portrait/race
        //9 is difficulty.
        //10 is name
        //11 is confirm.


        switch (chargenStage)
        {
        case Chargen.STAGE_GENDER:
            //Gender
            UWCharacter.Instance.PlayerSkills.InitSkills();                                    //Set all skills to zero

            if (option == 0)
            {
                UWCharacter.Instance.isFemale = false;
            }
            else
            {
                UWCharacter.Instance.isFemale = true;
            }
            CharGender.text = StringController.instance.GetString(2, Chargen.GetChoices(chargenStage, -1)[option]);
            chargenStage++;
            PlaceButtons(Chargen.GetChoices(chargenStage, -1), false);

            break;

        case Chargen.STAGE_HANDENESS:
            //Handedness
            if (option == 0)
            {
                UWCharacter.Instance.isLefty = true;
            }
            else
            {
                UWCharacter.Instance.isLefty = false;
            }
            chargenStage++;
            PlaceButtons(Chargen.GetChoices(chargenStage, -1), false);
            break;

        case Chargen.STAGE_CLASS:
            UWCharacter.Instance.CharClass = option;

            CharClassAns = option;
            SkillSeed    = Chargen.getSeed(option);
            //Set str, int and dex here.
            //Max attribute is 30. Min is 12.
            UWCharacter.Instance.PlayerSkills.STR = Mathf.Min(Mathf.Max(Chargen.getBaseSTR(option) + Random.Range(1, SkillSeed), 12), 30);
            UWCharacter.Instance.PlayerSkills.INT = Mathf.Min(Mathf.Max(Chargen.getBaseINT(option) + Random.Range(1, SkillSeed), 12), 30);
            UWCharacter.Instance.PlayerSkills.DEX = Mathf.Min(Mathf.Max(Chargen.getBaseDEX(option) + Random.Range(1, SkillSeed), 12), 30);
            CharStr.text   = "Str:   " + UWCharacter.Instance.PlayerSkills.STR.ToString();
            CharInt.text   = "Int:   " + UWCharacter.Instance.PlayerSkills.INT.ToString();
            CharDex.text   = "Dex:   " + UWCharacter.Instance.PlayerSkills.DEX.ToString();
            CharClass.text = getClass(UWCharacter.Instance.CharClass);
            UWCharacter.Instance.MaxVIT = (UWCharacter.Instance.PlayerSkills.STR * 2);
            UWCharacter.Instance.CurVIT = (UWCharacter.Instance.PlayerSkills.STR * 2);
            CharVit.text = "Vit:   " + UWCharacter.Instance.MaxVIT.ToString();
            //todo
            chargenStage++;
            if (Chargen.GetChoices(chargenStage, CharClassAns).GetUpperBound(0) == 0)
            {                                                           //Only one choice. Accept it by default.
                //	chargenStage++;
                CharGenQuestion.text = getQuestion(chargenStage);
                ChargenClick(0);
                return;
            }
            else
            {
                PlaceButtons(Chargen.GetChoices(chargenStage, CharClassAns), false);
            }

            break;

        case Chargen.STAGE_SKILLS_1:
        case Chargen.STAGE_SKILLS_2:
        case Chargen.STAGE_SKILLS_3:
        case Chargen.STAGE_SKILLS_4:
            //Set skills here if possible.
            AdvanceSkill(option, chargenStage);
            chargenStage++;
            if (Chargen.GetChoices(chargenStage, CharClassAns).GetUpperBound(0) == 0)
            {                                                   //Only one choice. Accept it by default.
                                                                //chargenStage++;
                CharGenQuestion.text = getQuestion(chargenStage);
                ChargenClick(0);
                return;
            }
            else
            {
                PlaceButtons(Chargen.GetChoices(chargenStage, CharClassAns), false);
            }
            break;

        case Chargen.STAGE_SKILLS_5:
            //Assume I will always have a choice here.
            //Set skills here if possible.
            AdvanceSkill(option, chargenStage);
            chargenStage++;
            PlaceButtons(Chargen.GetChoices(chargenStage, CharClassAns), true);                                  //Moving to protrait.
            break;

        case Chargen.STAGE_PORTRAIT:
            chargenStage++;
            PlaceButtons(Chargen.GetChoices(chargenStage, -1), false);
            UWCharacter.Instance.Body = option;
            GRLoader chrBdy = new GRLoader(GRLoader.BODIES_GR);
            //Show the matching body.
            //Update the paperdoll.
            if (UWCharacter.Instance.isFemale)
            {
                //CharGenBody.texture = (Texture2D)Resources.Load(_RES +"/Hud/Chargen/chrbtns_" + (22+option).ToString("0000"));
                CharGenBody.texture = chrBtns.LoadImageAt(22 + option);
                //UWHUD.instance.playerBody.texture =(Texture2D)Resources.Load(_RES +"/Hud/Bodies/bodies_" + (5+option).ToString("0000"));
                UWHUD.instance.playerBody.texture = chrBdy.LoadImageAt(5 + option);
            }
            else
            {
                //CharGenBody.texture = (Texture2D)Resources.Load(_RES +"/Hud/Chargen/chrbtns_" + (17+option).ToString("0000"));
                CharGenBody.texture = chrBtns.LoadImageAt(17 + option);
                //UWHUD.instance.playerBody.texture =(Texture2D)Resources.Load(_RES +"/Hud/Bodies/bodies_" + (option).ToString("0000"));
                UWHUD.instance.playerBody.texture = chrBdy.LoadImageAt(option);
            }

            break;

        case Chargen.STAGE_DIFFICULTY:
            //Not implemented.
            //Show the name input box.
            //Remove buttons.
            chargenStage++;
            GameWorldController.instance.difficulty = option;
            RemoveButtons();
            EnterCharName.gameObject.SetActive(true);
            EnterCharName.GetComponent <RawImage>().texture = chrBtns.LoadImageAt(2);
            EnterCharName.Select();
            break;

        case Chargen.STAGE_NAME:
            //Set the player name.
            //UWCharacter.Instance.CharName=CharNameAns;
            chargenStage++;
            EnterCharName.gameObject.SetActive(false);
            PlaceButtons(Chargen.GetChoices(chargenStage, CharClassAns), false);
            break;

        case Chargen.STAGE_CONFIRM:
            if (option == 0)
            {
                //Start a new game
                UWCharacter.Instance.EXP                     = 50;
                UWCharacter.Instance.TrainingPoints          = 1;
                UWCharacter.Instance.PlayerMagic.MaxMana     = UWCharacter.Instance.PlayerSkills.ManaSkill * 3;
                UWCharacter.Instance.PlayerMagic.CurMana     = UWCharacter.Instance.PlayerMagic.MaxMana;
                UWCharacter.Instance.PlayerMagic.TrueMaxMana = UWCharacter.Instance.PlayerMagic.MaxMana;
                GameWorldController.instance.InitBGlobals(0);
                //Reset quest variables
                for (int i = 0; i <= Quest.instance.QuestVariables.GetUpperBound(0); i++)
                {
                    Quest.instance.QuestVariables[i] = 0;
                }
                for (int i = 0; i <= UWCharacter.Instance.PlayerMagic.PlayerRunes.GetUpperBound(0); i++)
                {
                    UWCharacter.Instance.PlayerMagic.PlayerRunes[i] = false;
                }
                switch (_RES)
                {
                case GAME_UW1:
                case GAME_UWDEMO:
                    Quest.instance.TalismansRemaining = 8;
                    Quest.instance.DayGaramonDream    = 0;
                    Quest.instance.GaramonDream       = 0;
                    Quest.instance.IncenseDream       = 0;
                    Quest.instance.isGaramonBuried    = false;
                    Quest.instance.isOrbDestroyed     = false;
                    Quest.instance.isCupFound         = false;
                    break;

                case  GAME_UW2:
                    Quest.instance.variables[101] = 255;
                    Quest.instance.variables[102] = 255;
                    Quest.instance.variables[103] = 255;
                    Quest.instance.variables[104] = 255;
                    Quest.instance.variables[105] = 255;
                    Quest.instance.variables[106] = 255;
                    break;
                }
                GameClock.instance._day        = 0;
                GameClock.instance._minute     = 51;
                GameClock.instance._second     = 15;
                UWCharacter.Instance.Fatigue   = 20;
                UWCharacter.Instance.FoodLevel = 192;
                JourneyOnwards();
            }
            else
            {
                //restart chargen
                chargenStage = Chargen.STAGE_GENDER;
                InitChargenScreen();
                PlaceButtons(Chargen.GetChoices(chargenStage, -1), false);
            }
            break;
        }

        //Set next question.
        CharGenQuestion.text = getQuestion(chargenStage);
    }