I am doing an app of constellations using csv data and stuffs. Now I could insert the data with code in the inspector and display it with prefabs. Now, the thing is I want to be able to insert the RA of the data (hours, min, seconds)
in the code that implement the data I wrote first the statement of it as public float at least to be able to see it
[System.Serializable]
public class StarData
{
public float RightAscension;
}
I run the scene and I can see the float perfectly in the inspector. I have another script where I call this other scrip with strings and all of that but the thing that I just want is to be able to set three different variables for hour, min and second to the public float RightAscension.
I want to insert something like this but I dont know how to grab it.
public float RightAscensionToDegree(int hour, int min = 0, float sec = 0.0f)
{
var h = 360.0f / 24.0f;
var m = h / 60.0f;
var s = m / 60.0f;
return (h * hour + m * min + s * sec) * -1.0f;
}
and then in the other script calling it with this line of code
RightAscension = RightAscensionToDegree(int.Parse(values[1]), int.Parse(values[2]), float.Parse(values[3]) );
Can someone please tell a simple way to do so? It will be very helpful. Thanks!