private void Awake() { int lastWaypoint = 2; if (PlayerPrefs.HasKey("MapPos")) { if (PlayerPrefs.GetInt("MapPos") < 0 || PlayerPrefs.GetInt("MapPos") > waypoints.Length - 1) { PlayerPrefs.SetInt("MapPos", 2); } lastWaypoint = PlayerPrefs.GetInt("MapPos"); if (!waypoints[lastWaypoint].LevelInfo.Unlocked) { lastWaypoint = 2; } } currentWaypoint = waypoints[lastWaypoint - 1]; transform.position = currentWaypoint.transform.position; selectionInstance = Instantiate(selectionPrefab, transform.position + selectionOffset, selectionPrefab.transform.rotation); selectionInstance.transform.localScale = Vector3.one; selectionInstance.SetActive(true); levelInfoDisplay.UpdateDisplay(currentWaypoint.LevelInfo); levelInfoDisplay.Enter(); }
private IEnumerator Move(LevelMarker targetWaypoint) { selectionInstance.SetActive(false); movementTween = transform.DOJump(targetWaypoint.transform.position, 0.2f, 5, 1.5f); movementTween.SetEase(Ease.Linear); movementTween.Play(); levelInfoDisplay.Exit(); moving = true; yield return(new WaitForSeconds(1.5f)); levelInfoDisplay.UpdateDisplay(targetWaypoint.LevelInfo); levelInfoDisplay.Enter(); currentWaypoint = targetWaypoint; moving = false; selectionInstance.transform.position = transform.position + selectionOffset; selectionInstance.transform.localScale = Vector3.one; selectionInstance.SetActive(true); }
private void CreateLevelMarker(LevelMarker levelMarker) { _levels.Add(Instantiate(levelMarker, ContentImage.gameObject.transform)); _levels[_levels.Count - 1].SetNumber(_levels.Count); }