| | |
| | | using Assets.Scripts.Enums; |
| | | using Assets.Scripts.Helpers; |
| | | using System; |
| | | using System.Collections; |
| | | using System.ComponentModel.Design; |
| | | using Unity.VisualScripting; |
| | | using UnityEngine; |
| | | using UnityEngine.InputSystem; |
| | | using UnityEngine.Tilemaps; |
| | | |
| | | [RequireComponent(typeof(Rigidbody2D))] |
| | | public class PlayerController : MonoBehaviour |
| | |
| | | boxCollider = GetComponent<BoxCollider2D>(); |
| | | if (SaveSystem.isGameLoaded) |
| | | { |
| | | GameObject uiManager = GameObject.Find("GameManager"); |
| | | uiManager.GetComponent<GameManager>().GameLoaded(); |
| | | SaveData save = SaveSystem.LoadPlayer(); |
| | | health.MaxHealth = save.maxHealth; |
| | | health.Health = save.health; |
| | | transform.position = VectorHelper.ConvertToVector3(save.position); |
| | | rb.velocity = VectorHelper.ConvertToVector2(save.velocity); |
| | | SaveSystem.isGameLoaded = false; |
| | | } |
| | | } |
| | | |