public RectangleCollider(BaseObject parent) :
     base(parent)
 {
     // Sets up the bounds
     Vector2 parentWorldPos = parent.WorldPosition;
     Vector2 parentSize = parent.Size;
     bounds = new Rectangle(
         (int)(parentWorldPos.X - parentSize.X * 0.5f), 
         (int)(parentWorldPos.Y - parentSize.Y * 0.5f), 
         (int)parentSize.X, 
         (int)parentSize.Y);
 }
Beispiel #2
0
        /// <summary>
        /// Set this object's parent attribute to the inputted object and connect up appropriate attributes like IsAlive.
        /// Can override to connect up extra attributes such as ShouldDraw if we have an object we know will be contained in the parent.
        /// </summary>
        /// <param name="parent">The object we wish to set as the parent</param>
        public virtual void SetParent(BaseObject parent)
        {
            Parent.Value = parent;

            // Connect up our object's IsAlive property to our parent's so that we will die automatically when our parent dies
            IsAlive.Connect(parent.IsAlive);
        }
Beispiel #3
0
 /// <summary>
 /// Removes an InGameUIObject from this screen's InGameUIObjects manager
 /// </summary>
 /// <param name="uiObjectToRemove"></param>
 public void RemoveInGameUIObject(BaseObject uiObjectToRemove)
 {
     InGameUIObjects.RemoveChild(uiObjectToRemove);
 }
Beispiel #4
0
 /// <summary>
 /// Removes a ScreenUIObject from this screen's ScreenUIObjects manager
 /// </summary>
 /// <param name="uiObjectToRemove"></param>
 public void RemoveScreenUIObject(BaseObject uiObjectToRemove)
 {
     ScreenUIObjects.RemoveChild(uiObjectToRemove);
 }
Beispiel #5
0
 /// <summary>
 /// Removes a UIObject from this screen's EnvironmentObjects manager
 /// </summary>
 /// <param name="environmentObjectToRemove">The environment object to remove</param>
 public void RemoveEnvironmentObject(BaseObject environmentObjectToRemove)
 {
     EnvironmentObjects.RemoveChild(environmentObjectToRemove);
 }
Beispiel #6
0
 /// <summary>
 /// Removes a GameObject from this screen's GameObjects manager
 /// </summary>
 /// <param name="gameObjectToRemove">The game object to remove</param>
 public void RemoveGameObject(BaseObject gameObjectToRemove)
 {
     GameObjects.RemoveChild(gameObjectToRemove);
 }
 /// <summary>
 /// Closes the dialog.
 /// </summary>
 /// <param name="clickedObject"></param>
 private void CloseDialog(BaseObject clickedObject)
 {
     Die();
 }
 /// <summary>
 /// Move to the previous string
 /// </summary>
 /// <param name="clickedObject"></param>
 private void PreviousString(BaseObject clickedObject)
 {
     CurrentStringIndex--;
 }
 /// <summary>
 /// Move to the next string
 /// </summary>
 /// <param name="clickedObject"></param>
 private void NextString(BaseObject clickedObject)
 {
     CurrentStringIndex++;
 }
Beispiel #10
0
 public Collider(BaseObject parent)
 {
     Parent = parent;
 }
 public ClickDismissCommand(BaseObject baseObject)
 {
     BaseObject = baseObject;
 }