예제 #1
0
    private void CreateHitVFX()
    {
        GameObject vfx = PrefabManager.instance.InstantiatePrefabByName("CFX3_Hit_SmokePuff");

        vfx.transform.position = transform.position + Vector3.up * 0.5f;
        vfx.AddComponent <DestroyAfterTimeElapsed>().time = 1f;

        GameObject vfx2 = PrefabManager.instance.InstantiatePrefabByName("CFX_Hit_C White");

        vfx2.transform.position = transform.position + Vector3.up * 0.5f;
        vfx2.AddComponent <DestroyAfterTimeElapsed>().time = 1f;

        if (GetComponent <PlayerController>() != null)
        {
            // TODO bdsowers : The hit flash is wonky on Mac; disabling for now,
            // but we should fix it properly
            if (Application.platform != RuntimePlatform.OSXPlayer)
            {
                HitFlash hitFlash = GameObject.FindObjectOfType <HitFlash>();
                hitFlash.Flash();
            }

            if (Game.instance.playerData.Gender() == 0)
            {
                Game.instance.soundManager.PlaySound("male_hit");
            }
            else
            {
                Game.instance.soundManager.PlaySound("female_hit");
            }
        }
    }
예제 #2
0
    void TakeDamage(uint damage)
    {
        if (m_currentHealth <= damage)
        {
            m_currentHealth = 0;
        }
        else
        {
            m_currentHealth -= damage;
        }

        m_currentInvulnerabilityTime = m_invulnerabilityTime;
        m_hitFlash.Flash(m_hitFlashTime);
        m_audioManager.Play("SFX", "HurtPlayer");
        m_HeartsHealthVisual.UpdateHealth(m_currentHealth);
        m_cameraController.Shake();
        m_playerCollider.enabled = false;
    }
예제 #3
0
 private void TakeDamage(float damage)
 {
     m_hitFlash.Flash(m_hitFlashTime);
     m_audioManager.Play("SFX", "HurtEnemy");
     m_currentHealth = Mathf.Max(0, m_currentHealth - damage);
 }