public static Regulus.CustomType.Rect ToRect(this Camera camera, Bounds bounds) { var points = bounds.GetVectors(); var first = _GetScreenPoint(camera, points[0]); var rect = new Regulus.CustomType.Rect(first.x, first.y, 0, 0); for (int i = 1; i < points.Length; ++i) { var pt = points[i]; var screen = _GetScreenPoint(camera, pt); if (screen.x < rect.Left) { rect.Left = screen.x; } if (screen.y < rect.Top) { rect.Top = screen.y; } if (screen.x > rect.Right) { rect.Right = screen.x; } if (screen.y > rect.Bottom) { rect.Bottom = screen.y; } } return(rect); }
public FishBounds(int id, FISH_TYPE type, Regulus.CustomType.Rect bounds) { Type = type; Visible = true; _Id = id; SetBounds(bounds); }
public ShuttleEntity(Guid id, Regulus.CustomType.Rect vision,string target ) : base(id) { _Target = target; _Vision = vision; _Position = new CustomType.Vector2(); _Position.X = (float)(_Vision.X + _Vision.Width /2); _Position.X = (float)(_Vision.Y + _Vision.Height / 2); }
public void SetBounds(Regulus.CustomType.Rect bounds) { if (Regulus.Utility.ValueHelper.DeepEqual(_Bounds, bounds) == false) { _Bounds = bounds; if (_BoundsChanged != null) { _BoundsChanged(this, new EventArgs()); } } }
public PortalEntity(Guid id, Regulus.CustomType.Rect vision,string target_map, CustomType.Vector2 target_position) : base(id) { _TargetPosition = new CustomType.Vector2(); _TargetPosition.X = target_position.X; _TargetPosition.Y = target_position.Y; _TargetMap = target_map; _Vision = vision; _Position = new CustomType.Vector2(); _Position.X = (float)(_Vision.X + _Vision.Width /2); _Position.X = (float)(_Vision.Y + _Vision.Height / 2); }
public PhysicalAbility(Regulus.CustomType.Rect bounds ,Entity owner) { _Bounds = bounds; }
public Effective(float interval, ActorPropertyAbility actor , Regulus.CustomType.Rect bounds) : this(interval) { _Actor = actor; _Bounds = bounds; }
private void _UpdateMovers(IMoverAbility moverAbility, IObserveAbility observeAbility, PhysicalAbility physical) { var w = physical.Bounds.Width; var h = physical.Bounds.Height; var x = observeAbility.Position.X - w / 2; var y = observeAbility.Position.Y - h / 2; var brounds = new Regulus.CustomType.Rect(x, y, w, h); var inbrounds = _ObseverdInfomations.Query(brounds); var obbs = from qtoa in inbrounds let ma = qtoa.Move where ma != null && moverAbility != ma select ma.Polygon; moverAbility.Update(_Time.Ticks, obbs); }
public FishBounds[] Query(Regulus.CustomType.Rect rect) { return(_Set.Query(rect).ToArray()); }
private void _UpdateMovers(EntityInfomation[] infos) { foreach (var info in infos) { var moverAbility = info.Move; var observeAbility = info.Observe; var physical = info.Physical; if (moverAbility != null && observeAbility != null && physical != null) { var w = physical.Bounds.Width; var h = physical.Bounds.Height; var x = observeAbility.Position.X - w / 2; var y = observeAbility.Position.Y - h / 2; var brounds = new Regulus.CustomType.Rect(x, y, w, h); var inbrounds = _ObseverdInfomations.Query(brounds); var obbs = from qtoa in inbrounds let ma = qtoa.Move where ma != null && moverAbility != ma select ma.Obb; moverAbility.Update(_Time.Ticks, obbs); } } }