Exemple #1
0
        public static ConstellationPattern CreateDefaultConstellation()
        {
            ConstellationPattern patternToCreate = new ConstellationPattern();

            ConstellationNode node1 = new ConstellationNode();

            node1.Name = "head1";
            patternToCreate.AddNode(node1);
            ConstellationNode node2 = new ConstellationNode();

            node2.Name = "head2";
            patternToCreate.AddNode(node2);
            //ConstellationNode node3 = new ConstellationNode();
            //node3.Name = "tail";
            //patternToCreate.AddNode(node3);
            ConstellationNodeSelf self = new ConstellationNodeSelf();

            self.Name = "self";
            patternToCreate.AddNode(self);

            ConstellationLink link = new ConstellationLink(self, node2);

            patternToCreate.AddNodeLink(link);
            ConstellationLink link2 = new ConstellationLink(self, node1);

            patternToCreate.AddNodeLink(link2);
            //ConstellationLink link3 = new ConstellationLink(node1, node2);
            //patternToCreate.AddNodeLink(link3);
            //ConstellationLink link4 = new ConstellationLink(self, node3);
            //patternToCreate.AddNodeLink(link4);

            return(patternToCreate);
        }
Exemple #2
0
        public static ConstellationPattern CreateDeathConstellation()
        {
            ConstellationPattern patternToCreate = new ConstellationPattern();

            ConstellationNode node1 = new ConstellationNode();

            patternToCreate.AddNode(node1);
            ConstellationNode node2 = new ConstellationNode();

            patternToCreate.AddNode(node2);
            ConstellationNode node3 = new ConstellationOpponentNode();

            patternToCreate.AddNode(node3);
            ConstellationNodeSelf self = new ConstellationNodeSelf();

            patternToCreate.AddNode(self);

            ConstellationLink link = new ConstellationLink(self, node2);

            patternToCreate.AddNodeLink(link);
            ConstellationLink link2 = new ConstellationLink(self, node1);

            patternToCreate.AddNodeLink(link2);
            ConstellationLink link3 = new ConstellationLink(self, node3);

            patternToCreate.AddNodeLink(link3);

            return(patternToCreate);
        }
Exemple #3
0
        public static ConstellationPattern CreateSunConstellation()
        {
            ConstellationPattern patternToCreate = new ConstellationPattern();

            ConstellationNode node1 = new ConstellationAllyNode();

            patternToCreate.AddNode(node1);
            ConstellationNode node2 = new ConstellationAllyNode();

            patternToCreate.AddNode(node2);
            ConstellationNode node3 = new ConstellationNode();

            patternToCreate.AddNode(node3);
            ConstellationNodeSelf self = new ConstellationNodeSelf();

            patternToCreate.AddNode(self);

            ConstellationLink link = new ConstellationLink(self, node2);

            patternToCreate.AddNodeLink(link);
            ConstellationLink link2 = new ConstellationLink(self, node1);

            patternToCreate.AddNodeLink(link2);
            ConstellationLink link3 = new ConstellationLink(node2, node3);

            patternToCreate.AddNodeLink(link3);
            ConstellationLink link4 = new ConstellationLink(node1, node3);

            patternToCreate.AddNodeLink(link4);

            return(patternToCreate);
        }
Exemple #4
0
        public void AddNode(ConstellationNode nodeToAdd)
        {
            this.ConstellationNodeSystem.Add(nodeToAdd);

            this.constellationNodeToLinks.Add(nodeToAdd, new HashSet <ConstellationLink>());

            if (nodeToAdd is ConstellationNodeSelf)
            {
                this.NodeSelf = nodeToAdd as ConstellationNodeSelf;
            }
        }
Exemple #5
0
        public void RemoveNode(ConstellationNode nodeToRemove)
        {
            this.ConstellationNodeSystem.Remove(nodeToRemove);

            HashSet <ConstellationLink> linksList = this.constellationNodeToLinks[nodeToRemove];

            this.ConstellationNodeSystem.Remove(nodeToRemove);

            foreach (ConstellationLink link in linksList)
            {
                this.RemoveNodeLink(link);
            }
        }
Exemple #6
0
        public static ConstellationPattern CreateCartConstellation()
        {
            ConstellationPattern patternToCreate = new ConstellationPattern();

            ConstellationNode node1 = new ConstellationNode();

            patternToCreate.AddNode(node1);
            ConstellationNodeSelf self = new ConstellationNodeSelf();

            patternToCreate.AddNode(self);

            ConstellationLink link = new ConstellationLink(self, node1);

            patternToCreate.AddNodeLink(link);

            return(patternToCreate);
        }
Exemple #7
0
        private void StackConstellationElementFrom(ConstellationLink fromLink, ConstellationNode node, StarEntity starEntity)
        {
            HashSet <ConstellationLink> connectedLinks = this.constellationNodeToLinks[node];

            foreach (ConstellationLink link in connectedLinks)
            {
                if (link != fromLink)
                {
                    ConstellationNode otherNode;
                    if (link.Node1 == node)
                    {
                        otherNode = link.Node2;
                    }
                    else
                    {
                        otherNode = link.Node1;
                    }

                    this.pathStarEntities.Push(starEntity);
                    this.constellationStack.Push(new Tuple <ConstellationLink, ConstellationNode>(link, otherNode));
                }
            }
        }
Exemple #8
0
 public ConstellationLink(ConstellationNode node1, ConstellationNode node2)
 {
     this.Node1 = node1;
     this.Node2 = node2;
 }