Example #1
0
 private void Fire()
 {
     if (Input.GetButtonDown(m_Input.GetFire()))
     {
         Scr_EventManager.TriggerEvent("Fire_Projectile");
     }
 }
    public static void UpdateScore(GameObject player, int amount)
    {
        int currentScore = 0;

        if (Instance.m_ScoreDictionary.TryGetValue(player.name, out currentScore))
        {
            currentScore += amount;
            if (currentScore < 0)
            {
                currentScore = 0;
            }

            Instance.m_ScoreDictionary[player.name] = currentScore;
        }
        else
        {
            if (amount < 0)
            {
                amount = 0;
            }
            Instance.m_ScoreDictionary.Add(player.name, amount);
        }

        Scr_EventManager.TriggerEvent("Update_Scores");
    }
    public bool PickupPowerup(Scr_PowerUp.Type type)
    {
        if (m_HeldPowerup == Scr_PowerUp.Type.Empty)
        {
            m_HeldPowerup = type;
            Scr_EventManager.TriggerEvent("PowerupUpdate");
            return(true);
        }

        return(false);
    }
    public void ResetPlayerState()
    {
        gameObject.GetComponent <Scr_CharacterController>().SetSpeed(m_OriginalSpeed);
        gameObject.GetComponent <Scr_CharacterController>().SetMaxJumps(m_OriginalNrOfMaxJumps);
        gameObject.GetComponent <Scr_Combat>().SetPunchingPower(m_OriginalPunchingPower);
        m_PowerupTimer  = m_OriginalPowerupTimer;
        m_HeldPowerup   = Scr_PowerUp.Type.Empty;
        m_MustCountDown = false;

        m_SpeedParticle.SetActive(false);
        m_PowerParticle.SetActive(false);

        Scr_EventManager.TriggerEvent("PowerupUpdate");
    }
Example #5
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;
            }
        }
    }