private void Reset() { if (intObj == null) { intObj = GetComponent <InteractionBehaviour>(); } if (_localButtonSurface.radii.x == 0 && _localButtonSurface.radii.y == 0) { _localButtonSurface = new LocalRect(Vector3.zero, Vector2.one * 0.05f); } }
/// This method will be called by our MyManager object when we want to move the player. internal void MovePlayer(int dx, int dy) { /// Create the new position based on the current postion adn the delta values. Point newPos = player.CurrentPosition.Shift(dx, dy); /// Widget.LocalRect returns the region of the widget in local space coordinates (local to /// that Widget). This is a convenience method, and the upper left corner of the rect /// will always be at 0,0. /// /// Rect.Contains(Point) returns true if the specified point is somewhere inside the Rect. /// In this case, we are checking if the new position caluclated above is inside the /// MapView region. If so, we set the player's position to the new position. if (LocalRect.Contains(newPos)) { player.CurrentPosition = newPos; } }
public override Vector2 GetRandomLocalPoint() { return(LocalRect.GetRandomPoint()); }
public override bool IsPointInsideShape(PointF p) { var pLocal = _getPointInLocal(p); return(LocalRect.Contains(pLocal)); }