Beispiel #1
0
 void Update()
 {
     if (Input.GetMouseButtonDown(1) && Time.time > _NextFire)
     {
         _NextFire = Time.time + _Firerate;
         _playershoot.Shoot();
     }
 }
Beispiel #2
0
    void Update()
    {
        manaBar.value = currentMana;
        currentMana  += 0.1f;

        if (currentMana >= 100)
        {
            currentMana = 100;
        }
        if (currentMana <= 5)
        {
            isFire = false;
        }
        if (currentMana >= 6)
        {
            isFire = true;
        }
        if (currentMana <= 25)
        {
            bigFire = false;
        }
        if (currentMana >= 26)
        {
            bigFire = true;
        }

        if (isFire && Input.GetMouseButtonDown(0))
        {
            effect2.Play();
            var ray = Camera.main.ScreenPointToRay(Input.mousePosition);
            currentMana -= 5;
            if (Physics.Raycast(ray, out hit, 1000))
            {
                print(hit.point);
                if (hit.collider.gameObject.tag == "Enemy")
                {
                    audioSource.clip = audioClip;
                    audioSource.Play();
                    effect.transform.position = hit.point;
                    effect.Play();
                    Destroy(hit.collider.gameObject);
                    StartCoroutine(DoPHP(transform.position.x, transform.position.y));
                }
            }
        }
        //massiveshot
        if (Input.GetMouseButtonDown(1) && bigFire)
        {
            currentMana -= 25;

            _playershoot.Shoot();
        }
    }