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;
|
|
|
|
|
|
|
|
PlayerPrefs.SetFloat("x", x);
|
|
|
|
PlayerPrefs.SetFloat("y", y);
|
|
|
|
PlayerPrefs.SetFloat("z", z);
|
|
|
|
}
|
|
|
|
|
|
|
|
public void LoadPosition()
|
|
|
|
{
|
|
|
|
x = PlayerPrefs.GetFloat("x");
|
|
|
|
y = PlayerPrefs.GetFloat("y");
|
|
|
|
z = PlayerPrefs.GetFloat("z");
|
|
|
|
|
|
|
|
Vector3 LoadPosition = new Vector3(x, y, z);
|
|
|
|
transform.position = LoadPosition;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Start()
|
|
|
|
{
|
2022-06-15 19:54:44 +02:00
|
|
|
if (PlayerPrefs.GetInt("continued") == 1)
|
2022-06-02 14:25:22 +02:00
|
|
|
{
|
|
|
|
LoadPosition();
|
2022-06-15 19:54:44 +02:00
|
|
|
StartCoroutine(ChangeContinueValue());
|
2022-06-02 14:25:22 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-06-15 19:54:44 +02:00
|
|
|
private IEnumerator ChangeContinueValue()
|
|
|
|
{
|
|
|
|
yield return new WaitForSeconds(0.2f);
|
|
|
|
PlayerPrefs.SetInt("continued", 0);
|
2022-06-02 14:25:22 +02:00
|
|
|
|
2022-06-15 19:54:44 +02:00
|
|
|
}
|
2022-06-02 14:25:22 +02:00
|
|
|
}
|
2022-06-15 19:54:44 +02:00
|
|
|
|