IEnumerator WaitForSpline() { yield return(new WaitForSeconds(0.6f)); Current.GetComponent <SpriteRenderer>().enabled = false; Upcoming.GetComponent <SpriteRenderer>().enabled = false; }
void Start() { Current_Color = GetNextColor(); next_Color = GetNextColor(); Current.GetComponent <Current_Cannon_Switcher>().this_switch_color = Current_Color; Upcoming.GetComponent <Current_Cannon_Switcher>().this_switch_color = next_Color; }
/** * Returns a current color on demand of the new bubble which is to be shoot * Assigns next color to current color and requests a new next color from GetNextColor() **/ public ColorProperty GetCurrent() { ColorProperty temp = Current_Color; Current_Color = next_Color; if (GamePrefs.NO_OF_BUBBLES > 1) { upComing2.gameObject.GetComponent <UpComingColors>().BubbleCountOneLock = false; next_Color = GetNextColor(); Current.GetComponent <Current_Cannon_Switcher>().this_switch_color = Current_Color; Upcoming.GetComponent <Current_Cannon_Switcher>().this_switch_color = next_Color; //UpdateUpColor(); // Update coming color spriteRenderer SpriteRenderer sp = Up_Color.GetComponent <SpriteRenderer>(); switch (next_Color) { case ColorProperty.Green: //sp.sprite = gameManager.sp_bubble[0]; break; case ColorProperty.Blue: // sp.sprite = gameManager.sp_bubble[1]; break; case ColorProperty.Yellow: //sp.sprite = gameManager.sp_bubble[2]; break; case ColorProperty.Red: //sp.sprite = gameManager.sp_bubble[3]; break; case ColorProperty.Purple: //sp.sprite = gameManager.sp_bubble[4]; break; case ColorProperty.Black: //sp.sprite = gameManager.sp_bubble[5]; break; } } else { //Cannot Flip Code Here //.GetComponent<SpriteRenderer>().sprite = null; upComing2.gameObject.GetComponent <UpComingColors>().BubbleCountOneLock = true; upComing1.sprite = null; upComing2.sprite = null; } //print("Current "+Current_Color); //print("Next" + next_Color); return(Current_Color); }
/** * flip action is called when user switches between bubbles in game **/ public void flip() { Current.GetComponent <SpriteRenderer>().enabled = true; Upcoming.GetComponent <SpriteRenderer>().enabled = true; //print("Current Object color before flip" + Current.GetComponent<Current_Cannon_Switcher>().this_switch_color); //print("Next Object color before flip" + Upcoming.GetComponent<Current_Cannon_Switcher>().this_switch_color); //print("Current Color Before Flip " + Current_Color); //print("Next Color Before Flip " + next_Color); ColorProperty temp = Current_Color; Current_Color = next_Color; next_Color = temp; Current.GetComponent <Current_Cannon_Switcher>().this_switch_color = next_Color; Upcoming.GetComponent <Current_Cannon_Switcher>().this_switch_color = Current_Color; //print("Current Color After Flip " + Current_Color); //print("Next Color After Flip " + next_Color); ///---------------------------------------------------------------------- /// //Current.GetComponent<SplineInterpolator>().Reset(); //Upcoming.GetComponent<SplineInterpolator>().Reset(); //Current.GetComponent<SplineController>().enabled = true; //Upcoming.GetComponent<SplineController>().enabled = true; //Upcoming Current.GetComponent <SplineController>().FollowSpline(); Upcoming.GetComponent <SplineController>().FollowSpline(); GameObject temp3 = Current_SplineRoot; Current_SplineRoot = Upcoming_SplineRoot; Upcoming_SplineRoot = temp3; StartCoroutine("WaitForSpline"); UpdateUpColor(); //update upcoming color }