public void Die()
 {
     this.rigid_body.isKinematic = true;
     this.GetComponent <SpriteRenderer> ().enabled = false;
     this.current_state     = MeemoState.Normal;
     gameOverCanvas.enabled = true;
 }
    void Update()
    {
        this.grounded   = Physics2D.OverlapCircle(this.ground_check.position, this.ground_radius, this.what_is_ground);
        this.move_speed = 0f;
        if (Input.GetKey("space") && this.star_timer > 0f)
        {
            is_using_power = true;
            this.PowerAnimation.Play();
        }
        else
        {
            is_using_power = false;
            this.PowerAnimation.Pause();
            this.PowerAnimation.Clear();
        }
        switch (this.current_state)
        {
        case MeemoState.Bubble:
            if (Input.GetAxis("Horizontal") != 0f)                // When meemo is controlling the horizontal direction
            {
                this.move_in_bubble();
            }
            else                 // When meemo is following bubble
            {
                this.follow_in_bubble();
            }
            this.change_direction();
            break;

        case MeemoState.Normal:
            this.move_speed = Input.GetAxis("Horizontal") * max_speed;
            this.change_direction();
            break;

        case MeemoState.Hurt:
            if (this.health_bar.curNumOfHearts > 0)
            {
                this.health_bar.curNumOfHearts--;
            }
            if (this.health_bar.curNumOfHearts == 0)
            {
                this.Die();
            }
            else
            {
                this.current_state = MeemoState.Invincible;
            }
            break;

        case MeemoState.Invincible:
            this.hurt_timer += Time.deltaTime;
            if (this.hurt_timer > MAX_HURT_TIME)
            {
                this.current_state = MeemoState.Normal;
                this.hurt_timer    = 0f;
            }
            break;
        }
    }
 // Use this for initialization
 void Start()
 {
     this.globalBehavior = GameObject.Find("Main Camera").GetComponent <CameraBehavior>();
     mSize                  = GetComponent <Renderer> ().bounds.size;
     this.health_bar        = GameObject.Find("HealthBar").GetComponent <HealthBar_interaction> ();
     this.rigid_body        = this.GetComponent <Rigidbody2D>();
     isInBubble             = false;
     isFacingRight          = true;
     this.star_bar          = GameObject.Find("StarBar").GetComponent <StarBar_interaction> ();
     gameOverCanvas         = GameObject.Find("GameOverCanvas").GetComponent <Canvas> ();
     this.PowerAnimation    = GameObject.Find("PowerParticle").GetComponent <ParticleSystem> ();
     gameOverCanvas.enabled = false;                 // The GameOverCanvas has to be initially enabled on the Unity UI
     current_state          = MeemoState.Normal;
 }