コード例 #1
0
    public void TakeSliceDamage(Stats damageSource, Vector3 damageLoc)
    {
        if (trackedSliceDamage == null)
        {
            return;
        }                                           //Stop same frame double damage

        realStats.Health   -= damageSource.Slice;
        currentSliceDamage += damageSource.Slice;
        HealthValueChanged?.Invoke(realStats.HealthPct);

        trackedSliceDamage.UpdatePositionAndValue(damageLoc, currentSliceDamage.ToString());

        if (realStats.Health <= 0)
        {
            Die();
        }
    }
コード例 #2
0
    public void TakeDamage(Stats damageSource, Vector3 damageLoc)
    {
        currentSliceDamage = 0;

        GameObject temp = Instantiate(damageTextPrefab);

        trackedSliceDamage = temp.GetComponent <UI_DamageText>();

        //Basic for testing. Will be broadened.
        realStats.Health -= damageSource.Attack;
        HealthValueChanged?.Invoke(realStats.HealthPct);

        temp.GetComponent <UI_DamageText>().UpdatePositionAndValue(damageLoc, damageSource.Attack.ToString());

        currentSliceDamage = damageSource.Attack;

        if (realStats.Health <= 0)
        {
            Die();
        }
    }