타이틀 화면에서 플레이버튼 누르면
데이터 불러오기를 3개 만들어놨어
근데 인게임에서 세이브를 하면 데이터 로드 버튼에 이미지를 씌우고 싶은데
어떻게 구현하면 좋을지 잘모르겠다.
오리와 눈먼숲이나 할로우나이트 보면 그 세이브 장소에 알맞게 저장하면
데이터 로드에 이미지가 갱신되는 것 처럼 만들고싶어
여기가 세이브 포인트
밑에는 PlayerPrefs를 사용한 코드
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace RonnieJ.ObjectPool
{
public class SaveData1 : MonoBehaviour
{
public DashMove dash;
public PlayerShoothing shoot;
public string DashMoveName;
public string PlayerShoothingName;
void Start()
{
dash = FindObjectOfType();
shoot = FindObjectOfType();
Load1();
}
public void Save1()
{
if (dash.GetDash == true)
{
PlayerPrefs.SetString("DashMove1", DashMoveName);
DashMoveName = "DashMove1";
}
if (shoot.GetPlayerShoothing == true)
{
PlayerPrefs.SetString("PlayerShoothing1", PlayerShoothingName);
PlayerShoothingName = "PlayerShoothing1";
}
PlayerPrefs.SetFloat("PlayerX1", transform.position.x);
PlayerPrefs.SetFloat("PlayerY1", transform.position.y);
Debug.Log("Save!");
}
public void Load1()
{
if (PlayerPrefs.GetString("DashMove1") == DashMoveName)
{
if (DashMoveName == "DashMove1")
{
dash.GetDash = true;
}
}
if (PlayerPrefs.GetString("PlayerShoothing1") == PlayerShoothingName)
{
if (PlayerShoothingName == "PlayerShoothing1")
{
shoot.GetPlayerShoothing = true;
}
}
float x = PlayerPrefs.GetFloat("PlayerX1");
float y = PlayerPrefs.GetFloat("PlayerY1");
transform.position = new Vector2(x, y);
Debug.Log("Load!");
}
public void Delete()
{
PlayerPrefs.DeleteKey("PlayerX1");
PlayerPrefs.DeleteKey("PlayerY1");
PlayerPrefs.DeleteKey("DashMove1");
PlayerPrefs.DeleteKey("PlayerShoothing1");
}
}
}
세이브할 때 어느 지점인지를 확인할 int를 저장시키고 그 int에 따라 지정된 이미지를 띄우는 건 어떰
세이브포인트가 별도로 있다면 윗놈말대로 하는게 현명하고 아니라면 세이브할 때 이미지 스샷찍어서 같이 저장해라.
ㅋㅋㅋ곰돌이 졸귀