Esempio n. 1
0
    public void Fire()
    {
        if (Time.time > nextAtk)
        {
            nextAtk = Time.time + atkRate;
            camShake.Shake(camShakeAmt, camShakeLength);
            AudioSrc.Play();

            for (int i = 0; i < targets.Count; i++)
            {
                if (targets.Count > 0)
                {
                    if (targets[i].tag == "Player" || targets[i].tag == "Enemy")
                    {
                        if (targets[i].GetComponent <Character>().isDead == false)
                        {
                            targets[i].GetComponent <Character>().TakeDamage(Damage);
                        }
                    }
                    if (targets[i].GetComponent <Rigidbody2D>() != null)
                    {
                        targets[i].GetComponent <Rigidbody2D>().AddForce(vecTovecToTrg.normalized * concQuote * -500.0f);
                    }
                }
            }
        }
    }
Esempio n. 2
0
 public override void PlayAudio()
 {
     if (AudioSrc == null)
     {
         this.InitAudioSrc();
     }
     AudioSrc.Play();
 }
Esempio n. 3
0
 public void Fire()
 {
     if (Time.time > nextAtk)
     {
         makeProjectile(emitPoint.transform.position, gameObject);
         nextAtk = Time.time + atkRate;
         camShake.Shake(camShakeAmt, camShakeLength);
         AudioSrc.Play();
     }
 }
Esempio n. 4
0
    private void Update()
    {
        hand1Tracked = hand1Controller.isTracked;
        hand2Tracked = hand2Controller.isTracked;
        if (playing)
        {
            if (GameManager.GM.hand1Tracked && GameManager.GM.hand2Tracked)
            {
                lastTracked = Time.time;
                if (paused)
                {
                    paused = false;
                    pauseScreen.SetActive(false);
                    cart.GetComponent <Rigidbody>().isKinematic = false;
                    InteractionManager.enabled = true;
                    foreach (AudioSource AudioSrc in audioSources)
                    {
                        AudioSrc.Play();
                    }
                }
            }

            if (Time.time > lastTracked + pauseDelay)
            {
                paused = true;
                pauseScreen.SetActive(true);
                cart.GetComponent <Rigidbody>().isKinematic = true;
                InteractionManager.enabled = false;
                foreach (AudioSource AudioSrc in audioSources)
                {
                    AudioSrc.Pause();
                }
            }

            if (paused)
            {
                pauseScreen.transform.GetChild(0).gameObject.SetActive(hand1Tracked);
                pauseScreen.transform.GetChild(1).gameObject.SetActive(hand2Tracked);
            }
        }
    }