本文整理汇总了C#中PlayerPosition.SetPosition方法的典型用法代码示例。如果您正苦于以下问题:C# PlayerPosition.SetPosition方法的具体用法?C# PlayerPosition.SetPosition怎么用?C# PlayerPosition.SetPosition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlayerPosition
的用法示例。
在下文中一共展示了PlayerPosition.SetPosition方法的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!="");
}