Exemplo n.º 1
0
    /// <summary>
    /// Moves and zooms into the specified position.
    /// </summary>
    /// <param name="pos">Zoom in.</param>
    /// <param name="camHeighSpeed">Speed for the zoom in.</param>
    /// <param name="camMin">camera maximum zoom in value.</param>
    /// <param name="maxZoomHeight">Max zoom height.</param>
    public void ZoomIn(Vector3 pos, float camHeighSpeed, int camMin, float maxZoomHeight)
    {
        if (!active)
        {
            cameraScript.EnableMovement(false);
            cameraScript.enabled = false;
            zoomOut   = false;
            zoomIn    = true;
            camHeight = cameraScript.cameraHeight;
            active    = true;
            resetOnce = true;

            // start movement.
            this.pos         = new Vector3(pos.x, pos.y, Camera.main.transform.position.z);
            zoomOutModifier  = -1.0f;
            maxZoomOutHeight = maxZoomHeight;

            this.camHeighSpeed = camHeighSpeed;

            if (debugging)
            {
                // DrawDebugImage(pos, "test");
                Debug.Log(("Zooming in on position=" + pos));
            }

            if (camMin > 0)
            {
                this.camMin = camMin;
            }
        }
    }
Exemplo n.º 2
0
 public void ToggleMenu()
 {
     // Fix slider drag an drop audio panel.
     if (cam != null)
     {
         cam.EnableMovement(panel.activeSelf);
     }
     StartCoroutine(CloseAfterTime());
 }
Exemplo n.º 3
0
    // OnStateExit is called before OnStateExit is called on any state inside this state machine
    override public void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        professorController = GameObject.FindWithTag("Professor").GetComponent <ProfessorController>();
        HotPotatoTimer hotpotatoTimer = FindObjectOfType <HotPotatoTimer>();

        // Init current level controller.
        levelController = LevelController.GetCurrentLevelController();

        if (stateInfo.IsName("Appear") || stateInfo.IsName("AppearBeer") || stateInfo.IsName("AppearBeerGlass") || stateInfo.IsName("AppearAngry") || stateInfo.IsName("AppearMoney"))
        {
            // Activate speech bubble.
            professorController.speechBubble.gameObject.SetActive(true);
            // Show speech bubble.
            professorController.speechBubble.SetVisible(true);
        }
        else if (stateInfo.IsName("Disappear") || stateInfo.IsName("DisappearBeer") || stateInfo.IsName("DisappearBeerGlass") || stateInfo.IsName("DisappearAngry") || stateInfo.IsName("DisappearMoney"))
        {
            professorController.SetVisible(false);
            // Hide professor button.
            ProfessorButton professorButton = FindObjectOfType <ProfessorButton>();
            if (professorButton != null)
            {
                professorButton.SetVisible(true);
            }
            // Deactivate speech bubble.
            professorController.speechBubble.gameObject.SetActive(false);

            // Enable gameplay interaction on current level controller.
            if (levelController != null)
            {
                levelController.SetGameInputEnabled(true);
            }

            // Invoke OnStopDisappear method on level controller.
            if (levelController != null)
            {
                levelController.OnStopProfessorDisappear();
            }

            // when hotpotato is active, resume timer when prof disappears
            if (hotpotatoTimer != null)
            {
                hotpotatoTimer.ResumeTimer();
            }

            //Enable Camera movement when the prof is gone.
            CameraFollowPlayer camera = FindObjectOfType <CameraFollowPlayer>();
            if (camera != null)
            {
                camera.EnableMovement(true);
            }
        }
    }
Exemplo n.º 4
0
    // OnStateEnter is called before OnStateEnter is called on any state inside this state machine
    override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        // Init current level controller.
        levelController = LevelController.GetCurrentLevelController();

        if (stateInfo.IsName("Walk"))
        {
            levelController.OnStartPlayerWalking();
            //disable movement of the cam when the prof is visible
            CameraFollowPlayer camera = FindObjectOfType <CameraFollowPlayer>();
            if (camera != null)
            {
                camera.EnableMovement(false);
            }
        }
        if (stateInfo.IsName("Jump"))
        {
            MovementScript ms = FindObjectOfType <MovementScript>();
            if (ms != null)
            {
                ms.StopJumping();
            }
        }
        if (stateInfo.IsName(("Idle")))
        {
            if (levelController != null)
            {
                if (levelController.levelStart)
                {
                    levelController.levelStart = false;
                }
                else
                {
                    levelController.OnEnterPlayerIdle();
                }
            }
        }
        if (stateInfo.IsName("DrinkBeer"))
        {
            FindObjectOfType <PlayerController>().SetDrinking(true);
        }
        if (stateInfo.IsName("ThrowBeer"))
        {
            FindObjectOfType <PlayerController>().StopThrowBeer();
        }
    }
Exemplo n.º 5
0
    // OnStateEnter is called before OnStateEnter is called on any state inside this state machine
    override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        professorController = GameObject.FindWithTag("Professor").GetComponent <ProfessorController>();
        HotPotatoTimer hotpotatoTimer = FindObjectOfType <HotPotatoTimer>();

        // Init current level controller.
        levelController = LevelController.GetCurrentLevelController();

        if (stateInfo.IsName("Appear") || stateInfo.IsName("AppearBeer") || stateInfo.IsName("AppearBeerGlass") || stateInfo.IsName("AppearAngry") || stateInfo.IsName("AppearMoney"))
        {
            professorController.SetVisible(true);
            // Hide professor button.
            ProfessorButton professorButton = FindObjectOfType <ProfessorButton>();
            if (professorButton != null)
            {
                professorButton.SetVisible(false);
            }
            // Disable gameplay interaction on current level controller.
            if (levelController != null)
            {
                levelController.SetGameInputEnabled(false);
            }
            //when hotpotato is the game mode and the prof appears, stop timers
            if (hotpotatoTimer != null)
            {
                hotpotatoTimer.PauseTimer();
                //disable movement of the cam when the prof is visible
                CameraFollowPlayer camera = FindObjectOfType <CameraFollowPlayer>();
                if (camera != null)
                {
                    camera.EnableMovement(false);
                }
            }
        }
        else if (stateInfo.IsName("Disappear") || stateInfo.IsName("DisappearBeer") || stateInfo.IsName("DisappearBeerGlass") || stateInfo.IsName("DisappearAngry") || stateInfo.IsName("DisappearMoney"))
        {
            // Hide speech bubble.
            professorController.speechBubble.SetVisible(false);
        }
        else if (stateInfo.IsName("Money") || stateInfo.IsName("Money2") || stateInfo.IsName("Money3"))
        {
            // Reset money animation flag.
            professorController.Money(false);
        }
    }
Exemplo n.º 6
0
    //OnStateExit is called before OnStateExit is called on any state inside this state machine
    override public void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        // Init current level controller.
        levelController = LevelController.GetCurrentLevelController();

        if (stateInfo.IsName("Walk"))
        {
            levelController.OnStopPlayerWalking();
            // Disable movement of the cam when the prof is visible.
            CameraFollowPlayer  camera = FindObjectOfType <CameraFollowPlayer>();
            ProfessorController professorController = FindObjectOfType <ProfessorController>();
            if (camera != null /*&& !professorController.IsVisible()*/)
            {
                camera.EnableMovement(true);
            }
        }

        if (stateInfo.IsName("DrinkBeer"))
        {
            levelController.OnStopPlayerDrink();
        }
    }