protected override Rectangle GetInteractionArea(SceneMB sceneMB) { var size = representable.Size; var context = representable.Context; var elemRef = context as ElementReference; if (elemRef == null) { return(null); } var topLeft = new Vector2(elemRef.getX() - size.x / 2f, elemRef.getY() - size.y); Rectangle area = new InfluenceArea((int)topLeft.x - 20, (int)topLeft.y - 20, (int)size.x + 40, (int)size.y + 40); var scene = sceneMB.SceneData as Scene; if (scene != null && scene.getTrajectory() == null) { // If no trajectory I have to move the area to the trajectory for it to be connected area = area.MoveAreaToTrajectory(sceneMB.Trajectory); } else if (elemRef.getInfluenceArea() != null && elemRef.getInfluenceArea().isExists()) { area = elemRef.getInfluenceArea().MoveArea(topLeft); } return(area); }
public void Adaptate() { if (texture) { rend.material.mainTexture = texture; } var worldSize = SceneMB.ToWorldSize(Size); // Mirror worldSize.Scale(new Vector3((mirror ? -1 : 1), 1, 1)); // Set transform.localScale = worldSize; }
protected static BubbleData GenerateBubble(string text, int x, int y, bool showBorder, Color textColor, Color textOutlineColor, Color baseColor, Color outlineColor) { var destiny = SceneMB.ToWorldSize(new Vector2(x, y)); var bubbleData = new BubbleData(text, destiny, destiny - new Vector3(0, -15, 0)) { TextColor = textColor, TextOutlineColor = textOutlineColor }; if (showBorder) { bubbleData.BaseColor = baseColor; bubbleData.OutlineColor = outlineColor; } return(bubbleData); }
protected override Rectangle GetInteractionArea(SceneMB sceneMB) { var aad = element as ActiveArea; var scene = sceneMB.SceneData as Scene; Rectangle area = null; if (scene != null && scene.getTrajectory() == null) { // If no trajectory I have to move the area to the trajectory for it to be connected area = aad.MoveAreaToTrajectory(sceneMB.Trajectory); } else { area = new InfluenceArea(aad.getX() - 20, aad.getY() - 20, aad.getWidth() + 40, aad.getHeight() + 40); if (aad.getInfluenceArea() != null && aad.getInfluenceArea().isExists()) { var points = aad.isRectangular() ? aad.ToRect().ToPoints() : aad.getPoints().ToArray(); var topLeft = points.ToRect().position; area = aad.getInfluenceArea().MoveArea(topLeft); } } return(area); }
protected abstract Rectangle GetInteractionArea(SceneMB sceneMB);