Exemple #1
0
        internal StarLinkEntity AddStarLink(StarEntity starEntityFrom, StarEntity starEntityTo)
        {
            StarLinkEntity link = new StarLinkEntity(this, starEntityFrom, starEntityTo);

            this.StarLinkSystem.Add(link);
            this.AddEntityToLayer(link);

            this.StarToLinks[starEntityFrom].Add(link);
            this.StarToLinks[starEntityTo].Add(link);

            return(link);
        }
Exemple #2
0
        protected void RemoveStarLink(StarLinkEntity starLinkEntity)
        {
            this.StarLinkSystem.Remove(starLinkEntity);
            this.RemoveEntityFromLayer(starLinkEntity);

            if (this.StarToLinks.ContainsKey(starLinkEntity.StarFrom))
            {
                this.StarToLinks[starLinkEntity.StarFrom].Remove(starLinkEntity);
            }

            if (this.StarToLinks.ContainsKey(starLinkEntity.StarTo))
            {
                this.StarToLinks[starLinkEntity.StarTo].Remove(starLinkEntity);
            }
        }
Exemple #3
0
        private void CreateDomainLinks(BoardGameLayer boardGameLayer)
        {
            this.DomainLinks = new Dictionary <StarEntity, StarLinkEntity>();

            for (int i = 0; i < this.Domain.Count; i++)
            {
                StarEntity currentStarEntity = this.Domain[i];
                StarEntity nextStarEntity    = this.Domain[(i + 1) % this.Domain.Count];

                StarLinkEntity currentLink = boardGameLayer.StarToLinks[currentStarEntity].FirstOrDefault(pElem => pElem.StarFrom == nextStarEntity || pElem.StarTo == nextStarEntity);
                if (currentLink != null)
                {
                    this.DomainLinks.Add(currentStarEntity, currentLink);
                }
            }
        }