Example #1
0
        /// <summary>
        /// Adds a new jump point to the system. Since JPs can't be destroyed there is no corresponding remove function. Perhaps there should be.
        /// </summary>
        /// <param name="parentStar">Star to attach this JP to.</param>
        /// <param name="Position.XAU">X offset from Star Position</param>
        /// <param name="Position.YAU">Y offset from Star Position.</param>
        /// <returns>Newly Created Jumpoint</returns>
        public JumpPoint CreateJumpPoint(Star parentStar, double XOffsetAU, double YOffsetAU)
        {
            JumpPoint NewJP = new JumpPoint(this, parentStar, XOffsetAU, YOffsetAU);

            JumpPoints.Add(NewJP);
            return(NewJP);
        }
Example #2
0
        private void SetJump(YuoGrid grid, int x, int y)
        {
            grid.CanJump = true;
            if (!JumpPoints.Contains(grid))
            {
                //print("添加了一个跳点");
                JumpPoints.Add(grid);
                grid.sr.color = Color.green;
            }

            grid.jump.AddDir(x == -1 ? Dir.Right : Dir.Left);
            grid.jump.AddDir(y == -1 ? Dir.Up : Dir.Down);
            foreach (var item in grid.jump.Dirs)
            {
                if (item == Vector2Int.up)
                {
                    grid.sr.transform.GetChild(2).gameObject.SetActive(true);
                }
                if (item == Vector2Int.down)
                {
                    grid.sr.transform.GetChild(3).gameObject.SetActive(true);
                }
                if (item == Vector2Int.left)
                {
                    grid.sr.transform.GetChild(0).gameObject.SetActive(true);
                }
                if (item == Vector2Int.right)
                {
                    grid.sr.transform.GetChild(1).gameObject.SetActive(true);
                }
            }
        }
Example #3
0
        /// <summary>
        /// Adds a new jump point to the system. Since JPs can't be destroyed there is no corresponding remove function. Perhaps there should be.
        /// </summary>
        /// <param name="XSystemAU">X Location in AU of JP.</param>
        /// <param name="YSystemAU">Y Location in AU of JP.</param>
        public void AddJumpPoint(double XSystemAU, double YSystemAU)
        {
            JumpPoint NewJP = new JumpPoint(this, XSystemAU, YSystemAU);

            JumpPoints.Add(NewJP);
        }