コード例 #1
0
        public override void update(float diff)
        {
            _timerUpdate += diff;
            if (_timerUpdate >= UPDATE_TIME)
            {
                _timerUpdate = 0;
            }

            foreach (UnitCrowdControl cc in crowdControlList)
            {
                cc.Update(diff);
            }
            crowdControlList.RemoveAll((cc) => cc.IsDead());

            BuffGameScriptControllers.RemoveAll((b) => b.NeedsRemoved());

            var onUpdate = _scriptEngine.GetStaticMethod <Action <Unit, double> >(Model, "Passive", "OnUpdate");

            onUpdate?.Invoke(this, diff);

            UpdateAutoAttackTarget(diff);

            base.update(diff);

            _statUpdateTimer += diff;
            if (_statUpdateTimer >= 500)
            { // update stats (hpregen, manaregen) every 0.5 seconds
                stats.update(_statUpdateTimer);
                _statUpdateTimer = 0;
            }
        }
コード例 #2
0
 public void RemoveBuffGameScriptsWithName(string buffNamespace, string buffClass)
 {
     foreach (var b in BuffGameScriptControllers)
     {
         if (b.IsBuffSame(buffNamespace, buffClass))
         {
             b.DeactivateBuff();
         }
     }
     BuffGameScriptControllers.RemoveAll(b => b.NeedsRemoved());
 }
コード例 #3
0
        public void AddBuffGameScript(string buffNamespace, string buffClass, ISpell ownerSpell, float removeAfter = -1f, bool isUnique = false)
        {
            if (isUnique)
            {
                RemoveBuffGameScriptsWithName(buffNamespace, buffClass);
            }

            var buffController =
                new BuffGameScriptController(_game, this, buffNamespace, buffClass, (Spell)ownerSpell, removeAfter);

            BuffGameScriptControllers.Add(buffController);
            buffController.ActivateBuff();

            // TODO: should handle the controllers in the class, and don't pass them outside
        }
コード例 #4
0
        public BuffGameScriptController AddBuffGameScript(String buffNamespace, String buffClass, Spell ownerSpell, float removeAfter = -1f, bool isUnique = false)
        {
            if (isUnique)
            {
                RemoveBuffGameScriptsWithName(buffNamespace, buffClass);
            }

            BuffGameScriptController buffController =
                new BuffGameScriptController(this, buffNamespace, buffClass, ownerSpell, duration: removeAfter);

            BuffGameScriptControllers.Add(buffController);
            buffController.ActivateBuff();

            return(buffController);
        }
コード例 #5
0
        public override void update(float diff)
        {
            foreach (UnitCrowdControl cc in crowdControlList)
            {
                cc.Update(diff);
            }
            crowdControlList.RemoveAll((cc) => cc.IsDead());

            var onUpdate = _scriptEngine.GetStaticMethod <Action <AttackableUnit, double> >(Model, "Passive", "OnUpdate");

            onUpdate?.Invoke(this, diff);
            BuffGameScriptControllers.RemoveAll((b) => b.NeedsRemoved());
            base.update(diff);
            UpdateAutoAttackTarget(diff);
        }
コード例 #6
0
 public void RemoveBuffGameScript(BuffGameScriptController buffController)
 {
     buffController.DeactivateBuff();
     BuffGameScriptControllers.Remove(buffController);
 }