コード例 #1
0
ファイル: ActorNode.cs プロジェクト: 207h2Flogintvg/LGame
        public ActorNode(Actor actor, BSPCollisionNode node)
        {
            this.actor = actor;
            this.node = node;
            ActorNode first = BSPCollisionChecker.GetNodeForActor(actor);
            this.next = first;
            BSPCollisionChecker.SetNodeForActor(actor, this);
            if (this.next != null)
            {
                this.next.prev = this;
            }

            this.mark = true;
        }
コード例 #2
0
        public bool ContainsActor(Actor actor)
        {
            ActorNode anode = (ActorNode)CollectionUtils.Get(actors, actor);

            if (anode != null)
            {
                anode.Mark();
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #3
0
ファイル: ActorNode.cs プロジェクト: 207h2Flogintvg/LGame
 public void Removed()
 {
     if (this.prev == null)
     {
         BSPCollisionChecker.SetNodeForActor(this.actor, this.next);
     }
     else
     {
         this.prev.next = this.next;
     }
     if (this.next != null)
     {
         this.next.prev = this.prev;
     }
 }
コード例 #4
0
 public void Removed()
 {
     if (this.prev == null)
     {
         BSPCollisionChecker.SetNodeForActor(this.actor, this.next);
     }
     else
     {
         this.prev.next = this.next;
     }
     if (this.next != null)
     {
         this.next.prev = this.prev;
     }
 }
コード例 #5
0
        public ActorNode(Actor actor, BSPCollisionNode node)
        {
            this.actor = actor;
            this.node  = node;
            ActorNode first = BSPCollisionChecker.GetNodeForActor(actor);

            this.next = first;
            BSPCollisionChecker.SetNodeForActor(actor, this);
            if (this.next != null)
            {
                this.next.prev = this;
            }

            this.mark = true;
        }
コード例 #6
0
 public void Dispose()
 {
     if (node != null)
     {
         node = null;
     }
     if (next != null)
     {
         next.Dispose();
         next = null;
     }
     if (prev != null)
     {
         prev.Dispose();
         prev = null;
     }
 }
コード例 #7
0
 public static void SetNodeForActor(Actor o, ActorNode node)
 {
     o.data = node;
 }
コード例 #8
0
ファイル: BSPCollisionChecker.cs プロジェクト: vb0067/LGame
        private void UpdateObject(Actor o)
        {
            ActorNode node = GetNodeForActor(o);

            if (node != null)
            {
                RectBox          newBounds = this.GetActorBounds(o);
                BSPCollisionNode bspNode;
                if (!this.bspTree.GetArea().Contains(newBounds))
                {
                    for (; node != null;)
                    {
                        bspNode = node.GetBSPNode();
                        node.Remove();
                        this.CheckRemoveNode(bspNode);
                        node = node.GetNext();
                    }
                    this.AddObject(o);
                }
                else
                {
                    RectBox bspArea;
                    RectBox result1 = new RectBox();
                    RectBox result2 = new RectBox();
                    while (node != null)
                    {
                        bspNode = node.GetBSPNode();
                        bspArea = bspNode.GetArea();
                        if (bspArea.Contains(newBounds))
                        {
                            for (ActorNode rNode2 = GetNodeForActor(o); rNode2 != null; rNode2 = rNode2
                                                                                                 .GetNext())
                            {
                                if (rNode2 != node)
                                {
                                    BSPCollisionNode rNode1 = rNode2.GetBSPNode();
                                    rNode2.Remove();
                                    this.CheckRemoveNode(rNode1);
                                }
                            }
                            return;
                        }
                        if (!bspArea.Intersects(newBounds))
                        {
                            BSPCollisionNode rNode = node.GetBSPNode();
                            node.Remove();
                            this.CheckRemoveNode(rNode);
                        }
                        node.ClearMark();
                        node = node.GetNext();
                    }
                    node = GetNodeForActor(o);
                    if (node != null)
                    {
                        for (bspNode = node.GetBSPNode(); bspNode != null &&
                             !bspNode.GetArea().Contains(newBounds); bspNode = bspNode
                                                                               .GetParent())
                        {
                            ;
                        }
                        if (bspNode == null)
                        {
                            while (node != null)
                            {
                                bspNode = node.GetBSPNode();
                                node.Remove();
                                this.CheckRemoveNode(bspNode);
                                node = node.GetNext();
                            }

                            this.AddObject(o);
                            return;
                        }
                    }
                    else
                    {
                        bspNode = this.bspTree;
                    }

                    bspArea = bspNode.GetArea();
                    this.InsertObject(o, newBounds, newBounds, bspArea,
                                      bspNode, result1, result2);
                    for (node = GetNodeForActor(o); node != null; node = node
                                                                         .GetNext())
                    {
                        if (!node.CheckMark())
                        {
                            bspNode = node.GetBSPNode();
                            node.Remove();
                            this.CheckRemoveNode(bspNode);
                        }
                    }
                }
            }
        }
コード例 #9
0
ファイル: BSPCollisionChecker.cs プロジェクト: vb0067/LGame
 public static void SetNodeForActor(Actor o, ActorNode node)
 {
     o.data = node;
 }
コード例 #10
0
ファイル: ActorNode.cs プロジェクト: 207h2Flogintvg/LGame
        public void Dispose()
        {
            if (node != null)
            {
                node = null;
            }
            if (next != null)
            {
                next.Dispose();
                next = null;
            }
            if (prev != null)
            {
                prev.Dispose();
                prev = null;
            }

        }