spaceconquest.Ship.SetGhost C# (CSharp) Method

SetGhost() public method

public SetGhost ( Hex3D target ) : void
target Hex3D
return void
        public void SetGhost(Hex3D target)
        {
            //Console.WriteLine("setting ghost");

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

            if (ghosthex != null) ghosthex.SetGhostObject(null);
            ghosthex = target;
            target.SetGhostObject(this);
            if (this.hex.hexgrid == ghosthex.hexgrid)
            {
                //Console.WriteLine("creating new linemodel");
                line = new LineModel(getCenter(), ghosthex.getCenter());
            }
        }