Example #1
0
    public void UpdateRoundTimer(float time)
    {
        float ceiledTime = Mathf.Ceil(time);

        m_RoundTimer.text = ceiledTime.ToString();

        //End of countdown
        if (time <= 0.0f && m_RoundTimer.enabled)
        {
            m_RoundTimer.enabled = false;
            Scr_AudioManager.Play("BoxRing");
            foreach (GameObject countDown in m_CountDowns)
            {
                countDown.gameObject.SetActive(false);
            }
        }

        //Play sound
        if (time <= m_RoundTimeSecondFlag && m_RoundTimer.enabled)
        {
            Scr_AudioManager.Play("Countdown");
            m_RoundTimeSecondFlag -= 1.0f;

            if ((int)m_RoundTimeSecondFlag + 1 < m_CountDowns.Length)
            {
                m_CountDowns[(int)m_RoundTimeSecondFlag + 1].SetActive(false);      //FIX
            }
            m_CountDowns[(int)m_RoundTimeSecondFlag].SetActive(true);
        }
    }
Example #2
0
    void Start()
    {
        m_StoreSelected = m_MyEventSystem.firstSelectedGameObject;

        m_MyResolutions = Screen.resolutions;

        m_ResolutionDropDown.ClearOptions();

        List <string> options = new List <string>();

        int currentResolution = 0;

        for (int i = 0; i < m_MyResolutions.Length; ++i)
        {
            string option = m_MyResolutions[i].width + " x " + m_MyResolutions[i].height;
            options.Add(option);

            if (m_MyResolutions[i].width == Screen.currentResolution.width &&
                m_MyResolutions[i].height == Screen.currentResolution.height)
            {
                currentResolution = i;
            }
        }
        m_ResolutionDropDown.AddOptions(options);
        m_ResolutionDropDown.value = currentResolution;
        m_ResolutionDropDown.RefreshShownValue();

        //Song
        Scr_AudioManager.Play("MainMenuTheme");
    }
Example #3
0
    private void OnTriggerEnter(Collider other)
    {
        if (other.gameObject.tag == "Player")
        {
            Debug.Log(m_Rigidbody.velocity.magnitude);
            if (m_Rigidbody.velocity.magnitude > 0 && m_ThrownBy != null && m_ThrownBy != other.gameObject && m_IsThrown)
            {
                Scr_PlayerStateController state = m_ThrownBy.GetComponent <Scr_PlayerStateController>();
                if (!state.IsMomInRoom)
                {
                    Scr_ScoreManager.UpdateScore(m_ThrownBy, 500);
                }
                else
                {
                    Scr_ScoreManager.UpdateScore(m_ThrownBy, -50);
                }

                Vector3 dir = transform.forward + transform.up;
                other.gameObject.GetComponent <Scr_CharacterController>().AddImpact(dir, 250.0f);
                other.gameObject.GetComponent <Scr_Combat>().SetHitBy(gameObject);
                m_IsThrown = false;

                //gameObject.SetActive(false);
                Scr_AudioManager.SetRandomPitch("ObjectBreak");
                Scr_AudioManager.Play("ObjectBreak");
            }
        }
    }
Example #4
0
    // Update is called once per frame
    private void Update()
    {
        if (m_GameTime > 0.0f)
        {
            m_GameTime -= Time.deltaTime;
        }

        if (m_MomTimer >= 0.0f)
        {
            m_MomTimer -= Time.deltaTime;
        }

        if (m_MomTimer < m_MomComingTime && !m_IsWarningFired)
        {
            Scr_EventManager.TriggerEvent("Mom_Comes");
            Scr_AudioManager.Play("Suspense");
            m_IsWarningFired = true;

            m_SafeArrow.SetActive(true);
        }

        if (m_MomTimer < 0.0f)
        {
            if (!m_IsMomInRoom)
            {
                Scr_EventManager.TriggerEvent("Mom_In_Room");
                m_MomTimer    = m_MomStayTime;
                m_IsMomInRoom = true;
                m_SafeArrow.SetActive(false);
            }
            else
            {
                Scr_EventManager.TriggerEvent("Mom_Is_Leaving");
                SetRandomMomTimer();
                m_IsMomInRoom    = false;
                m_IsWarningFired = false;
            }
        }
    }
Example #5
0
    private void Punch()
    {
        //Punching
        if (Input.GetButtonDown(m_Input.GetFire()))
        {
            GameObject closestPlayer = GetClosestObjectWithTag("Player");
            m_AnimationController.Animate("Punch");

            if (closestPlayer != null)
            {
                Scr_PlayerStateController state = closestPlayer.GetComponent <Scr_PlayerStateController>();
                if (state.PlayerState != Scr_PlayerStateController.State.BabyBox)
                {
                    Vector3 dir = transform.forward + transform.up;
                    closestPlayer.GetComponent <Scr_CharacterController>().AddImpact(dir, m_PunchingPower);
                    closestPlayer.GetComponent <Scr_Combat>().SetHitBy(gameObject);
                    Scr_AudioManager.SetRandomPitch("PlayerPunch");
                    Scr_AudioManager.Play("PlayerPunch");
                    Scr_ScoreManager.UpdateScore(gameObject, 25);
                }
            }
        }
    }
Example #6
0
 public void LoadMenu()
 {
     Time.timeScale = 1.0f;
     Scr_AudioManager.Stop("WinScreen");
     SceneManager.LoadScene(0);
 }