Exemple #1
0
 public void LoadButton()
 {
     playerData = PlayerPresistance.LoadData();
     SceneManager.LoadScene(playerData.scene);
     Time.timeScale = 1f;
     gameIsPaused   = false;
     Debug.Log("działa");
 }
Exemple #2
0
    public IEnumerator RespawnPlayerCo()
    {
        yield return(new WaitForSeconds(0f));

        Transform    player      = (Transform)Instantiate(playerPrefab, PlayerPresistance.LoadData().location, spawnPoint.rotation);
        Transform    cube        = (Transform)Instantiate(cubePrefab, PlayerPresistance.LoadData().location, spawnPoint.rotation);
        CameraFollow cameraFolow = Camera.main.GetComponent <CameraFollow>();

        cameraFolow.target = player;
    }
    // Use this for initialization
    void Start()
    {
        cuteCube = GameObject.FindGameObjectWithTag("CuteCube");

        playerData = PlayerPresistance.LoadData();

        playerStats.Health = playerData.health;
        oldHealth          = playerStats.Health;


        animator         = GetComponent <Animator>();
        playerController = GetComponent <PlayerController>();
        rb2d             = GetComponent <Rigidbody2D>();
    }
 void OnTriggerEnter2D(Collider2D col)
 {
     Debug.Log("Ta scena" + SceneManager.GetActiveScene().buildIndex + "ilosc scen : " + SceneManager.sceneCountInBuildSettings);
     if (col.tag == "Player")
     {
         if (SceneManager.GetActiveScene().buildIndex < SceneManager.sceneCountInBuildSettings - 1)
         {
             PlayerPresistance.SaveData();
             SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex + 1);
         }
         else
         {
             SceneManager.LoadScene(0);
         }
     }
 }
 public void Save()
 {
     PlayerPresistance.SaveData(this);
 }
Exemple #6
0
 public void PlayGame()
 {
     SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex + 1);
     PlayerPresistance.SaveData();
 }
Exemple #7
0
 public void Continue()
 {
     playerData = PlayerPresistance.LoadData();
     SceneManager.LoadScene(playerData.scene);
 }