示例#1
0
        public void ApplyGravity(Moon other, string axis)
        {
            switch (axis)
            {
            case "x":
                this.VX += this.X < other.X ? 1 : this.X == other.X ? 0 : -1;
                break;

            case "y":
                this.VY += this.Y < other.Y ? 1 : this.Y == other.Y ? 0 : -1;
                break;

            case "z":
                this.VZ += this.Z < other.Z ? 1 : this.Z == other.Z ? 0 : -1;
                break;
            }
        }
示例#2
0
 public void ApplyGravity(Moon other)
 {
     this.VX += this.X < other.X ? 1 : this.X == other.X ? 0 : -1;
     this.VY += this.Y < other.Y ? 1 : this.Y == other.Y ? 0 : -1;
     this.VZ += this.Z < other.Z ? 1 : this.Z == other.Z ? 0 : -1;
 }