示例#1
0
    public static float GetVector(Ship.GenericShip thisShip, Ship.GenericShip anotherShip)
    {
        float result = 0;

        float   angle          = 0;
        Vector3 vectorFacing   = thisShip.GetFrontFacing();
        Vector3 vectorToTarget = anotherShip.GetCenter() - thisShip.GetCenter();

        angle = Mathf.Abs(Vector3.Angle(vectorToTarget, vectorFacing));

        int direction = 0;

        direction = (thisShip.Model.transform.InverseTransformPoint(anotherShip.GetCenter()).x > 0) ? 1 : -1;

        result = angle * direction;

        return(result);
    }
示例#2
0
 private Vector3 GetObjectLocation()
 {
     if (ChosenObstacle != null)
     {
         return(ChosenObstacle.ObstacleGO.transform.position);
     }
     else if (ChosenShip != null)
     {
         return(ChosenShip.GetCenter());
     }
     else
     {
         return(Vector3.zero);
     }
 }
 private Vector3 GetObjectLocation()
 {
     if (ChosenObstacle != null)
     {
         return(ChosenObstacle.ObstacleGO.transform.position);
     }
     else if (ChosenShip != null)
     {
         return(ChosenShip.GetCenter());
     }
     else
     {
         Console.Write("Tried to move an obstacle or ship by touch but no obstacle or ship was selected", LogTypes.Errors, true, "red");
         return(Vector3.zero);
     }
 }