本文整理汇总了C#中PlayerData类的典型用法代码示例。如果您正苦于以下问题:C# PlayerData类的具体用法?C# PlayerData怎么用?C# PlayerData使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PlayerData类属于命名空间,在下文中一共展示了PlayerData类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LoadPlayerData
void LoadPlayerData( )
{
_Rester.GetJSON( ServerURL + "/players/" + _PlayerId, ( err, result ) =>
{
_PlayerData = new PlayerData( result );
} );
}
示例2: load
public void load()
{
//Create the GameControl and a Player.
//Checks that loads are correctly done.
GameControl subGameControl = new GameControl();
PlayerData subPlayerData = new PlayerData();
subGameControl.playerData = subPlayerData;
subPlayerData.playerStr = 8;
subPlayerData.playerAgl = 7;
subPlayerData.playerDex = 6;
subPlayerData.playerInt = 5;
subPlayerData.playerVit = 4;
subPlayerData.currentGameLevel = 3;
subPlayerData.abilityPoints = 2;
subGameControl.Load();
Assert.That(subGameControl.playerStr == 8);
Assert.That(subGameControl.playerAgl == 7);
Assert.That(subGameControl.playerDex == 6);
Assert.That(subGameControl.playerInt == 5);
Assert.That(subGameControl.playerVit == 4);
Assert.That(subGameControl.currentGameLevel == 3);
Assert.That(subGameControl.abilityPoints == 2);
}
示例3: Save
public void Save(int score, int cubesDestroyed, int purpleCubes, int blueCubes, int redCubes, int yellowCubes, int greenCubes)
{
BinaryFormatter bf = new BinaryFormatter();
FileStream file = File.Create(Application.persistentDataPath + "/playerInfo.dat");
PlayerData data = new PlayerData();
if (score > data.highestScore)
{
data.highestScore = score;
data.isHighScore = true;
}
else
data.isHighScore = false;
data.totalScore += score;
data.cubesDestroyed += cubesDestroyed;
data.lastScore = score;
data.purpleCubes = purpleCubes;
data.blueCubes = blueCubes;
data.redCubes = redCubes;
data.yellowCubes = yellowCubes;
data.greenCubes = greenCubes;
bf.Serialize(file, data);
file.Close();
}
示例4: AddPlayer
public UiPlayerListItem AddPlayer(PlayerData player)
{
var instance = UiUtility.AddChild(List, Prototype, true);
instance.Tick.SetActive(false);
instance.Name.text = player.Name;
return instance;
}
示例5: Awake
// Use this for initialization
void Awake () {
pd = PlayerData.Instance;
//sm = SoundManagerScript.Instance;
efm = EffectSoundManagerScript.Instance;
scrollBar = GameObject.Find ("ScrollBar");
//loadNorm_N_Score ();
// sm = SoundManagerScript.Instance;
// sm.playSnd ();
go_HotMenuBase = GameObject.Find ("HotMenuBase");
go_HotMenu = GameObject.Find ("HotMenu");
go_FillRect_HotMenu = GameObject.Find ("FillRect_HotMenu");
go_FillRect_HotMenu.SetActive (false);
select_planet = 0;
go_Planet = new GameObject[PLANET_SIZE];
createPlanet ();
setScrollBarValue ();
}
示例6: Start
void Start()
{
player = GameObject.Find(_DATA).GetComponent<PlayerData>();
game = GameObject.Find(GAME_MANAGER).GetComponent<GameManager>();
Init();
}
示例7: GeneratePlayerData
PlayerData GeneratePlayerData(NetworkPlayer player)
{
PlayerData newPlayer = new PlayerData();
newPlayer.player = player;
newPlayer.team = -1;
return newPlayer;
}
示例8: Setup
public void Setup()
{
SETUP = MainTitleUI.getSetup();
PLAYERDATA = GameObject.FindGameObjectWithTag("PlayerData").GetComponent<PlayerData>();
PLAYERDATA.Launch();
ThumbGO = new GameObject("Thumbnails");
ThumbGO.transform.parent = gameObject.transform;
ThumbGO.transform.localPosition = new Vector3(0f,0f,0f);
levelName = FETool.findWithinChildren(gameObject, "LevelTitle/LEVEL_NAME").GetComponent<TextUI>();
_btnLeft = FETool.findWithinChildren(gameObject, "SelectLeft").GetComponent<LevelChooserButton>();
_btnRight = FETool.findWithinChildren(gameObject, "SelectRight").GetComponent<LevelChooserButton>();
Thumbs.Clear();
foreach (LevelInfo _lvl in PLAYERDATA.PROFILE.ActivatedLevels)
{
LevelThumbnail _th = CreateThumbnail(_lvl);
Thumbs.Add(_th);
}
for (int j = 0; j < Thumbs.Count ; j++)
{
// Thumbs[j].gameObject.transform.localPosition = new Vector3(0f,0f,0f);
Thumbs[j].gameObject.transform.localPosition = new Vector3(j * gapThumbs.x, 0f, gapThumbs.z);
}
Thumbs[0].isStartSlot = true;
Thumbs[Thumbs.Count-1].isEndSlot = true;
_btnLeft.Setup(this, LevelChooserButton.DirectionList.Left);
_btnRight.Setup(this, LevelChooserButton.DirectionList.Right);
currThumb = Thumbs[0];
levelName.text = currThumb.nameLv.ToString();
checkCurrThumb();
}
示例9: Start
void Start()
{
playerData = GameObject.FindGameObjectWithTag("PlayerData").GetComponent<PlayerData>();
UpdateDamage();
// Start Destroy timer
Destroy(gameObject, destroyTime);
}
示例10: setSprites
public void setSprites(PlayerData.Country myCountry)
{
int index = 0;
switch (myCountry) {
case PlayerData.Country.China:
index = 0;
break;
case PlayerData.Country.Japan:
index = 1;
break;
case PlayerData.Country.Russia:
index = 2;
break;
case PlayerData.Country.USA:
index = 3;
break;
}
myTorso.sprite = torso[index];
myFrontArm.sprite = frontArm[index];
myBackArm.sprite = backArm[index];
myFrontLeg.sprite = frontLeg[index];
myBackLeg.sprite = backLeg[index];
}
示例11: OnTriggerEnter
protected void OnTriggerEnter(Collider other)
{
if (other.tag == "Player" && other.name == "Player")
{
Player player = other.gameObject.GetComponent<Player>();
PlayerData data = new PlayerData();
if (changeScene)
{
// if checkpoint changes scene, save values for the new scene
data.playerPosition = DataManager.Vector3ToString(new Vector3(0, 0, 0));
// data.levelID = player.CurrentLevel + 1;
}
else
{
data.playerPosition = DataManager.Vector3ToString(other.gameObject.transform.position);
// data.levelID = player.CurrentLevel;
}
data.playerRotation = DataManager.Vector3ToString(other.gameObject.transform.localEulerAngles);
data.playerScale = DataManager.Vector3ToString(other.gameObject.transform.localScale);
data.playerEnergy = other.gameObject.GetComponent<Player>().LightEnergy.CurrentEnergy;
DataManager.SaveFile(data);
if (changeScene)
{
StartCoroutine(ChangeLevel());
}
}
}
示例12: ReadDBFile
void ReadDBFile(string file)
{
try
{
using(StreamReader sr = new StreamReader(Application.persistentDataPath + "/" + file))
{
//Leo linea a linea el contenido del archivo
string line;
//Mientras la linea tenga informacion, parceo su contenido
while((line = sr.ReadLine()) != null)
{
tmpData = line.Split('|');
playerData = new PlayerData(int.Parse(tmpData[0]), tmpData[1], DateTime.Parse(tmpData[2]));
}
}
}
catch(Exception e)
{
Debug.LogWarning("El archivo " + file + " no puede ser leido : " + e.Message);
playerData = new PlayerData();
playerData.items = 0;
playerData.name = "";
playerData.ultimaPartida = DateTime.Now;
SavePlayerData();
}
}
示例13: Save
public static void Save(PlayerData data) {
Stream stream = File.Open (currentFilePath, FileMode.Create);
BinaryFormatter formatter = new BinaryFormatter ();
formatter.Binder = new VersionDeserializationBinder ();
formatter.Serialize (stream, data);
stream.Close ();
}
示例14: Awake
void Awake()
{
playerData = GameObject.FindGameObjectWithTag("PlayerData").GetComponent<PlayerData>();
ApplyUpgrades();
ammo = _maxAmmo;
UpdateUI();
}
示例15: Clone
/// <summary>
/// 自分と同じ内容のオブジェクトを作成し、返却する関数
/// </summary>
/// <param name="obj"></param>
public PlayerData Clone()
{
PlayerData obj = new PlayerData();
obj.attack = this.attack;
obj.characterNumber = this.characterNumber;
obj.defense = this.defense;
obj.HP = this.HP;
obj.intelligence = this.intelligence;
obj.job = this.job;
obj.logoutScene = logoutScene;
obj.Lv = this.Lv;
obj.nowExp = this.nowExp;
obj.magicAttack = this.magicAttack;
obj.magicDefence = this.magicDefence;
obj.MaxHP = this.MaxHP;
obj.MaxSP = this.MaxSP;
obj.mnd = this.mnd;
obj.name = (string)this.name.Clone();
obj.skillLevel = new int[20];
for (int i = 0; i < 20; i++)
{
obj.skillLevel[i] = this.skillLevel[i];
}
obj.skillPoint = this.skillPoint;
obj.SP = this.SP;
obj.statusPoint = this.statusPoint;
obj.str = this.str;
obj.vit = this.vit;
obj.x = this.x;
obj.y = this.y;
obj.z = this.z;
return obj;
}