public static void Ask(Choice[] choices, string text, GameObject obj) { for (int x = 0; x < _bubbles.Count; x++) if (_bubbles[x].Speaker != null && _bubbles[x].Speaker.ID == obj.ID && _bubbles[x].alive) { _bubbles.RemoveAt(x); break; } _bubbles.Add(new InteractiveTextBubble(choices, text, obj)); }
public TextBubble(string Text, GameObject speaker, float timeout) { _text = Text; if (speaker != null) _origin = speaker.MidPosition - Vector2.UnitY * speaker.Rect.Height * 0.5f; _speaker = speaker; if (_font == null) _font = IGORR.Content.ContentInterface.LoadFont("font2"); _textSize = _font.MeasureString(_text); CalculateTextStart(); CalculateVertices(); _timeOut = timeout; }
public InteractiveTextBubble(Choice[] choices, string text, GameObject partner) : base(text,partner,0) { _selectRect = IGORR.Content.ContentInterface.LoadTexture("selectRect"); string bubbleText = text + (choices.Length > 0 ? Environment.NewLine : ""); _offset = _font.MeasureString(bubbleText)/2.0f; _offset.X = 0; _choices = choices; _rectOffset = _font.MeasureString("5: ").X/2.0f; _choiceRects = new Rectangle[choices.Length]; for (int x = 0; x < _choices.Length; x++) { _choices[x].text = (x + 1).ToString() + ": " + _choices[x].text; bubbleText += Environment.NewLine+_choices[x].text; Vector2 size = _font.MeasureString(_choices[x].text); _choiceRects[x] = new Rectangle(0, 0, (int)(size.X/2.0f), (int)(size.Y/2.0f)); } SetText(bubbleText); _prevMouse = Mouse.GetState(); }
public virtual bool Collides(GameObject obj) { return obj.Rect.Intersects(this._rect); }
public override bool Collides(GameObject obj) { if (_collides) return base.Collides(obj); else return false; }
public static void Say(GameObject obj, string Text, float timeout) { for (int x = 0; x < _bubbles.Count; x++) if (_bubbles[x].Speaker != null && _bubbles[x].Speaker.ID == obj.ID && !(_bubbles[x] is InteractiveTextBubble) && _bubbles[x].alive) { if (_bubbles[x] is InteractiveTextBubble) { return; } else { _bubbles.RemoveAt(x); break; } } _bubbles.Add(new TextBubble(Text,obj,timeout)); }
public EventObject GetEvent(GameObject obj) { int posX = (int)(obj.MidPosition.X / tileSize); int posY = (int)(obj.MidPosition.Y / tileSize); for (int x = -1; x <= 1; x++) for (int y = -1; y <= 1; y++) if (isValid(posX + x, posY + y)) if (_events[posX + x, posY + y] != null && _events[posX + x, posY + y].Collides(obj)) return _events[posX + x, posY + y]; return null; }
public bool Collides(GameObject obj) { int posX = (int)(obj.MidPosition.X / tileSize); int posY = (int)(obj.MidPosition.Y / tileSize); int sizeX = (obj.Rect.Width / tileSize) / 2 + 1; int sizeY = (obj.Rect.Height / tileSize) / 2 + 1; bool result = false; for (int x = -sizeX; x <= sizeX; x++) for (int y = -sizeY; y <= sizeY; y++) if (isValid(posX + x, posY + y) && _layers[1][posX + x, posY + y]!=null) result = result || _layers[1][posX + x, posY + y].Collides(obj); return result; }