当前位置: 首页>>代码示例>>C#>>正文


C# Creature.Heal方法代码示例

本文整理汇总了C#中Creature.Heal方法的典型用法代码示例。如果您正苦于以下问题:C# Creature.Heal方法的具体用法?C# Creature.Heal怎么用?C# Creature.Heal使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Creature的用法示例。


在下文中一共展示了Creature.Heal方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TakeDamage


//.........这里部分代码省略.........
            return 0;
        }

        if (m_ingTakenDamageEffect < Const.MaxShowDamageNumber)
        {
            Vector3 damageTextScale = Vector3.one;
            ++m_ingTakenDamageEffect;
            Color color = Color.white;
            if (critical == true)
            {
                strDamage = dmg.ToString();
                color = Color.red;
                damageTextScale *= 1.1f;
            }
            else if (damageDesc.DamageBuffType == DamageDesc.BuffType.Poison)
            {
                color = Color.magenta;
            }
            else
            {
                if (offender != null && offender.RefMob.mobAI == MobAIType.Follow)
                {
                    damageTextScale *= 0.8f;
                    switch(offender.RefMob.id)
                    {
                    case 30001:
                        color = Color.clear;
                        break;
                    case 30002:
                        color = Color.red;
                        break;
                    case 30003:
                        color = Color.blue;
                        break;
                    case 30004:
                        color = Color.cyan;
                        break;
                    case 30005:
                        color = Color.yellow;
                        break;
                    case 30006:
                        color = Color.magenta;
                        break;
                    case 30007:
                        color = Color.grey;
                        break;
                    }
                }
            }

            DamageText(strDamage, damageTextScale, color, DamageNumberSprite.MovementType.ParabolaAlpha);

            StartCoroutine(BodyRedColoredOnTakenDamage());

            ApplyDamageEffect(damageDesc.DamageType, damageDesc.PrefEffect);
        }

        if (true == m_creatureProperty.BackwardOnDamage && damageDesc.PushbackOnDamage && m_pushbackSpeedOnDamage <= 0f)
        {
            if (Random.Range(0, 10) == 0)
            {
                m_pushbackSpeedOnDamage = 10f / rigidbody.mass;
                rigidbody.AddForce(transform.right*-2f, ForceMode.Impulse);
                rigidbody.AddTorque(transform.forward*2f, ForceMode.Impulse);
                rigidbody.maxAngularVelocity = 2f;

                EnableNavmeshUpdatePos(false);
            }
        }

        ApplyBuff(offender, damageDesc.DamageBuffType, 2f, damageDesc);

        if (offender != null && damageDesc.LifeSteal == true)
        {
            long lifeSteal = (long)(offender.m_creatureProperty.LifeSteal);
            if (lifeSteal > 0)
            {
                offender.DamageText(lifeSteal.ToString() + "L", Vector3.one, Color.green, DamageNumberSprite.MovementType.ParabolaAlpha);
                offender.Heal(lifeSteal);
            }
        }

        m_creatureProperty.HP-=dmg;
        if (m_creatureProperty.HP == 0)
        {
            Const.GetSpawn().SharePotinsChamps(offender, ItemData.Type.XPPotion, m_creatureProperty.RewardExp, false);
            Death();
        }

        if (offender != null && (offender.CreatureType & Type.Champ) > 0)
        {
            Warehouse.Instance.NewGameStats.DealDamages += dmg;
        }
        else if (CreatureType == Type.Champ)
        {
            Warehouse.Instance.NewGameStats.TakenDamages += dmg;
        }

        return dmg;
    }
开发者ID:yakolla,项目名称:MarineVsAlien,代码行数:101,代码来源:Creature.cs

示例2: PowerRoll

 public override int PowerRoll(Creature owner, Creature target)
 {
     int damage = base.PowerRoll(owner, target);
     owner.Heal(damage);
     return damage;
 }
开发者ID:WJLiddy,项目名称:BasementExplorer,代码行数:6,代码来源:PrimaryHPPlus.cs


注:本文中的Creature.Heal方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。