public void ReleaseBubble() { //release current bubble if (bubble != null) { bubble.ChangeState(bubble.GetComponent <HeldState>()); bubble = null; } }
//Put other bubble script into this equation public override void CombineWith(Bubble other) { //Don't switch if we have a permanent bubble already if (isPermanent && bubble != null) { return; } //Debug.Log("holder combo ith bubble?"+other.number); //release current bubble ReleaseBubble(); //Hold the new bubble bubble = other; InEquationState equationState = other.GetComponent <InEquationState>(); other.ChangeState(equationState); equationState.holder = this; other.transform.position = transform.position; //attempt to solve the equation with the new bubble equation.AttemptSolve(); }