Пример #1
0
    private void Update()
    {
        if (Input.GetKeyDown(KeyCode.Z))
        {
            DamageText dt = DamageTextPool.Instance.GetDamageText();

            Vector3 pos = this.transform.position;
            dt.SetDamageText(pos, 0, false, false, Color.red);


            //pos.y += 2f;
            //dt.SetDamageText(pos, (int)Random.Range(1,99999), false, false, Color.red);
            //dt.SetDamageText(pos, 1, false, false, Color.red);
        }
        if (Input.GetKeyDown(KeyCode.C))
        {
            DamageText dt = DamageTextPool.Instance.GetDamageText();

            Vector3 pos = this.transform.position;
            dt.SetDamageText(pos, Random.Range(1, 10000), false, false, Color.red);


            //pos.y += 2f;
            //dt.SetDamageText(pos, (int)Random.Range(1,99999), false, false, Color.red);
            //dt.SetDamageText(pos, 1, false, false, Color.red);
        }

        if (Input.GetKeyDown(KeyCode.Z))
        {
            DamageText dt = DamageTextPool.Instance.GetDamageText();

            Vector3 pos = this.transform.position;
            dt.SetDamageText(pos, 0, false, true, Color.red);
        }
    }
Пример #2
0
    /*
     * void SpawnDamageText(int damage, bool critical, Color color)
     * {
     *  if (damage > 0)
     *  {
     *      var damage_text = DamageTextPool.Instance.GetDamageText();
     *      if (damage_text != null)
     *      {
     *          Vector3 damage_text_offset = navmesh_agent.radius * (UnityEngine.Random.Range(-1.0f, 1.0f) * camera_transform.right + UnityEngine.Random.Range(1.0f, 1.5f) * Vector3.up - camera_transform.forward);
     *          damage_text.SetDamageText(hit_bone_node.position + damage_text_offset, damage, critical, false, color);
     *      }
     *  }
     * }
     */

    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Space))
        {
            Debug.LogError("aaaa");
            DamageText dt = DamageTextPool.Instance.GetDamageText();
            dt.SetDamageText(Vector3.zero, Random.Range(1, 100), false, false, Color.red);

            dt = DamageTextPool.Instance.GetDamageText();
            dt.SetDamageText(Vector3.right, Random.Range(100, 1000), false, false, Color.red);

            dt = DamageTextPool.Instance.GetDamageText();
            dt.SetDamageText(-Vector3.right, Random.Range(1000, 10000), false, false, Color.red);

            dt = DamageTextPool.Instance.GetDamageText();
            dt.SetDamageText(Vector3.up, Random.Range(10000, 99999), false, false, Color.red);

            dt = DamageTextPool.Instance.GetDamageText();
            dt.SetDamageText(Vector3.up + Vector3.right, Random.Range(1, 99999), false, false, Color.red);

            dt = DamageTextPool.Instance.GetDamageText();
            dt.SetDamageText(Vector3.up - Vector3.right, Random.Range(1, 99999), false, false, Color.red);
        }
        else if (Input.GetKeyDown(KeyCode.Z))
        {
            var damage_text = DamageTextPool.Instance.GetDamageText();
            if (damage_text != null)
            {
                Vector3 damage_text_offset = 0.5f * (UnityEngine.Random.Range(-1.0f, 1.0f) * camera_transform.right + UnityEngine.Random.Range(1.0f, 1.5f) * Vector3.up - camera_transform.forward);
                damage_text.SetDamageText(hit_bone_node.position + damage_text_offset, Random.Range(1, 100000), true, false, critical_color);
            }
        }
    }
Пример #3
0
    public override void TakeDamage(int damage, Character offendingCharacter)
    {
        base.TakeDamage(damage, offendingCharacter);
        GameObject damageTextObject = Managers.Pooler.SpawnFromPool("DamageText", transform.position, Quaternion.identity, 0.4f);
        DamageText damageText       = damageTextObject.GetComponent <DamageText>();

        damageText.transform.LookAt(Managers.Gameplay.player.transform);
        damageText.SetDamageText(damage.ToString());
        damageText.animator.Play("DamageTextAnimation", -1, 0f);
        Stun();
        if (!IsAggroed())
        {
            Aggro(offendingCharacter.transform);
        }

        if (offendingCharacter.tag == "Player" && health > 0)
        {
            Managers.Audio.PlayHitTargetSound(4);
        }
    }
Пример #4
0
    public void HitBuff(InBattleUnit other)
    {
        int heal        = other.data.AttackFactor;
        int calculation = Mathf.Clamp((data.TotalHitPoints - data.HitPoints), 0, heal);

        data.HitPoints += calculation;

        HealAnimation(calculation);

        //---

        DamageText dt = DamageTextPool.Instance.GetDamageText();

        Vector3 pos = this.transform.position;

        pos.y += 200;
        dt.SetDamageText(pos, calculation, false, false, Color.green);

        Debug.Log("a");
    }
Пример #5
0
    public void HitDamage(InBattleUnit other)
    {
        //      int damage = other.data.AttackFactor;
        //      int calculation = Mathf.Clamp(damage - data.DefenceFactor, 1, damage);
        //      HitPoints -= calculation;
        //data.HitPoints = HitPoints;

        int damage = other.data.AttackFactor;

        int calculation = Mathf.Clamp(damage - data.DefenceFactor, 1, damage);

        //--

        int nFinalDmg = this.AdvantageState(calculation, other.unitType);

        data.HitPoints -= nFinalDmg;


        Debug.Log("HitDamage c= " + calculation + " fianl = " + nFinalDmg);

        HitDamageAnimation(nFinalDmg);

        DamageText dt = DamageTextPool.Instance.GetDamageText();

        Vector3 pos = this.transform.position;

        pos.y += 200;
        dt.SetDamageText(pos, calculation, false, false, Color.red);


        if (data.HitPoints <= 0)
        {
            data.Destroyed(other.data);
            data.Cell.PlayerNumber = -1;
        }
    }
Пример #6
0
    public void Spawn(float damage)
    {
        DamageText instance = Instantiate <DamageText>(damageText, transform);

        instance.SetDamageText(damage);
    }