2022-06-02 14:25:22 +02:00
|
|
|
using System.Collections;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
public class PlayerPosition : MonoBehaviour
|
|
|
|
{
|
|
|
|
public float x, y, z;
|
|
|
|
|
|
|
|
public void SavePosition()
|
|
|
|
{
|
|
|
|
x = transform.position.x;
|
|
|
|
y = transform.position.y;
|
|
|
|
z = transform.position.z;
|
|
|
|
|
2022-10-01 19:28:26 +02:00
|
|
|
PlayerPrefs.SetFloat("player.position.x", x);
|
|
|
|
PlayerPrefs.SetFloat("player.position.y", y);
|
|
|
|
PlayerPrefs.SetFloat("player.position.z", z);
|
2022-06-02 14:25:22 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public void LoadPosition()
|
|
|
|
{
|
2022-10-01 19:28:26 +02:00
|
|
|
x = PlayerPrefs.GetFloat("player.position.x");
|
|
|
|
y = PlayerPrefs.GetFloat("player.position.y");
|
|
|
|
z = PlayerPrefs.GetFloat("player.position.z");
|
2022-06-02 14:25:22 +02:00
|
|
|
|
|
|
|
Vector3 LoadPosition = new Vector3(x, y, z);
|
|
|
|
transform.position = LoadPosition;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Start()
|
|
|
|
{
|
2022-10-01 19:28:26 +02:00
|
|
|
if (OnMapAppearanceMethod.Gateway == OnMapAppearanceMethodEnum.LoadGame)
|
2022-06-02 14:25:22 +02:00
|
|
|
{
|
|
|
|
LoadPosition();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2022-06-15 19:54:44 +02:00
|
|
|
|