/// <summary> /// Links the player to the platform they are n=on /// </summary> /// <param name="platform"></param> public void Attach_(Transform platform) { _platform = platform; // remove momentum _rigidBody.velocity = Vector2.zero; transform.SetParent(platform); _platformScript = _platform.GetComponent <MarshmallowScript>(); }
/// <summary> /// Checks if the player has collided with a finish platform /// </summary> /// <param name="collision">The item that was collided with</param> void CheckFinish_(Collision2D collision) { _currentPlatform = collision.gameObject.GetComponent <MarshmallowScript>(); if (_active) { // if the new platform is the finish if (collision.gameObject.name.Contains("End")) { // disable the player Active(false); // celebrate StartCoroutine(Celebrate()); } else { NextAction_(); } } }