示例#1
0
    void Update()
    {
        if (play)
        {
            BlinkyUpdate();
            PinkyUpdate();
            InkyUpdate();
            ClydeUpdate();

            if (pelletsLeft < 214 && !inky.activated)
            {
                inky.Init();
            }
            else if (pelletsLeft < 184 && !clyde.activated)
            {
                clyde.Init();
            }

            if (pelletsLeft <= 0)
            {
                Won(1);
            }

            if (Input.GetKeyDown(KeyCode.O))
            {
                for (int i = 0; i < allGhosts.Length; i++)
                {
                    if (/*allGhosts[i].active &&*/ allGhosts[i].state != GhostState.Frightened && allGhosts[i].state != GhostState.Dead)
                    {
                        allGhosts[i].SetFrightened(6);
                    }
                }
            }
        }
    }
示例#2
0
    private IEnumerator StartGame(float time)
    {
        while (!play)
        {
            yield return(new WaitForSeconds(time));

            blinky.WakeUp();
            pinky.WakeUp();
            inky.WakeUp();
            clyde.WakeUp();

            pinky.Init();

            play        = true;
            pacman.play = true;
            blinky.play = true;
            pinky.play  = true;
            inky.play   = true;
            clyde.play  = true;
        }
    }