当前位置: 首页>>代码示例>>C#>>正文


C# PlayerPosition.Awake方法代码示例

本文整理汇总了C#中PlayerPosition.Awake方法的典型用法代码示例。如果您正苦于以下问题:C# PlayerPosition.Awake方法的具体用法?C# PlayerPosition.Awake怎么用?C# PlayerPosition.Awake使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PlayerPosition的用法示例。


在下文中一共展示了PlayerPosition.Awake方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: LoadData

    /// <summary>
    /// Loads the data.
    /// </summary>
    public void LoadData()
    {
        GameObject objGame = GameObject.FindGameObjectWithTag ("Constant");

        StoredInformation storedIN = objGame.GetComponent<StoredInformation>();

        characterName = PlayerPrefs.GetString ("Player Name");
        storedIN.characterName = PlayerPrefs.GetString ("Player Name");

        moneyTotal = PlayerPrefs.GetInt("Money");

        level = PlayerPrefs.GetInt("Level");
        experience = PlayerPrefs.GetInt("Experience");

        storedIN.level = level;
        storedIN.experience = experience;

        if(PlayerPrefs.GetInt("ExperienceTONextLevel")<=1){
            nextLevelvalue = experience*1.2f;
            storedIN.nextLevelvalue = experience*1.2f;

            storedIN.nextLevel = (int)(experience*1.2f);
            nextLevel = (int)(experience*1.2f);

        }else{
            nextLevelvalue = (float)PlayerPrefs.GetInt("ExperienceTONextLevel");
            storedIN.nextLevelvalue = (float)PlayerPrefs.GetInt("ExperienceTONextLevel");
            storedIN.nextLevel = PlayerPrefs.GetInt("ExperienceTONextLevel");
            nextLevel = PlayerPrefs.GetInt("ExperienceTONextLevel");

        }

        storedIN.positionOnScreen.x=PlayerPrefs.GetFloat("Position - x");
        storedIN.positionOnScreen.y=PlayerPrefs.GetFloat("Position - y");
        storedIN.positionOnScreen.z=PlayerPrefs.GetFloat("Position - z");
        if(Application.loadedLevelName!="Game"){
            PlayerPosition pl;

            pl = new PlayerPosition();
            pl.Awake();

            pl.SetPosition(storedIN.positionOnScreen,Application.loadedLevelName);
        }
        #region - modified code region
        ///<summary>
        /// Title: Hack & Slash RPG - A Unity3D Game Engine Tutorial | BurgZerg Arcade. [Online].;
        /// Author: Laliberte P.
        /// Date: 2013 October 24.
        /// Available from: http://www.burgzergarcade.com/hack-slash-rpg-unity3d-game-engine-tutorial
        /// </summary>
        for (int cnt = 0; cnt < Enum.GetValues(typeof(AttributeName)).Length; cnt++) {
            storedIN._primaryAttribute[cnt]=PlayerPrefs.GetString("Attribute Name - " + cnt);
            storedIN._primaryAttributeValues[cnt] = PlayerPrefs.GetInt (((AttributeName)cnt).ToString () + " - Base Value - " + cnt);
        }

        for (int cnt = 0; cnt < Enum.GetValues(typeof(VitalName)).Length; cnt++) {
            storedIN._vital[cnt]=PlayerPrefs.GetString("Vital Name - " + cnt);
            storedIN._vitalValue[cnt] = PlayerPrefs.GetInt (((VitalName)cnt).ToString () + " - Base Value - " + cnt);
        }

        for (int cnt = 0; cnt < Enum.GetValues(typeof(AttackName)).Length; cnt++) {
            storedIN._attack[cnt]=PlayerPrefs.GetString("Attack Name - " + cnt);
            storedIN._attackValue[cnt] = PlayerPrefs.GetInt (((AttackName)cnt).ToString () + " - Base Value - " + cnt);
        }

        for (int cnt = 0; cnt < Enum.GetValues(typeof(ManaName)).Length; cnt++) {
            storedIN._mana[cnt]=PlayerPrefs.GetString("Mana Name - " + cnt);
            storedIN._manaValue[cnt] = PlayerPrefs.GetInt (((ManaName)cnt).ToString () + " - Base Value - " + cnt,0);
        }

        for (int cnt = 0; cnt < Enum.GetValues(typeof(DefenceName)).Length; cnt++) {
            storedIN._defence[cnt]= PlayerPrefs.GetString("Defence Name - " + cnt);
            storedIN._defenceValue[cnt] = PlayerPrefs.GetInt (((DefenceName)cnt).ToString () + " - Base Value - " + cnt);
        }
        #endregion
        string itemFromSave= string.Empty;
        int itemCounting =0;

        do{
            itemFromSave = PlayerPrefs.GetString("Items - " + itemCounting);

            string ItemPowerFromSave = PlayerPrefs.GetString ("Items Power - " + itemCounting);
            if(itemFromSave!="")
                storedIN.addItems(itemFromSave,ItemPowerFromSave);
            itemCounting++;
        }while(itemFromSave!="");
    }
开发者ID:kharris291,项目名称:Fourth-Year-Project,代码行数:90,代码来源:StoredInformation.cs


注:本文中的PlayerPosition.Awake方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。