Пример #1
0
    public void ResetScene()
    {
        CalmGhosts();

        pacman.transform.position = spawn;

        Pacdot[] pacdots = GameObject.FindObjectsOfType <Pacdot>();
        foreach (Pacdot p in pacdots)
        {
            if (p.state == Pacdot.State.Slow && Vector3.Distance(spawn, p.transform.position) <= spawnClearSlowRange)
            {
                p.Disable();
            }
        }

        blinky.transform.position = new Vector3(15f, 20f, 0f);
        pinky.transform.position  = new Vector3(14.5f, 17f, 0f);
        inky.transform.position   = new Vector3(16.5f, 17f, 0f);
        clyde.transform.position  = new Vector3(12.5f, 17f, 0f);

        pacman.GetComponent <PlayerController>().ResetDestination();
        blinky.GetComponent <GhostMove>().InitializeGhost();
        pinky.GetComponent <GhostMove>().InitializeGhost();
        inky.GetComponent <GhostMove>().InitializeGhost();
        clyde.GetComponent <GhostMove>().InitializeGhost();

        gameState = GameState.Init;
        gui.H_ShowReadyScreen();
    }
Пример #2
0
    public void ResetScene()
    {
        AssignGhosts();
        CalmGhosts();

        pacman.transform.position = new Vector3(15f, 11f, 0f);
        if (blinky != null)
        {
            blinky.transform.position = getRandomVector3();
        }
        if (pinky != null)
        {
            pinky.transform.position = getRandomVector3();
        }
        if (inky != null)
        {
            inky.transform.position = getRandomVector3();
        }
        if (clyde != null)
        {
            clyde.transform.position = getRandomVector3();
        }

        pacman.GetComponent <PlayerController>().ResetDestination();

        if (blinky != null)
        {
            blinky.GetComponent <GhostMove>().InitializeGhost();
        }
        if (pinky != null)
        {
            pinky.GetComponent <GhostMove>().InitializeGhost();
        }
        if (inky != null)
        {
            inky.GetComponent <GhostMove>().InitializeGhost();
        }
        if (clyde != null)
        {
            clyde.GetComponent <GhostMove>().InitializeGhost();
        }

        gameState = GameState.Init;
        gui.H_ShowReadyScreen();
    }
Пример #3
0
    public void ResetScene()
    {
        CalmGhosts();

        pacman.transform.position = new Vector3(15f, 11f, 0f);

        if (blinky != null)
        {
            blinky.transform.position = new Vector3(15f, 20f, 0f);
        }
        if (pinky != null)
        {
            pinky.transform.position = new Vector3(14.5f, 17f, 0f);
        }
        if (inky != null)
        {
            inky.transform.position = new Vector3(16.5f, 17f, 0f);
        }
        if (clyde != null)
        {
            clyde.transform.position = new Vector3(12.5f, 17f, 0f);
        }

        pacman.GetComponent <PacmanAI>().ResetVariables();

        if (blinky != null)
        {
            blinky.GetComponent <GhostMove>().InitializeGhost();
        }
        if (pinky != null)
        {
            pinky.GetComponent <GhostMove>().InitializeGhost();
        }
        if (inky != null)
        {
            inky.GetComponent <GhostMove>().InitializeGhost();
        }
        if (clyde != null)
        {
            clyde.GetComponent <GhostMove>().InitializeGhost();
        }

        gameState = GameState.Init;
        gui.H_ShowReadyScreen();
    }
Пример #4
0
    public void ResetScene()
    {
        CalmGhosts();

        pacman.transform.position = new Vector3(15f, 11f, 0f);
        blinky.transform.position = new Vector3(15f, 20f, 0f);
        pinky.transform.position  = new Vector3(14.5f, 17f, 0f);
        inky.transform.position   = new Vector3(16.5f, 17f, 0f);
        clyde.transform.position  = new Vector3(12.5f, 17f, 0f);

        pacman.GetComponent <PlayerController>().ResetDestination();
        blinky.GetComponent <GhostMove>().InitializeGhost();
        pinky.GetComponent <GhostMove>().InitializeGhost();
        inky.GetComponent <GhostMove>().InitializeGhost();
        clyde.GetComponent <GhostMove>().InitializeGhost();

        gameState = GameState.Init;
        gui.H_ShowReadyScreen();
    }
Пример #5
0
    public void ResetScene()
    {
        CalmGhosts();

        thanos.transform.position  = new Vector3(15f, 11f, 0f);
        thor.transform.position    = new Vector3(15f, 20f, 0f);
        captain.transform.position = new Vector3(14.5f, 17f, 0f);
        spyder.transform.position  = new Vector3(16.5f, 17f, 0f);
        hulk.transform.position    = new Vector3(12.5f, 17f, 0f);

        thanos.GetComponent <PlayerController>().ResetDestination();
        thor.GetComponent <GhostMove>().InitializeGhost();
        captain.GetComponent <GhostMove>().InitializeGhost();
        spyder.GetComponent <GhostMove>().InitializeGhost();
        hulk.GetComponent <GhostMove>().InitializeGhost();

        gameState = GameState.Init;
        gui.H_ShowReadyScreen();
    }
    public void ResetScene()
    {
        pacman.transform.position = new Vector3(15f, 11f, 0f);
        blinky.transform.position = new Vector3(15f, 20f, 0f);
        pinky.transform.position  = new Vector3(14.5f, 17f, 0f);
        inky.transform.position   = new Vector3(16.5f, 17f, 0f);
        clyde.transform.position  = new Vector3(12.5f, 17f, 0f);

        blinkyAI.maxSpeed = 0;
        pinkyAI.maxSpeed  = 0;
        inkyAI.maxSpeed   = 0;
        clydeAI.maxSpeed  = 0;

        pacman.GetComponent <PlayerController>().ResetDestination();

        gameState = GameState.Init;
        gui.H_ShowReadyScreen();

        StartCoroutine("WaitForMovement");
    }
Пример #7
0
    public void ResetScene()
    {
        //reset the scene by calming all ghosts and setting their positions back to default
        CalmGhosts();

        pacman.transform.position = new Vector3(15f, 11f, 0f);
        blinky.transform.position = new Vector3(15f, 20f, 0f);
        pinky.transform.position  = new Vector3(14.5f, 17f, 0f);
        inky.transform.position   = new Vector3(16.5f, 17f, 0f);
        clyde.transform.position  = new Vector3(12.5f, 17f, 0f);

        pacman.GetComponent <PlayerController>().ResetDestination();
        blinky.GetComponent <GhostMove>().InitializeGhost();
        pinky.GetComponent <GhostMove>().InitializeGhost();
        inky.GetComponent <GhostMove>().InitializeGhost();
        clyde.GetComponent <GhostMove>().InitializeGhost();
        //set the state back to initialize and show the ready screen to the player.
        gameState = GameState.Init;
        gui.H_ShowReadyScreen();
    }
Пример #8
0
    public void ResetScene()
    {
        PacmanHasMoved = false;

        if (lives == 0 && Level == 1)
        {
            LoadNextLevel();
            return;
        }

        if (lives == 0 && Level == 5)
        {
            NextLevel = "level_5_text";
            LoadNextLevel();
            return;
        }
        CalmGhosts();

        if (pacman != null)
        {
            if (Level == 4)
            {
                pacman.transform.position = new Vector3(13f, 30f, 0f);
            }
            else
            {
                pacman.transform.position = new Vector3(15f, 11f, 0f);
            }
        }

        if (blinky != null)
        {
            blinky.transform.position = new Vector3(15f, 20f, 0f);
        }
        if (pinky != null)
        {
            pinky.transform.position = new Vector3(14.5f, 17f, 0f);
        }
        if (inky != null)
        {
            inky.transform.position = new Vector3(16.5f, 17f, 0f);
        }
        if (clyde != null)
        {
            clyde.transform.position = new Vector3(12.5f, 17f, 0f);
        }

        if (pacman != null)
        {
            pacman.GetComponent <PlayerController>().ResetDestination();
        }
        if (blinky != null)
        {
            blinky.GetComponent <GhostMove>().InitializeGhost();
        }
        if (pinky != null)
        {
            pinky.GetComponent <GhostMove>().InitializeGhost();
        }
        if (inky != null)
        {
            inky.GetComponent <GhostMove>().InitializeGhost();
        }
        if (clyde != null)
        {
            clyde.GetComponent <GhostMove>().InitializeGhost();
        }

        if (ghosts != null)
        {
            foreach (var ghost in ghosts)
            {
                if (ghost != null)
                {
                    ghost.GetComponent <GhostMove>().MoveToStartPosition();
                    ghost.GetComponent <GhostMove>().InitializeGhost();
                }
            }
        }

        // Ruim gespawnde powerups op.
        foreach (var spawnedPowerup in PowerupSpawnPoints.Where(x => x != null && x.SpawnedObject != null).Select(x => x.SpawnedObject).ToArray())
        {
            Destroy(spawnedPowerup.gameObject);
        }

        // Zet de muur terug op z'n plek.
        if (MoveableWall != null)
        {
            MoveableWall.transform.position = MoveableWallBeginPosition;
        }

        InverseControls(false);
        ToggleSpeed(false);
        FlipAnimatorBack();

        gameState = GameState.Init;
        gui.H_ShowReadyScreen();
    }