示例#1
0
 public override void Initialize(GameObject go)
 {
     Self      = go;
     Magicable = go.GetComponent <IMagicable>();
     _level    = 0;
     StopChannel();   //You can stop a channel,
     ResetCooldown(); //but stopping a cooldown sounds like pausing; so we Reset it instead
 }
示例#2
0
 public static bool TrySpendMagic(this IMagicable magicable, float mana)
 {
     if (!magicable.HasMagic(mana))
     {
         return(false);
     }
     magicable.SpendMagic(mana);
     return(true);
 }
示例#3
0
        public void ApplyInfusion(GameObject target)
        {
            var cols = Physics.OverlapSphere(target.transform.position, _manaStealSearchRadius, (int)LayerMaskHelper.Entity);
            var gos  = Triggers.Trigger.GetGameObjectFromColliders(cols);

            ITeamable   teamable   = target.GetComponent <ITeamable>();
            IMagicable  magicable  = target.GetComponent <IMagicable>();
            IHealthable healthable = target.GetComponent <IHealthable>();

            var totalManaStolen = 0f;

            foreach (var go in gos)
            {
                if (go == target)
                {
                    continue;
                }

                if (_teamable == null || teamable == null || teamable.Team == _teamable.Team)
                {
                    continue;
                }

                var enemyMagicable = go.GetComponent <IMagicable>();

                if (enemyMagicable == null)
                {
                    continue;
                }

                var enemyManaPoints = enemyMagicable.ManaPoints;
                var stolen          = Mathf.Min(enemyManaPoints, _manaSteal);
                enemyMagicable.ModifyMana(-stolen, _self);

                totalManaStolen += stolen;
            }

            magicable.ModifyMana(totalManaStolen, _self);
            // //If allied, dont deal damage
            // if(_teamable != null && teamable != null && _teamable.Team == teamable.Team)
            // return;

            var damage = new Damage(totalManaStolen, DamageType.Magical, _self);

            healthable.TakeDamage(damage);
        }
示例#4
0
 protected override void Awake()
 {
     _magicable = _target.GetComponent <IMagicable>();
     base.Awake();
 }
示例#5
0
 public static bool TrySpendMagic(IStatCostAbilityView abilityView, IMagicable magicable) =>
 magicable.TrySpendMagic(abilityView.Cost);
示例#6
0
 public override void Initialize(GameObject go)
 {
     _self      = go;
     _teamable  = go.GetComponent <ITeamable>();
     _magicable = go.GetComponent <IMagicable>();
 }
示例#7
0
文件: RiftWalk.cs 项目: moto2002/BoEG
 public override void Initialize(GameObject go)
 {
     base.Initialize(go);
     _movable   = Self.GetComponent <IMovable>();
     _magicable = Self.GetComponent <IMagicable>();
 }
示例#8
0
 public MagicCost(IMagicable magicable, float cost = default)
 {
     _magicable = magicable;
     Cost       = cost;
 }