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();
    }
예제 #2
0
        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;
            }
        }
예제 #3
0
 void OnPacdotEaten(Pacdot pacdot)
 {
     currentScore += 10;
     UpdateScore();
     pacdot.OnDestroyed -= OnPacdotEaten;
 }