miepzerino
2023-12-19 61930cf21d3eb145df11ea2b719ae7be66c56d24
Assets/Scripts/PlayerController.cs
@@ -1,3 +1,4 @@
using Assets.Scripts.Helpers;
using System;
using System.ComponentModel.Design;
using UnityEngine;
@@ -12,12 +13,12 @@
    private float maxFallSpeedCurrent = 0f;
    Vector2 moveInput;
    Rigidbody2D rb;
    public Rigidbody2D rb;
    Animator animator;
    Animator animator_rotor;
    public GameObject rotorGO;
    TouchingDirections touchingDirections;
    Damageable health;
    public Damageable health;
    [SerializeField]
    private bool _isMoving;
@@ -76,6 +77,17 @@
        animator_rotor = rotorGO.GetComponent<Animator>();
        touchingDirections = GetComponent<TouchingDirections>();
        health = GetComponent<Damageable>();
        if (SaveSystem.isGameLoaded)
        {
            GameObject uiManager = GameObject.Find("UIManager");
            uiManager.GetComponent<UIManager>().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;
        }
    }
    private void FixedUpdate()