public void NewGame() { player = FindObjectOfType <logan_player_controller>(); CameraFollow camera = FindObjectOfType <CameraFollow>(); camera.isFollowing = true; player.rb.bodyType = RigidbodyType2D.Dynamic; GlobalSceneChange.locationFrom = "MainMenu"; GlobalSceneChange.sceneFrom = SceneManager.GetActiveScene().name; healthUI.SetActive(true); SceneManager.LoadScene(sceneToNewGame); }
void OnMouseDown() { FindObjectOfType <CameraFollow>().isFollowing = true; logan_player_controller player = FindObjectOfType <logan_player_controller>(); player.rb.bodyType = RigidbodyType2D.Dynamic; GlobalSceneChange.locationFrom = loadingName; //GMScript.write_farm_to_file("farmtmp.txt",GMScript.farm,GMScript.numberOfPlotsWidth,GMScript.numberOfPlotsHeight); GMScript.write_farm_to_farm_data(GMScript.farm, GMScript.numberOfPlotsWidth, GMScript.numberOfPlotsHeight); GlobalSceneChange.sceneFrom = SceneManager.GetActiveScene().name; GMScript.healthUi.SetActive(true); SceneManager.LoadScene(sceneTo); }
public Vector3 cameraStart; //only used if not following // Start is called before the first frame update void Start() { if (GlobalSceneChange.sceneFrom.Equals(sceneFrom) && GlobalSceneChange.locationFrom.Equals(pointNameFrom)) { Debug.Log(GlobalSceneChange.sceneFrom); Debug.Log(GlobalSceneChange.locationFrom); player = FindObjectOfType <logan_player_controller>(); Debug.Log(player); player.transform.position = transform.position; if (!FindObjectOfType <CameraFollow>().isFollowing) { FindObjectOfType <Camera>().transform.position = cameraStart; } } }