Ejemplo n.º 1
0
    void ResetStatsView()
    {
        int price = 0;

        if (PlayerStats.instance.stats.critPercentLv < 50)
        {
            crit1Lv.text      = PlayerStats.instance.stats.critPercentLv.ToString();
            crit1NextLv.text  = (PlayerStats.instance.stats.critPercentLv + 1).ToString();
            crit1Percent.text = ETC.GetCritHit(PlayerStats.instance.stats.critPercentLv).ToString() + "%";
            price             = (int)ETC.GetCoin(PlayerStats.instance.stats.critPercentLv);
            crit1Price        = ETC.Calculation(crit1Price, price);
        }
        else
        {
            crit1Lv.text      = "MAX Level";
            crit1NextLv.text  = "MAX";
            crit1Percent.text = ETC.GetCritHit(PlayerStats.instance.stats.critPercentLv).ToString() + "%";
            crit1Price.text   = "NONE";
        }

        if (PlayerStats.instance.stats.critDamageLv < 50)
        {
            crit2Lv.text     = PlayerStats.instance.stats.critDamageLv.ToString();
            crit2NextLv.text = (PlayerStats.instance.stats.critDamageLv + 1).ToString();
            crit2Damage.text = ETC.GetCritDmg(PlayerStats.instance.stats.critDamageLv).ToString() + "%";
            price            = (int)ETC.GetCoin(PlayerStats.instance.stats.critDamageLv);
            crit2Price       = ETC.Calculation(crit2Price, price);
        }
        else
        {
            crit2Lv.text     = "MAX Level";
            crit2NextLv.text = "MAX";
            crit2Damage.text = ETC.GetCritHit(PlayerStats.instance.stats.critPercentLv).ToString() + "%";
            crit2Price.text  = "NONE";
        }

        if (PlayerStats.instance.stats.coinPercentLv < 100)
        {
            coinLv.text      = PlayerStats.instance.stats.coinPercentLv.ToString();
            coinNextLv.text  = (PlayerStats.instance.stats.coinPercentLv + 1).ToString();
            coinPercent.text = PlayerStats.instance.stats.coinPercentLv.ToString() + "%";
            price            = (int)ETC.GetCoin(PlayerStats.instance.stats.coinPercentLv);
            coinPrice        = ETC.Calculation(coinPrice, price);
        }
        else
        {
            coinLv.text      = "MAX Level";
            coinNextLv.text  = "MAX";
            coinPercent.text = ETC.GetCritHit(PlayerStats.instance.stats.critPercentLv).ToString() + "%";
            coinPrice.text   = "NONE";
        }

        GameLogic.instance.Save();
    }
Ejemplo n.º 2
0
    void OnCollisionEnter2D(Collision2D other)
    {
        if (other.transform.tag == "Knife")
        {
            SoundManager.instance.PlaySound("몬스터 타격음");

            double       damage = 0f;
            DamageEffect obj    = Ingame.instance.poolDamageEffect.Spawn(transform.position);
            // 검 능력
            if (PlayerStats.instance.stats.knifeLv / 10 == 1 && Random.Range(1, 100) <= 30f)
            {
                Debug.Log("검 능력 발동");
                obj.GetComponent <DamageEffect>().isCrit = true;
                damage = (PlayerStats.instance.stats.knifeDamage + (PlayerStats.instance.stats.knifeDamage * 2f) * PlayerStats.instance.stats.moreDamage / PlayerStats.instance.stats.knifeDamage) + (PlayerStats.instance.stats.knifeDamage * PlayerStats.instance.stats.critDamageLv / PlayerStats.instance.stats.knifeDamage);
            }
            // 검 능력
            // 암살자의 검 능력
            else if (PlayerStats.instance.stats.knifeLv / 10 == 2 && Random.Range(1, 100) <= 30f)
            {
                Debug.Log("암살자 능력 발동");
                obj.GetComponent <DamageEffect>().isCrit = false;
                damage = (PlayerStats.instance.stats.knifeDamage + (PlayerStats.instance.stats.knifeDamage * PlayerStats.instance.stats.moreDamage / PlayerStats.instance.stats.knifeDamage)) * 2;
                Ingame.instance.poolHitEffect.Spawn(transform.position, new Quaternion(0, 0, 0.25f, 0.25f));
            }
            // 암살자의 검 능력
            // 기사의 검
            else if (PlayerStats.instance.stats.knifeLv / 10 == 3 && Random.Range(1, 100) <= 50f)
            {
                Debug.Log("기사 능력 발동");
                obj.GetComponent <DamageEffect>().isCrit = true;
                damage = (PlayerStats.instance.stats.knifeDamage + (PlayerStats.instance.stats.knifeDamage * 2f) * PlayerStats.instance.stats.moreDamage / PlayerStats.instance.stats.knifeDamage) + (PlayerStats.instance.stats.knifeDamage * PlayerStats.instance.stats.critDamageLv / PlayerStats.instance.stats.knifeDamage);
                Ingame.instance.poolHitEffect.Spawn(transform.position, new Quaternion(0, 0, 0.25f, 0.25f));
                Ingame.instance.poolHitEffect.Spawn(transform.position, new Quaternion(0, 0, 0.25f, 0.25f));
            }
            // 기사의 검
            // 블래스트 능력
            else if (PlayerStats.instance.stats.knifeLv / 10 == 5 && Random.Range(1, 100) <= 10f)
            {
                // 폭발 이펙트
                obj.GetComponent <DamageEffect>().isCrit = true;
                damage = (PlayerStats.instance.stats.knifeDamage + (PlayerStats.instance.stats.knifeDamage * PlayerStats.instance.stats.moreDamage / PlayerStats.instance.stats.knifeDamage)) * 3;
                Instantiate(explosionEffect, transform.position, transform.rotation);
            }
            else if (Random.Range(1, 100) <= PlayerStats.instance.stats.critPercent)
            {
                print("Crit");
                obj.GetComponent <DamageEffect>().isCrit = true;
                damage = (PlayerStats.instance.stats.knifeDamage + (PlayerStats.instance.stats.knifeDamage * PlayerStats.instance.stats.moreDamage / PlayerStats.instance.stats.knifeDamage) * 2) + (PlayerStats.instance.stats.knifeDamage * ETC.GetCritDmg(PlayerStats.instance.stats.critDamageLv) / PlayerStats.instance.stats.knifeDamage);
            }
            else
            {
                obj.GetComponent <DamageEffect>().isCrit = false;
                damage = PlayerStats.instance.stats.knifeDamage + (PlayerStats.instance.stats.knifeDamage * PlayerStats.instance.stats.moreDamage / PlayerStats.instance.stats.knifeDamage);
            }

            // 화염장미 검 능력
            if (PlayerStats.instance.stats.knifeLv / 10 == 4)
            {
                if (!isFire)
                {
                    StartCoroutine(Fire());
                }
            }
            // 화염장미 검 능력
            // 메카기어드 능력
            else if (PlayerStats.instance.stats.knifeLv / 10 == 7 && Random.Range(1, 100) <= 30f)
            {
                int n = Random.Range(1, 3);
                for (int i = 0; i <= n; i++)
                {
                    Ingame.instance.poolMekaGearEffect.Spawn(transform.position);
                }
            }
            // 메카기어드 능력
            // 인도자 능력
            else if (PlayerStats.instance.stats.knifeLv / 10 == 8)
            {
                Ingame.instance.poolSwordOraEffect.Spawn(transform.position);
            }
            // 인도자 능력

            obj.GetComponent <DamageEffect>().getDamage = (float)damage;
            enemyHP -= (float)damage;

            Ingame.instance.poolHitEffect.Spawn(transform.position);
        }

        // 블래스트 능력
        if (other.transform.tag == "Explosion")
        {
            if (!isFire)
            {
                StartCoroutine(Fire());
            }
        }
        // 블래스트 능력
        // 은하계 능력
        if (other.transform.tag == "BlackHole")
        {
            enemyHP = 0f;
            Ingame.instance.poolHitEffect.Spawn(transform.position);
        }
        // 은하계 능력
        // 메카기어드 능력
        if (other.transform.tag == "MekaGear")
        {
            DamageEffect obj = Ingame.instance.poolDamageEffect.Spawn(transform.position);
            obj.GetComponent <DamageEffect>().isCrit = true;
            // 폭발 이펙트
            double damage = (PlayerStats.instance.stats.knifeDamage + (PlayerStats.instance.stats.knifeDamage * PlayerStats.instance.stats.moreDamage / PlayerStats.instance.stats.knifeDamage)) * 3;
            Instantiate(explosionEffect, transform.position, transform.rotation);

            obj.GetComponent <DamageEffect>().getDamage = (float)damage;
            enemyHP -= (float)damage;

            Ingame.instance.poolHitEffect.Spawn(transform.position);
        }
        // 메카기어드 능력
        // 인도자 능력
        if (other.transform.tag == "SwordOra")
        {
            DamageEffect obj = Ingame.instance.poolDamageEffect.Spawn(transform.position);
            obj.GetComponent <DamageEffect>().isCrit = true;
            double damage = (PlayerStats.instance.stats.knifeDamage + PlayerStats.instance.stats.knifeDamage * PlayerStats.instance.stats.moreDamage / PlayerStats.instance.stats.knifeDamage) + (PlayerStats.instance.stats.knifeDamage * PlayerStats.instance.stats.critDamageLv / PlayerStats.instance.stats.knifeDamage);
            obj.GetComponent <DamageEffect>().getDamage = (float)damage;
            enemyHP -= (float)damage;

            Ingame.instance.poolHitEffect.Spawn(transform.position);
        }
        // 인도자 능력
    }