Ejemplo n.º 1
0
    new public void Update()
    {
        //base.Update();
        if (hp <= 0)
        {
            //Удалить все эффекты
            fightController.enemies.Remove(this);
            DestroyHalo(halo);
            Death();
        }
        HB.GetComponentInChildren <TextMeshProUGUI>().text = $"{Mathf.Ceil(hp)}/{Mathf.Ceil(maxhp)}";
        if (time > 0)
        {
            time -= Time.deltaTime;
        }
        else
        {
            time = cooldown;
            float r = Random.Range(0, 2);
            switch (r)
            {
            case 0:
                SetTargetRandom();
                StartCoroutine(AtakeAnim());
                AttackTimeout = AttackCooldown;
                float dam = Random.Range(DamageMin, DamageMax) * (1 + power / 100);
                AttackTarget.TakeDamage(dam);
                TakeHeal(dam);
                StartCoroutine(AttackTarget.TakingDamageAnim());
                break;

            case 1:
                foreach (var x in fightController.friends)
                {
                    var st = Instantiate(vulnerability, x.transform);
                    st.Name      = "Уязвимость";
                    st.lifetime  = 8;
                    st.koef      = Information.GetEffectStates("Уязвимость", 1, 0)[0];
                    st.character = x;
                    x.TakeDamage(3);
                }
                break;
            }
        }
    }
Ejemplo n.º 2
0
    new public void Update()
    {
        allTime += Time.deltaTime;
        //base.Update();
        if (hp <= 0)
        {
            //Удалить все эффекты
            fightController.enemies.Remove(this);
            DestroyHalo(halo);
            Death();
        }
        HB.GetComponentInChildren <TextMeshProUGUI>().text = $"{Mathf.Ceil(hp)}/{Mathf.Ceil(maxhp)}";
        if (time > 0)
        {
            time -= Time.deltaTime;
        }
        else
        {
            time = cooldown;
            float r = Random.Range(0, 3);
            switch (r)
            {
            case 0:
                foreach (var x in fightController.friends)
                {
                    var st = Instantiate(weak, x.transform);
                    st.Name      = "Ослабление";
                    st.lifetime  = 8;
                    st.percent   = Information.GetEffectStates("Ослабление", 0, -50)[0];
                    st.power     = -20;
                    st.character = x;
                    x.TakeDamage(damage);
                }
                break;

            case 1:
                SetTargetRandom();
                StartCoroutine(AtakeAnim());
                AttackTimeout = AttackCooldown;
                AttackTarget.TakeDamage(Random.Range(DamageMin, DamageMax) * (1 + power / 100));
                StartCoroutine(AttackTarget.TakingDamageAnim());
                break;

            case 2:
                foreach (var x in fightController.friends)
                {
                    var st = Instantiate(poison, x.transform);
                    st.Name      = "Отравление";
                    st.lifetime  = 8;
                    st.period    = 1;
                    st.damage    = 1;
                    st.character = x;
                    //x.TakeDamage(damage);
                }
                break;
            }
        }

        if (razmes && allTime > 12)
        {
            SetTargetRandom();
            StartCoroutine(AtakeAnim());
            StartCoroutine(AttackTarget.TakingDamageAnim());
        }
    }