void Awake() { if (pieceVars == null) { pieceVars = Globals.pieceVars; } isFirstGridCleared = true; GridX = pieceVars.size; GridY = pieceVars.size; snd = GetComponent <SoundPlayer>(); }
public static void SetPieceColor(ref Piece piece, PieceColor color) { if (piece == null) { Debug.LogWarning("PieceFactory.SetPieceColor(): null Piece received!"); return; } PieceVars v = Piece.pieceVars; piece.color = color; piece.isAnimated = false; piece.SetAnimEnabled(false); switch (color) { case PieceColor.Red: piece.spriteRen.sprite = v.spriteRed; break; case PieceColor.Green: piece.spriteRen.sprite = v.spriteGreen; break; case PieceColor.Blue: piece.spriteRen.sprite = v.spriteBlue; break; case PieceColor.Yellow: piece.spriteRen.sprite = v.spriteYellow; break; case PieceColor.Purple: piece.spriteRen.sprite = v.spritePurple; break; case PieceColor.Gray: piece.spriteRen.sprite = v.spriteGray; break; case PieceColor.Wild: piece.spriteRen.sprite = v.spriteGray; piece.isAnimated = true; piece.SetAnimEnabled(true); break; case PieceColor.Undefined: piece.spriteRen.sprite = null; break; } }
protected override void Awake() { base.Awake(); SetAnimEnabled(false); // make sure we have initialized static members if (pieceVars == null) { pieceVars = Globals.pieceVars; pieceParent = new GameObject("__PieceParent__").transform; pFactory = SjParticleFactory.instance; } spriteTrans = spriteRen.GetComponent <Transform>(); color = PieceColor.Blue; align = Alignment.Horizontal; gridPos = -1; trans.parent = pieceParent; }
public static void SetPieceColor(ref Piece piece, PieceColor color) { PieceVars v = Piece.pieceVars; piece.color = color; piece.isAnimated = false; piece.SetAnimEnabled(false); switch (color) { case PieceColor.Red: piece.spriteRen.sprite = v.spriteRed; break; case PieceColor.Green: piece.spriteRen.sprite = v.spriteGreen; break; case PieceColor.Blue: piece.spriteRen.sprite = v.spriteBlue; break; case PieceColor.Yellow: piece.spriteRen.sprite = v.spriteYellow; break; case PieceColor.Purple: piece.spriteRen.sprite = v.spritePurple; break; case PieceColor.Gray: piece.spriteRen.sprite = v.spriteGray; break; case PieceColor.Undefined: piece.spriteRen.sprite = null; break; } }
void Awake() { pieceVars = Globals.pieceVars; }