// call to start coroutine Hop public void StartHop(int colorIndex) { //only hop when not already hopping if (hopperState != HOPPERSTATES.HOPPING) { hopperColor = (HopColor)colorIndex; hopperSprite.color = SetColorAppearance(hopperColor); ChangeHopperState(HOPPERSTATES.HOPPING); hopCoroutine = StartCoroutine(Hop()); // start hopping hopperTrail.enabled = true; Material trailMat = hopperTrail.material; trailMat.SetColor("_Color", SetColorAppearance(hopperColor)); } }
public Color SetColorAppearance(HopColor hopColor) { switch (hopColor) { case HopColor.RED: return(redAppearance); case HopColor.BLUE: return(blueAppearance); case HopColor.YELLOW: return(yellowAppearance); default: return(Color.white); } }
void Awake() { hopColor = HopColor.RED; explodeParticle.transform.SetParent(null); }