Example #1
0
 // 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));
     }
 }
Example #2
0
    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);
        }
    }
Example #3
0
 void Awake()
 {
     hopColor = HopColor.RED;
     explodeParticle.transform.SetParent(null);
 }