예제 #1
0
 void Update()
 {
     if (ready)
     {
         reloadTime = Math.Max(0f, reloadTime - Time.deltaTime);
         //!Переписать
         if (reloadTime != 0f)
         {
             for (int i = 0; i < 3; ++i)
             {
                 SpellsIcons[i].GetComponent <SpriteRenderer>().color = Color.gray;
             }
         }
         else
         {
             for (int i = 0; i < 3; ++i)
             {
                 SpellsIcons[i].GetComponent <SpriteRenderer>().color = Color.white;
             }
         }
         HB.GetComponentInChildren <TextMeshProUGUI>().text = $"{Mathf.Ceil(hp)}/{Mathf.Ceil(maxhp)}";
         if (hp <= 0)
         {
             DestroyHalo(halo);
             Death();
         }
     }
 }
예제 #2
0
    //Атака

    void Update()
    {
        HB.GetComponentInChildren <TextMeshProUGUI>().text = $"{Mathf.Ceil(hp)}/{Mathf.Ceil(maxhp)}";
        if ((Combat))
        {
            if (fightController.AliveHeroes() == 0)
            {
                Combat = false;
            }
            else
            {
                if (AttackTimeout <= 0)
                {
                    Attack();
                }
                else
                {
                    AttackTimeout -= Time.deltaTime;
                }
            }
        }
        if (hp <= 0)
        {
            //Удалить все эффекты
            fightController.enemies.Remove(this);
            DestroyHalo(halo);
            Destroy(gameObject);
        }
    }
예제 #3
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;
            }
        }
    }
예제 #4
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());
        }
    }