// If the minion is hit by its color it is killed public override void AttackedBy(Palette.PalColor attackColor) { if (attackColor == this.color) { this.Die(); } }
// Casts a color on all enemies public void CastColor(Palette.PalColor color) { foreach (Enemy e in enemies) { e.AttackedBy(color); } }
public override void AttackedBy(Palette.PalColor attackColor) { if (eyes[nextEyeIndex].IsColor(attackColor)) { eyes[nextEyeIndex].KillEye(); nextEyeIndex++; if (nextEyeIndex == eyes.Length) { this.Die(); } } }
private Eye[] GetEyes(int numEyes) { Eye[] eyes = new Eye[numEyes]; for (int i = 0; i < numEyes; i++) { eyes[i] = Instantiate(eyeTemplate); eyes[i].transform.parent = this.transform; Palette.PalColor randomColor = (Palette.PalColor)Random.Range(4, 7); eyes[i].SetColorPos(randomColor, eyePositions[i]); } return(eyes); }
public bool IsColor(Palette.PalColor p) { return(p == this.color); }
public void SetColorPos(Palette.PalColor c, Vector2 p) { color = c; image.sprite = eyeImages[(int)color - 4]; // todo: fix transform.localPosition = p; }
// Called when a color is cast on the enemy public abstract void AttackedBy(Palette.PalColor attackColor);