I have a script attached to my Player object, and within the player script there is a nested class called PowerContainer. Within this nested class there is a method which needs to set a value to true, wait for a specified amount of time, then set the falue back to false.
The trouble is, when I try and run the game with this code in place, I get the following error:
CS0038: Cannot acces a nonstatic memeber of outer type PlayerController via nested type PlayerController.PowerContainer.
But the method I’m trying to Invoke is a member of PlayerController.PowerContainer, not PlayerController
public class PlayerController : MonoBehaviour
{
private class PowerContainer
{
protected bool MULTI_SHOT = false;
public void giveMultiShot(float _amountOfSeconds)
{
this.MULTI_SHOT = true;
Invoke("removeMultiShot", _amountOfSeconds);
}
private void removeMultiShot()
{
MULTI_SHOT = false;
}
public bool hasMultiShot()
{
return this.MULTI_SHOT;
}
}
}