コード例 #1
0
 // Casts the color, removing it from the palette and affecting creatures
 private void CastColor()
 {
     if (!frozen)
     {
         // StartCoroutine(FreezeCasting(freezeTime));
         if (this.color != PalColor.None)
         {
             StartCoroutine(CastingAnimation(this.color));
         }
         this.color = PalColor.None;
     }
 }
コード例 #2
0
    private IEnumerator CastingAnimation(PalColor c)
    {
        paintSound.Play();
        int i = (int)c - 1;

        this.castImage.sprite  = castSprites[(4 * i) + 0];
        this.castImage.enabled = true;
        yield return(new WaitForSeconds(castingFrameDelay));

        this.castImage.sprite = castSprites[(4 * i) + 1];
        yield return(new WaitForSeconds(castingFrameDelay));

        enemyManager.CastColor(c);
        this.castImage.sprite = castSprites[(4 * i) + 2];
        yield return(new WaitForSeconds(castingFrameDelay));

        this.castImage.sprite = castSprites[(4 * i) + 3];
        yield return(new WaitForSeconds(castingFrameDelay));

        this.castImage.enabled = false;
    }
コード例 #3
0
 // Naive color mixing system (all done with conditionals)
 public void MixColor(PalColor toMixColor)
 {
     if (color == toMixColor || color == PalColor.Brown)
     {
         return;
     }
     if (color == PalColor.None)
     {
         color = toMixColor;
         return;
     }
     if (color == PalColor.Green)
     {
         if (toMixColor == PalColor.Red)
         {
             color = PalColor.Brown;
         }
         return;
     }
     if (color == PalColor.Purple)
     {
         if (toMixColor == PalColor.Yellow)
         {
             color = PalColor.Brown;
         }
         return;
     }
     if (color == PalColor.Orange)
     {
         if (toMixColor == PalColor.Blue)
         {
             color = PalColor.Brown;
         }
         return;
     }
     if (toMixColor == PalColor.Red)
     {
         if (color == PalColor.Yellow)
         {
             color = PalColor.Orange;
         }
         else   // color == Blue
         {
             color = PalColor.Purple;
         }
     }
     if (toMixColor == PalColor.Yellow)
     {
         if (color == PalColor.Red)
         {
             color = PalColor.Orange;
         }
         else   // color == Blue
         {
             color = PalColor.Green;
         }
     }
     if (toMixColor == PalColor.Blue)
     {
         if (color == PalColor.Red)
         {
             color = PalColor.Purple;
         }
         else   // color == Yellow
         {
             color = PalColor.Green;
         }
     }
 }
コード例 #4
0
 // Converts a PalColor enum to a UI.graphic.Color for display on a UI image
 private Sprite EnumToSprite(PalColor col)
 {
     return(this.paletteSprites[(int)col]);
 }