Пример #1
0
    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;
        }
    }
Пример #2
0
    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;
        }
    }