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


C# DataManager.saveToFile方法代码示例

本文整理汇总了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");
	}
开发者ID:VtheunforgivenV,项目名称:DigitaleSpiele,代码行数:23,代码来源:UIManager_GameMenu.cs

示例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);
	}
开发者ID:VtheunforgivenV,项目名称:DigitaleSpiele,代码行数:42,代码来源:UIManager_ChoosePlayer.cs


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