Beispiel #1
0
        public void addPhysicsObj(GameObject _gameObj,Body _body)
        {
            PhysicsObj obj = new PhysicsObj(_gameObj, _body);
            _gameObj.physicsObj = obj;

            this.privActiveAddToFront((ManLink)obj, ref this.active);
        }
        public void Set(GameObject _obj)
        {
            base.Initialize();

            this.gameObj = _obj;
            this.type = _obj.type;
        }
 public GameObjNode()
 {
     this.Initialize();
     this.gameObj = null;
 }
        private GameObjNode findGameObj(GameObject _obj)
        {
            ManLink ptr = this.active;

            ManLink outNode = null;

            while (ptr != null)
            {
                if ((ptr as GameObjNode).gameObj.Equals(_obj))
                {
                    outNode = ptr;
                    break;
                }
                ptr = ptr.next;
            }

            return (outNode as GameObjNode);
        }
        public void remove(batchEnum _enum, GameObject _obj)
        {
            GameObjNode node = findGameObj(_obj);

            if (node != null)
            {
                if (node.prev != null)
                {	// middle or last node
                    node.prev.next = node.next;
                }
                else
                {  // first
                    this.active = node.next;
                }

                if (node.next != null)
                {	// middle node
                    node.next.prev = node.prev;
                }

                addBodyToDestroy(_obj.physicsObj.body);

                if (_obj.spriteRef != null)
                {
                    SBNode SBNode = SpriteBatchManager.Instance().getBatch(_enum);
                    SBNode.removeDisplayObject(_obj.spriteRef);
                }

                if (_obj.physicsObj != null)
                {
                    PhysicsMan.Instance().removePhysicsObj(_obj.physicsObj);
                }
            }
        }
        // For Linked List
        public void addGameObj(GameObject _obj)
        {
            GameObjNode node = new GameObjNode();
            _obj.setIndexNum(objNumberCounter++);
            node.Set(_obj);

            this.privActiveAddToFront((ManLink)node, ref this.active);
        }
Beispiel #7
0
 public PhysicsObj(GameObject _obj, Body _body)
 {
     gameObj = _obj;
     body = _body;
 }
Beispiel #8
0
 public override void Accept(GameObject other, Vector2 _point)
 {
     other.VisitBomb(this, _point);
 }
Beispiel #9
0
 public virtual void Accept(GameObject _obj, Vector2 _point)
 {
 }