예제 #1
0
    void HeartBeat()
    {
        if (!playerSFX)
        {
            playerSFX = GameObject.FindWithTag("Player").GetComponent <PlayerSFXManager> ();
        }

        if (!playerSFX)
        {
            return;
        }

        /**
         *  Heart beat effect when HP <= 25%.
         */
        if (healthBar.value / healthBar.maxValue <= 0.25f)
        {
            playerSFX.PlayHeartBeat(true);
            VFX.ToggleHeartBeatFlash(true);
        }
        else
        {
            playerSFX.PlayHeartBeat(false);
            VFX.ToggleHeartBeatFlash(false);
        }
    }
예제 #2
0
 private void Awake()
 {
     if (instance != null)
     {
         Debug.LogError("More than one Player SFX Manager in scene");
     }
     else
     {
         instance = this;
     }
 }
예제 #3
0
    void Awake()
    {
        healthBar = GetComponent <Slider> ();

        healthBar.minValue = 0;
        healthBar.maxValue = maxHP;

        cGroup = GetComponent <CanvasGroup> ();

        playerSFX = GameObject.FindWithTag("Player").GetComponent <PlayerSFXManager> ();
        VFX       = GameObject.FindWithTag("VisualEffect").GetComponent <VFXManager> ();

        // Add invincibility. Player is invincible during event.
        NotificationCentre.AddObserver(this, "OnEventEnter");
        NotificationCentre.AddObserver(this, "OnEventExit");
        NotificationCentre.AddObserver(this, "OnResumeFromCheckpoint");
        invincible = false;

        Initialize();
    }
예제 #4
0
 void Start()
 {
     player       = GetComponentInParent <PlayerWithSword>();
     mySFXManager = PlayerSFXManager.instance;
 }