void Shoot() { if (cooldown <= 0) { if (Input.GetMouseButtonDown(0)) { vfxScript.Reset(); } if (arrowPull < arrowPullMax) { if (Input.GetMouseButton(0)) { arrowPull += Time.deltaTime; if (arrowPull > 0.1f) { if (isPlaying0 == false) { vfxScript.FX1Play(); isPlaying0 = true; } } } } else { vfxScript.FX1Stop(); if (isPlaying1 == false) { vfxScript.FX2Play(); isPlaying1 = true; } } if (Input.GetMouseButtonUp(0)) { vfxScript.FX1Stop(); vfxScript.FX2Stop(); isPlaying0 = false; isPlaying1 = false; if (arrowPull >= arrowPullMax) { vfxScript.FX3Play(); vfxScript.UpdatePos3(Origin); } Reset(); } } else { cooldown -= Time.deltaTime; } }
private void Awake() { UpdateSpeed(); shotCount = 0; vfxScript = gameObject.GetComponent <VFXScript>(); vfxScript.Reset(); }
void Shoot() { if (cooldown <= 0) { if (Input.GetMouseButtonDown(0)) { vfxScript.Reset(); } if (arrowPull < arrowPullMax) { if (Input.GetMouseButton(0)) { arrowPull += Time.deltaTime; if (arrowPull > 0.1f) { if (isPlaying0 == false) { vfxScript.FX1Play(); isPlaying0 = true; } } } } else { vfxScript.FX1Stop(); if (isPlaying1 == false) { vfxScript.FX2Play(); isPlaying1 = true; } } if (Input.GetMouseButtonUp(0)) { vfxScript.FX1Stop(); vfxScript.FX2Stop(); isPlaying0 = false; isPlaying1 = false; bool crit = false; arrowDmg = (int)(arrowPull * maxDmg) / arrowPullMax; if (UnityEngine.Random.Range(0f, 1f) < critChance) { crit = true; Debug.Log("CRIT!!"); } if (arrowPull >= arrowPullMax) { vfxScript.FX3Play(); foreach (GameObject Bullet in BigBullets) { if (Bullet.GetComponent <BulletBehavior>().isMoving == false) { if (crit) { arrowDmg = arrowDmg * 2; } Bullet.GetComponent <BulletBehavior>().Shoot(Origin.transform, arrowDmg); shotCount += 3; break; } } vfxScript.UpdatePos3(Origin); } else { if (arrowDmg < minDmg) { arrowDmg = minDmg; } foreach (GameObject Bullet in SmlBullets) { if (Bullet.GetComponent <BulletBehavior>().isMoving == false) { if (crit) { arrowDmg = arrowDmg * 2; } Bullet.GetComponent <BulletBehavior>().Shoot(Origin.transform, arrowDmg); shotCount += 1; break; } } } Reset(); UpdateSpeed(); } } else { cooldown -= Time.deltaTime; } }
private void Awake() { vfxScript = gameObject.GetComponent <VFXScript>(); vfxScript.Reset(); }