public void CorrectData() { // Clamp lives and continues LivesCount = LivesCount.Clamp(0, 99); ContinuesCount = ContinuesCount.Clamp(0, 9); // Moskito has to be beaten before finishing Twilight Gulch if (!Levels[3].BeatBoss && Levels[9].IsUnlocked) { Levels[3].IsUnlocked = true; Levels[3].BeatBoss = true; } // Make sure The Musician has been helped under valid circumstances if (HasHelpedTheMusician && !Levels[9].IsUnlocked) { HasHelpedTheMusician = false; } else if (!HasHelpedTheMusician && Levels[11].IsUnlocked) { HasHelpedTheMusician = true; } // Mr Skops has to be beaten before unlocking Mr Dark's Dare if (!Levels[16].BeatBoss && Levels[17].IsUnlocked) { Levels[16].BeatBoss = true; } // All cages have to be collected for Mr Dark's Dare to be unlocked if (Levels[17].IsUnlocked && Levels.Any(x => x.HasCages && !x.HasAllCages)) { Levels[17].IsUnlocked = false; } }
private void Awake() { livesBar = FindObjectOfType <LivesCount>(); rigidbody = GetComponent <Rigidbody2D>(); animator = GetComponent <Animator>(); sprite = GetComponentInChildren <SpriteRenderer>(); bullet = Resources.Load <Bullet>("Bullet"); }
// Use this for initialization void Start() { rigidBody = GetComponent <Rigidbody> (); livesCount = GameObject.FindGameObjectWithTag("LifeCounter").GetComponent <LivesCount>(); randomItemGenerator = GameObject.FindGameObjectWithTag("RandomItemGenerator").GetComponent <RandomItemGenerator>(); if (!PlayerPrefs.HasKey("PlayerScore")) { PlayerPrefs.SetInt("PlayerScore", 0); } if (!PlayerPrefs.HasKey("PlayerLevel")) { PlayerPrefs.SetInt("PlayerLevel", 2); Debug.Log(PlayerPrefs.GetInt("PlayerLevel")); } mainCamera = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <MainCamera>(); }
// Use this for initialization void Start() { player = FindObjectOfType <Controller> (); gravityForce = player.GetComponent <Rigidbody2D> ().gravityScale; livesCount = FindObjectOfType <LivesCount> (); }