Esempio n. 1
0
 public LineSegment(Vec2 pStart, Vec2 pEnd, GameObject owner, uint pColor = 0xffffffff, uint pLineWidth = 1, bool pGlobalCoords = false)
 {
     _owner = owner;
     Start = pStart;
     End = pEnd;
     Color = pColor;
     LineWidth = pLineWidth;
     UseGlobalCoords = pGlobalCoords;
 }
Esempio n. 2
0
 //------------------------------------------------------------------------------------------------------------------------
 //                                                        Remove()
 //------------------------------------------------------------------------------------------------------------------------
 internal void Remove(GameObject gameObject)
 {
     if (_gameObjectsContained.Contains (gameObject)) {
         _updateManager.Remove (gameObject);
         _collisionManager.Remove (gameObject);
         _gameObjectsContained.Remove (gameObject);
     }
 }
Esempio n. 3
0
 //------------------------------------------------------------------------------------------------------------------------
 //                                                        GetGameObjectCollisions()
 //------------------------------------------------------------------------------------------------------------------------
 internal GameObject[] GetGameObjectCollisions(GameObject gameObject)
 {
     return _collisionManager.GetCurrentCollisions(gameObject);
 }
Esempio n. 4
0
 //------------------------------------------------------------------------------------------------------------------------
 //                                                        Add()
 //------------------------------------------------------------------------------------------------------------------------
 internal void Add(GameObject gameObject)
 {
     if (!_gameObjectsContained.Contains (gameObject)) {
         _updateManager.Add (gameObject);
         _collisionManager.Add (gameObject);
         _gameObjectsContained.Add (gameObject);
     }
 }
Esempio n. 5
0
 //------------------------------------------------------------------------------------------------------------------------
 //                                                        Contains()
 //------------------------------------------------------------------------------------------------------------------------
 public Boolean Contains(GameObject gameObject)
 {
     return _gameObjectsContained.Contains(gameObject);
 }
Esempio n. 6
0
 //------------------------------------------------------------------------------------------------------------------------
 //                                                        removeChild()
 //------------------------------------------------------------------------------------------------------------------------
 private void removeChild(GameObject child)
 {
     _children.Remove(child);
 }
Esempio n. 7
0
 //------------------------------------------------------------------------------------------------------------------------
 //                                                        addChild()
 //------------------------------------------------------------------------------------------------------------------------
 private void addChild(GameObject child)
 {
     if (child.HasChild(this)) return; //no recursive adding
     _children.Add(child);
     return;
 }
Esempio n. 8
0
 //------------------------------------------------------------------------------------------------------------------------
 //                                                        SetChildIndex()
 //------------------------------------------------------------------------------------------------------------------------
 /// <summary>
 /// Inserts the specified object in this object's child list at given location.
 /// This will alter the position of other objects as well.
 /// You can use this to determine the layer order (z-order) of child objects.
 /// </summary>
 /// <param name='child'>
 /// Child.
 /// </param>
 /// <param name='index'>
 /// Index.
 /// </param>
 public void SetChildIndex(GameObject child, int index)
 {
     if (child.parent != this) AddChild(child);
     if (index < 0) index = 0;
     if (index >= _children.Count) index = _children.Count - 1;
     _children.Remove(child);
     _children.Insert(index, child);
 }
Esempio n. 9
0
 //------------------------------------------------------------------------------------------------------------------------
 //                                                        RemoveChild()
 //------------------------------------------------------------------------------------------------------------------------
 /// <summary>
 /// Removes the specified child GameObject from this object.
 /// </summary>
 /// <param name='child'>
 /// Child object to remove.
 /// </param>
 public void RemoveChild(GameObject child)
 {
     if (child.parent == this) {
         child.parent = null;
     }
 }
Esempio n. 10
0
 //------------------------------------------------------------------------------------------------------------------------
 //                                                        HitTest()
 //------------------------------------------------------------------------------------------------------------------------
 /// <summary>
 /// Tests if this object overlaps the one specified. 
 /// </summary>
 /// <returns>
 /// <c>true</c>, if test was hit, <c>false</c> otherwise.
 /// </returns>
 /// <param name='other'>
 /// Other.
 /// </param>
 public virtual bool HitTest(GameObject other)
 {
     return _collider != null && other._collider != null && _collider.HitTest (other._collider);
 }
Esempio n. 11
0
 //------------------------------------------------------------------------------------------------------------------------
 //                                                        HasChild()
 //------------------------------------------------------------------------------------------------------------------------
 /// <summary>
 /// Returns 'true' if the specified object is a child of this object.
 /// </summary>
 /// <param name='gameObject'>
 /// The GameObject that should be tested.
 /// </param>
 public bool HasChild(GameObject gameObject)
 {
     GameObject par = gameObject;
     while (par != null) {
         if (par == this) return true;
         par = par.parent;
     }
     return false;
 }
Esempio n. 12
0
 //------------------------------------------------------------------------------------------------------------------------
 //                                                        AddChild()
 //------------------------------------------------------------------------------------------------------------------------
 /// <summary>
 /// Adds the specified GameObject as a child to this one.
 /// </summary>
 /// <param name='child'>
 /// Child object to add.
 /// </param>
 public void AddChild(GameObject child)
 {
     child.parent = this;
 }