コード例 #1
0
    public void SavePlayer()
    {
        SaveFile s = new SaveFile
        {
            stats              = player.stats,
            playerClass        = player.playerClass,
            xp                 = player.xp,
            lvl                = player.level,
            currentSkill       = player.skillPrimary ? player.skillPrimary.GetType() : null,
            currentWeapon      = WeaponClass.getWeaponClassFromWeapon(player.weapon),
            x_WaypointLocation = transform.position.x,
            y_WaypointLocation = transform.position.y,
            levelName          = SceneManager.GetActiveScene().name
        };

        saver.SaveData(s);
        spRenderer.sprite = enabledSprite;
    }
コード例 #2
0
ファイル: KeyScript.cs プロジェクト: Teth/Tec-mm-coursework
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.GetComponent <Player>() != null)
     {
         player = GameObject.FindGameObjectsWithTag("Player")[0].GetComponent <Player>();
         SaveFile s = new SaveFile
         {
             stats              = player.stats,
             playerClass        = player.playerClass,
             xp                 = player.xp,
             lvl                = player.level,
             currentSkill       = player.skillPrimary ? player.skillPrimary.GetType() : null,
             currentWeapon      = WeaponClass.getWeaponClassFromWeapon(player.weapon),
             x_WaypointLocation = spawn.x,
             y_WaypointLocation = spawn.y,
             levelName          = nextScene
         };
         saver.SaveData(s);
         SceneManager.LoadScene("preLoadLevel");
     }
 }