コード例 #1
0
    private void HealingCalc()
    {
        GameObject NewText;
        float      PlayerHealingNSum = 0;
        float      EnemyHealingNDSum = 0;

        foreach (MagicEffect effect in activeMagicEffects)
        {
            if (effect.Type == MagicEffectType.Healing)
            {
                switch (effect.TargetCharacter)
                {
                case TargetCharacter.Player:
                    PlayerHealingNSum += effect.Value;
                    break;

                case TargetCharacter.Enemy:
                    EnemyHealingNDSum += effect.Value;
                    break;
                }
            }
        }
        if (PlayerHealingNSum > 0)
        {
            NewText = GameObject.Instantiate(mainBScript.Text);
            NewText.GetComponent <TextScript>().SetPlayerPos();
            NewText.GetComponent <TextScript>().SetColor(1);
            NewText.GetComponent <TextScript>().SetText("+" + System.Convert.ToString(Mathf.RoundToInt(PlayerHealingNSum)));
            ///
            mainBScript.PlayerScript.Healing(PlayerHealingNSum);
        }
        if (EnemyHealingNDSum > 0)
        {
            NewText = GameObject.Instantiate(mainBScript.Text);
            NewText.GetComponent <TextScript>().SetEnemyPos();
            NewText.GetComponent <TextScript>().SetColor(1);
            NewText.GetComponent <TextScript>().SetText("+" + System.Convert.ToString(Mathf.RoundToInt(EnemyHealingNDSum)));
            ///
            mainBScript.EnemyScript.Healing(EnemyHealingNDSum);
        }
    }
コード例 #2
0
    private void FireDamageCalc()
    {
        GameObject NewText;
        float      PlayerPassiveDSum = 0;
        float      EnemyPassiveDSum  = 0;

        foreach (MagicEffect effect in activeMagicEffects)
        {
            if (effect.Type == MagicEffectType.Fire)
            {
                switch (effect.TargetCharacter)
                {
                case TargetCharacter.Player:
                    PlayerPassiveDSum += effect.Value;
                    break;

                case TargetCharacter.Enemy:
                    EnemyPassiveDSum += effect.Value;
                    break;
                }
            }
        }
        if (PlayerPassiveDSum > 0)
        {
            NewText = GameObject.Instantiate(mainBScript.Text);
            NewText.GetComponent <TextScript>().SetPlayerUpperPos();
            NewText.GetComponent <TextScript>().SetColor(4);
            NewText.GetComponent <TextScript>().SetText("-" + System.Convert.ToString(Mathf.RoundToInt(PlayerPassiveDSum)));
            ///
            mainBScript.PlayerScript.HealthPoint -= PlayerPassiveDSum;
        }
        if (EnemyPassiveDSum > 0)
        {
            NewText = GameObject.Instantiate(mainBScript.Text);
            NewText.GetComponent <TextScript>().SetEnemyUpperPos();
            NewText.GetComponent <TextScript>().SetColor(4);
            NewText.GetComponent <TextScript>().SetText("-" + System.Convert.ToString(Mathf.RoundToInt(EnemyPassiveDSum)));
            ///
            mainBScript.EnemyScript.HealthPoint -= EnemyPassiveDSum;
        }
    }