I have a GameManager class that handles various operations during gameplay. I have a Ball class which contains the following static method:
public static void CheckAllBallsAreStill()
{
GameManager.allBallsAreStill = true;
foreach(Ball ball in Ball.BallList)
{
if(ball.ballState != BallState.RestingBall)//if the ball is not at rest
{
if(!ball.isDead)//if the not-at-rest ball isn't dead
{
GameManager.allBallsAreStill = false;
}
}
}
}
The GameManager class also has a reference to a Ball object - public GameObject Ball; at the top of the file. What I want to do each in each Update() is Access CheckAllBallsAreStill(). It stikes me that because I'm iterating through a list that a static method residing in the Ball class called once each click from my GameManager seems the most appropriate thing to do.
I've been on this site and the Unity scripting guide and tried various GetComponent methods within the GameManager class and I can access non-static methods & variables but not the static method. It's like I can only access an object instantiated from the Ball class but not the class itself. Any help would be much appreciated.