GetPrimaryAttribute() public method

public GetPrimaryAttribute ( AttributeName, attributeName ) : Attribute,
attributeName AttributeName,
return Attribute,
コード例 #1
0
        //Remove previous Mod and subtract bool
        void ModCharacterStats(BaseCharacter character, bool Add)
        {
            int MP = 1;

            if (!Add)
            {
                MP = -1;
            }
            foreach (StatModifier mod in Modifiers)
            {
                switch (mod.Stat)
                {
                case AttributeName.Level:
                    Debug.LogWarning("Level Modding is not allowed at this time. Please contact Programming is needed");
                    break;

                case AttributeName.Strength:
                    character.GetPrimaryAttribute((int)AttributeName.Strength).BuffValue += mod.BuffValue * MP;
                    break;

                case AttributeName.Vitality:
                    character.GetPrimaryAttribute((int)AttributeName.Vitality).BuffValue += mod.BuffValue * MP;
                    break;

                case AttributeName.Awareness:
                    character.GetPrimaryAttribute((int)AttributeName.Awareness).BuffValue += mod.BuffValue * MP;
                    break;

                case AttributeName.Speed:
                    character.GetPrimaryAttribute((int)AttributeName.Speed).BuffValue += mod.BuffValue * MP * MP;
                    break;

                case AttributeName.Skill:
                    character.GetPrimaryAttribute((int)AttributeName.Skill).BuffValue += mod.BuffValue * MP;
                    break;

                case AttributeName.Resistance:
                    character.GetPrimaryAttribute((int)AttributeName.Resistance).BuffValue += mod.BuffValue * MP;
                    break;

                case AttributeName.Concentration:
                    character.GetPrimaryAttribute((int)AttributeName.Concentration).BuffValue += mod.BuffValue * MP;
                    break;

                case AttributeName.WillPower:
                    character.GetPrimaryAttribute((int)AttributeName.WillPower).BuffValue += mod.BuffValue * MP;
                    break;

                case AttributeName.Charisma:
                    character.GetPrimaryAttribute((int)AttributeName.Charisma).BuffValue += mod.BuffValue * MP;
                    break;

                case AttributeName.Luck:
                    character.GetPrimaryAttribute((int)AttributeName.Luck).BuffValue += mod.BuffValue * MP;
                    break;
                }
            }
            character.StatUpdate();
        }
コード例 #2
0
        GameObject CreatePlayerPanel()
        {
            if (playerStats)
            {
                Object.Destroy(playerStats);
            }

            GameObject MainPanel = Manager.GetPanel(MenuPanelParent.transform, new Vector2(400, 300), new Vector2(0, 150));

            MainPanel.name = "Player Window";
            MainPanel.transform.SetSiblingIndex(0);
            VerticalLayoutGroup VLG = MainPanel.AddComponent <VerticalLayoutGroup>();

            VLG.padding = new RectOffset()
            {
                bottom = 20, top = 20, left = 20, right = 20
            };
            VLG.childAlignment         = TextAnchor.UpperCenter;
            VLG.childControlHeight     = false; VLG.childControlWidth = true;
            VLG.childForceExpandHeight = false; VLG.childForceExpandWidth = true;

            Text titleGO = Manager.TextBox(MainPanel.transform, new Vector2(400, 50)).GetComponent <Text>();

            titleGO.alignment = TextAnchor.MiddleCenter;
            titleGO.text      = " Player";
            titleGO.fontSize  = 24;
            VerticalLayoutGroup PlayerStatsWindow = Manager.GetPanel(MainPanel.transform, new Vector2(400, 450), new Vector2(0, 150)).AddComponent <VerticalLayoutGroup>();

            PlayerStatsWindow.name    = "Player Stats Window";
            PlayerStatsWindow.padding = new RectOffset()
            {
                bottom = 20, top = 20, left = 20, right = 20
            };
            PlayerStatsWindow.childAlignment         = TextAnchor.UpperCenter;
            PlayerStatsWindow.childControlHeight     = true; PlayerStatsWindow.childControlWidth = true;
            PlayerStatsWindow.childForceExpandHeight = true; PlayerStatsWindow.childForceExpandWidth = true;

            Text statsText = Manager.TextBox(PlayerStatsWindow.transform, new Vector2(400, 50)).GetComponent <Text>();

            statsText.alignment = TextAnchor.UpperLeft;
            statsText.text      = " Player";
            statsText.fontSize  = 24;

            statsText.text  = Character.Name + " Lvl: " + Character.Level;
            statsText.text += "\nHealth:\t\t" + Character.CurHealth + "/" + Character.MaxHealth;
            statsText.text += "\nMana:\t\t\t" + Character.CurMana + "/" + Character.MaxMana + "\n";

            for (int i = 0; i < System.Enum.GetValues(typeof(AttributeName)).Length; i++)
            {
                statsText.text += "\n" + ((AttributeName)i).ToString() + ":\t\t\t" + Character.GetPrimaryAttribute(i).BaseValue;
                statsText.text += " + " + Character.GetPrimaryAttribute(i).BuffValue;
                statsText.text += " + " + Character.GetPrimaryAttribute(i).AdjustBaseValue;
            }
            currentEquipWindow = CurrentEquipWindow(MainPanel.transform);

            return(MainPanel);
        }
コード例 #3
0
//	// Use this for initialization
//	void Start () {
//
//
//	}
//
//	// Update is called once per frame
//	void Update () {
//
//	}
    public void SaveCharData()
    {
        //PlayerPrefs.DeleteAll();            //Uncomment this and run the game every time you make changes to what is saved then comment back. <- precautionary device
        PlayerPrefs.SetString("currentLvl", Application.loadedLevelName);
        pc = GameObject.Find("Player");
        BaseCharacter pcClass = pc.GetComponent <BaseCharacter>();

        print(PlayerPrefs.GetString("currentLvl"));
        for (int cnt = 0; cnt < Enum.GetValues(typeof(AttributeName)).Length; cnt++)
        {
            PlayerPrefs.SetInt(((AttributeName)cnt).ToString(), pcClass.GetPrimaryAttribute(cnt).BaseValue);
        }

        for (int cnt = 0; cnt < Enum.GetValues(typeof(VitalName)).Length; cnt++)
        {
            PlayerPrefs.SetInt(((VitalName)cnt).ToString(), pcClass.GetVital(cnt).BaseValue);
            PlayerPrefs.SetInt(((VitalName)cnt).ToString(), pcClass.GetVital(cnt).CurValue);
        }
        SavePlayerPosition(pc);
        PlayerPrefs.Save();
    }
コード例 #4
0
    void SetStats()
    {
        switch (Progression.playerClass)
        {
        case 1: BaseStat.BaseValue = 10;
            BaseStat.BuffValue     = 5;
            jScript.startATK       = (int)(_player.GetPrimaryAttribute(0).AdjustedBaseValue * 0.90f);
            jScript.startINT       = (int)(_player.GetPrimaryAttribute(1).AdjustedBaseValue * 0.25f);
            jScript.startAGI       = (int)(_player.GetPrimaryAttribute(2).AdjustedBaseValue * 0.55f);
            break;

        case 2: BaseStat.BaseValue = 10;
            BaseStat.BuffValue     = 4;
            jScript.startATK       = (int)(_player.GetPrimaryAttribute(0).AdjustedBaseValue * 0.70f);
            jScript.startINT       = (int)(_player.GetPrimaryAttribute(1).AdjustedBaseValue * 1.25f);
            jScript.startAGI       = (int)(_player.GetPrimaryAttribute(2).AdjustedBaseValue * 0.45f);
            break;

        case 3: BaseStat.BaseValue = 10;
            BaseStat.BuffValue     = 4;
            jScript.startATK       = (int)(_player.GetPrimaryAttribute(0).AdjustedBaseValue * 0.80f);
            jScript.startINT       = (int)(_player.GetPrimaryAttribute(1).AdjustedBaseValue * 0.5f);
            jScript.startAGI       = (int)(_player.GetPrimaryAttribute(2).AdjustedBaseValue * 2.0f);
            break;

        case 4: BaseStat.BaseValue = 10;
            BaseStat.BuffValue     = 4;
            jScript.startATK       = (int)(_player.GetPrimaryAttribute(0).AdjustedBaseValue * 0.85f);
            jScript.startINT       = (int)(_player.GetPrimaryAttribute(1).AdjustedBaseValue * 0.5f);
            jScript.startAGI       = (int)(_player.GetPrimaryAttribute(2).AdjustedBaseValue * 1.45f);
            break;
        }

        if (!PlayerPrefs.HasKey("Player level"))
        {
            jScript.currentLV   = _player.Level;
            jScript.currentEXP  = _player.Exp;
            jScript.currentNEXT = _player.ExpToLvl;
            jScript.startLCK    = (int)(_player.GetPrimaryAttribute(3).AdjustedBaseValue * 0.1f);

            jScript.fullHP    = (_player.GetVital(0).AdjustedBaseValue *jScript.startATK) + jScript.fullHP;
            jScript.currentHP = jScript.fullHP;
            jScript.fullMP    = (_player.GetVital(1).AdjustedBaseValue *jScript.startINT) + jScript.fullMP;
            jScript.currentMP = jScript.fullMP;
        }
    }