private IEnumerator GenSuperDot() { yield return(new WaitForSecond(Super_Dot_Time)); Pacdot[] allDots = GameObject.FindObjectsOfType <Pacdot>(); Pacdot superDot = allDots[RandomPath.Range(0, allDots.Length)]; superDot.MakeDotSuper(); }
public Tile(Game game, int column, int row, Texture2D colorMap) { // Data extraction rawData = new Color[1]; extractRegion = new Rectangle(column, row, 1, 1); colorMap.GetData <Color>(0, extractRegion, rawData, 0, 1); // Tile property initialization Index = row * 28 + column; Line = row; IsWall = false; IsEmpty = false; HasPacdot = false; HasEnergizer = false; Reset(); // Calculate position Position = new Vector2(column * 8, row * 8); Center = new Vector2(Position.X + 4.0f, Position.Y + 4.0f); Bounds = new Rectangle((int)Position.X, (int)Position.Y, 8, 8); // Collectibles Pacdot = new Pacdot(game, this); Energizer = new Energizer(game, this); // Developer mode only if (IsWall) { DevColor = Color.DarkRed; } else { DevColor = Color.Green; } }
void OnPacdotEaten(Pacdot pacdot) { currentScore += 10; UpdateScore(); pacdot.OnDestroyed -= OnPacdotEaten; }