spaceconquest.Ship.move C# (CSharp) Method

move() public method

public move ( Hex3D target ) : void
target Hex3D
return void
        public void move(Hex3D target)
        {
            hex.RemoveObject();
            //oldposition = hex.getCenter();
            //percenttraveled = 0;

            if (ghosthex != null) ghosthex.ClearGhostObject();
            line = null;
            targetpositions.Enqueue(target.getCenter());

            double x = target.getCenter().X - hex.getCenter().X;
            double y = hex.getCenter().Y - target.getCenter().Y;
            double newangle = Math.Atan(x / y);
            //Console.WriteLine(" x  " + x);
            //Console.WriteLine(" y " + y);
            if (y < 0) newangle = newangle + Math.PI;
            //Console.WriteLine("angle -> " + newangle);
            targetangles.Enqueue(newangle);

            SetHex(target);
        }