コード例 #1
0
ファイル: MIGravity.cs プロジェクト: SpeedOverlord/Warlock
 public override void Update()
 {
     base.Update();
     foreach (Unit unit in Game.Unit_List)
     {
         if (unit == Caster)
         {
             continue;
         }
         IPair delta  = Pos - unit.Pos;
         int   radius = (RADIUS + unit.Radius) * GameDef.PIXEL_SCALE;
         if (delta.LengthSquare() > radius * radius || delta.Zero())
         {
             continue;
         }
         delta.ChangeLength(STRENGTH);
         unit.AddRepulse(delta);
     }
     foreach (Missile missile in Game.Missile_List)
     {
         if (missile.Caster == Caster)
         {
             continue;
         }
         IPair delta  = Pos - missile.Pos;
         int   radius = (RADIUS + missile.Radius) * GameDef.PIXEL_SCALE;
         if (delta.LengthSquare() > radius * radius || delta.Zero())
         {
             continue;
         }
         delta.ChangeLength(STRENGTH);
         missile.AddRepulse(delta);
     }
 }
コード例 #2
0
ファイル: FireBall.cs プロジェクト: SpeedOverlord/Warlock
        public override Effect[] BeginCast(Unit unit, IPair destination)
        {
            IPair delta = destination - unit.Pos;

            delta.ChangeLength(GameDef.UNIT_RADIUS * GameDef.PIXEL_SCALE);

            Effect[] effect_list = new Effect[1];
            effect_list[0] = new EFMakeFireBall(unit, delta);
            effect_list[0].Register();
            return(effect_list);
        }
コード例 #3
0
        public override void Cast(Unit unit, IPair destination, Effect[] effect_list)
        {
            base.Cast(unit, destination, effect_list);
            IPair delta = destination - unit.Pos;

            if (delta.LengthSquare() > MAX_RANGE * MAX_RANGE)
            {
                delta.ChangeLength(MAX_RANGE);
            }
            unit.Pos.Add(delta);
        }
コード例 #4
0
 public override void Update()
 {
     if (Game.Unit_List.Contains(target_))
     {
         IPair delta = target_.Pos - Pos;
         if (repulse_.Zero() == false)
         {
             repulse_.ChangeLength(speed_ * 94 / 100);
             delta.ChangeLength(speed_ - repulse_.Length());
         }
         else
         {
             delta.ChangeLength(speed_);
         }
         repulse_.Add(delta);
     }
     else
     {
         move_vector_ = null;
         Explode      = true;
     }
     base.Update();
 }
コード例 #5
0
ファイル: MIGravity.cs プロジェクト: SpeedOverlord/Warlock
        public const int STRENGTH = 60;  //  as 50 damage spell
        public MIGravity(Unit caster, IPair destination) : base(80, caster)
        {
            radius_ = RADIUS;
            damage_ = 0;
            speed_  = 450;

            hurt_self_             = false;
            explode_enemy_         = false;
            explode_enemy_missile_ = false;

            IPair delta = destination - caster.Pos;

            move_vector_ = delta.Clone();
            move_vector_.ChangeLength(speed_);
            delta.ChangeLength(GameDef.UNIT_RADIUS * GameDef.PIXEL_SCALE);
            Pos.Clone(caster.Pos);
            Pos.Add(delta);
        }
コード例 #6
0
        public MIFireBall(Unit caster, IPair destination) : base(66, caster)
        {
            radius_ = RADIUS;
            damage_ = 700;
            speed_  = 900;  //  x100

            hurt_self_             = false;
            explode_enemy_         = true;
            explode_enemy_missile_ = true;

            IPair delta = destination - caster.Pos;

            move_vector_ = delta.Clone();
            move_vector_.ChangeLength(speed_);
            delta.ChangeLength(GameDef.UNIT_RADIUS * GameDef.PIXEL_SCALE);
            Pos.Clone(caster.Pos);
            Pos.Add(delta);
        }