本文整理汇总了C#中DataManager.saveToFile方法的典型用法代码示例。如果您正苦于以下问题:C# DataManager.saveToFile方法的具体用法?C# DataManager.saveToFile怎么用?C# DataManager.saveToFile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataManager
的用法示例。
在下文中一共展示了DataManager.saveToFile方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: saveGame
public void saveGame() {
GameObject playerGameObj = GameConstants.findPlayerInProject();
BasePlayer playerObj = playerGameObj.GetComponent<ToonCharacter_PlayerScript>().getBasePlayer();
playerObj.playerStats.updateSkillLevel();
playerObj.playerStats.updateInventoryDictionary();
//set position
playerObj.positionX = playerGameObj.transform.position.x;
playerObj.positionY = playerGameObj.transform.position.y;
playerObj.positionZ = playerGameObj.transform.position.z;
Vector3 rotation = playerGameObj.transform.eulerAngles;
playerObj.rotationX = rotation.x;
playerObj.rotationY = rotation.y;
playerObj.rotationZ = rotation.z;
DataManager dataManager = new DataManager ();
dataManager.saveToFile<BasePlayer> (playerObj, GameConstants.saveFileName);
this.showMessageBox ("Das Spiel wurde gespeichert");
}
示例2: savePlayer
public void savePlayer() {
BasePlayer player = new BasePlayer ();
player.playerName = this.playerNameInput.text;
player.playerType = this.currentPlayerType;
BaseCharacter character = new BaseCharacter ();
switch (this.currentPlayerType) {
case PlayerType.MELEE:
character = this.baseWarrior;
break;
case PlayerType.DISTANCE:
character = this.baseArcher;
break;
case PlayerType.MAGIC:
character = this.baseMage;
break;
}
player.playerStats = new PlayerStats();
player.playerStats.maxHealth = character.maxHealth;
player.playerStats.health = character.maxHealth;
player.playerStats.strength = character.strength;
player.playerStats.damageReduction = character.damageReduction;
player.playerStats.initSkillLevel (this.currentPlayerType);
player.positionX = warrior.transform.position.x;
player.positionY = warrior.transform.position.y;
player.positionZ = warrior.transform.position.z;
player.rotationX = warrior.transform.rotation.eulerAngles.x;
player.rotationY = warrior.transform.rotation.eulerAngles.y;
player.rotationZ = warrior.transform.rotation.eulerAngles.z;
GameConstants.newGame = true;
DataManager dataManager = new DataManager ();
dataManager.saveToFile<BasePlayer> (player, GameConstants.saveFileName);
NavigationManager navigationManager = GetComponent<NavigationManager> ();
navigationManager.LoadScene (GameConstants.sceneGame);
}