public DeathCloud(DoublePoint pos) : base(new List<Sprite>() { new Sprite( new List<string>() { "Images/BattleCloud0.png", "Images/BattleCloud1.png", "Images/BattleCloud2.png", "Images/BattleCloud3.png", }, 0.1) }) { _pos.X = pos.X; _pos.Y = pos.Y; State = 0; }
public void Set(DoublePoint point) { _x = point._x; _y = point._y; }
public void Add(DoublePoint point) { _x += point._x; _y += point._y; }
public static DoublePoint GetAverage(DoublePoint a, DoublePoint b) { return new DoublePoint ((a._x / 2) + (b._x / 2), (a._y / 2) + (b._y / 2)); }
public override void Update(double time) { DoublePoint fp; double mag = Speed; bool b = true; while (b && ((fp = _decisionTree.GetGoal()) != null && !(Math.Abs(fp.X - _pos.X) < double.Epsilon && Math.Abs(fp.Y - _pos.Y) < double.Epsilon))) { fp = _decisionTree.GetGoal (); if (fp == null || (Math.Abs(fp.X - _pos.X) < double.Epsilon && Math.Abs(fp.Y - _pos.Y) < double.Epsilon)) { State = 0; break; } DoublePoint v = new DoublePoint(fp.X - _pos.X, fp.Y - _pos.Y); b = v.SetToLessOrEqualMag(mag); _moveDirectionUp = fp.Y - _pos.Y > 0; if (b) { _pos.Set(v); } else { _pos.Add(v); } if (Math.Abs(v.X) <= Math.Abs(v.Y)) { if (v.Y == 0) { State = 0; } else if (v.Y > 0) { State = 1; } else { State = 2; } } else { if (v.X < 0) { State = 3; } else { State = 4; } } } base.Update(time); }