Пример #1
0
    // Late or its too early for FishSpawner
    void LateUpdate()
    {
        if (Input.GetButtonDown("Jump") && m_rodOut == false)
        {
            m_speechbubbleUpdater.ReflectText(". . .");
            m_fishSpawn          = Random.Range(m_minFishSpawn, m_maxFishSpawnTime);
            m_currentFishingTime = m_newFishingTime;
            m_fishermanUpdater.ReflectImage(m_normalFisherman, new Vector2(100, 100));
            m_fishUpdater.ResetImage();
            m_rodOut = true;
        }

        if (m_rodOut == true)
        {
            Fishing();
        }
    }
Пример #2
0
    public bool Fishing()
    {
        if (m_fishSpawn > 0.0f)
        {
            m_fishSpawn -= Time.deltaTime;

            if (Input.GetButtonDown("Fire1")) //pull rod back in
            {
                m_rodOut         = false;
                m_newFishingTime = m_defaultFishingTime;
                m_score          = 0;
                m_specialRolls   = 1;
                m_scoreUpdater.ReflectText("Score: " + m_score);
                m_speechbubbleUpdater.ReflectText("Too early!");
                m_fishermanUpdater.ReflectImage(m_pulledOutFisherman, new Vector2(100, 100));
            }
            return(false);
        }
        else if (m_fishSpawn <= 0.0f && m_rodOut)
        {
            m_fishSpawn = 0.0f;
            m_speechbubbleUpdater.ReflectText("! ! !");
            m_fishermanUpdater.ReflectImage(m_pulledInFisherman, new Vector2(100, 100));

            if (Input.GetButtonDown("Fire1")) //pull rod back in
            {
                m_rodOut = false;
                if (m_currentFishingTime > 0)
                {
                    m_newFishingTime--;
                    m_score++;
                    if (m_score % 10 == 0) //everytime m_score is 10 more
                    {
                        m_specialRolls++;
                    }
                    m_currentFishingTime = Mathf.Clamp(m_currentFishingTime, 0.15f, m_defaultFishingTime);
                    m_specialRolls       = Mathf.Clamp(m_specialRolls, 1, 6);
                    m_speechbubbleUpdater.ReflectText("Got 'em!");
                    m_scoreUpdater.ReflectText("Score: " + m_score);
                    m_fishermanUpdater.ReflectImage(m_pulledOutFisherman, new Vector2(100, 100));

                    return(true);
                }
                else
                {
                    m_newFishingTime = m_defaultFishingTime;
                    m_score          = 0;
                    m_specialRolls   = 1;
                    m_scoreUpdater.ReflectText("Score: " + m_score);
                    m_speechbubbleUpdater.ReflectText("Got away...");
                    m_fishermanUpdater.ReflectImage(m_pulledOutFisherman, new Vector2(100, 100));

                    return(false);
                }
            }
            m_currentFishingTime -= Time.deltaTime;
            return(false);
        }
        else
        {
            m_newFishingTime = m_defaultFishingTime;
            return(false);
        }
    }