Esempio n. 1
0
        public SpellExecuting CastMelee(ICaster caster, uint dir, bool lockRealRunes)
        {
            var pos  = ((Entity)caster).pos;
            var spEx = new SpellExecuting(caster, this, pos, dir, lockRealRunes);

            spEx.SpawnAvatar(root, null, pos, dir); //TODO: spawn at spell target? what to do with direction? make random if far?
            executingSpells.Add(spEx);
            return(spEx);
        }
Esempio n. 2
0
 public Avatar(SpellExecuting spell, HexXY pos, uint dir, Spell.CompiledRune startRune, uint id)
 {
     this.spell    = spell;
     this.pos      = pos;
     this.dir      = dir;
     this.rune     = startRune;
     this.timeLeft = 0;
     this.id       = id;
 }
Esempio n. 3
0
        public override void Update(float dt)
        {
            base.Update(dt);
            if (exSpell != null && !exSpell.isExecuting)
            {
                exSpell = null;
            }

            isCasting = exSpell != null;
        }
Esempio n. 4
0
        public override void Click()
        {
            if (!isCasting)
            {
                var compileRune = Level.S.GetEntities(sourceSpellPos).OfType <Rune>().First();

                var spell = new Spell();
                spell.Compile(compileRune, sourceSpellPos);
                exSpell = spell.CastMelee(this, dir, true);
            }
            else
            {
                exSpell.Die();
                exSpell = null;
            }
        }
Esempio n. 5
0
        public SpellExecuting CastRanged(ICaster caster, HexXY target)
        {
            var  pos  = ((Entity)caster).pos;
            var  dist = HexXY.Dist(pos, target);
            uint dir;

            if (dist == 0)
            {
                dir = ((Entity)caster).dir;
            }
            else
            {
                dir = HexXY.GetApproximateDir(pos, target);
            }


            var spEx = new SpellExecuting(caster, this, target, dir, false);

            spEx.SpawnAvatar(root, null, target, dir);
            executingSpells.Add(spEx);
            return(spEx);
        }