I need to setup a power up system so on shift down the rigid-body on the player will be disabled. Here is the code I have so far. The only problem with this code is when you hit shift in the game.... Frozen freezes up every time.
void Update ()
{
PowerupTimer = Time.realtimeSinceStartup;
PowerupTimer2 = Time.realtimeSinceStartup + 5;
if(Input.GetKeyDown(KeyCode.LeftShift) & PowerupUsed == false)
{
NoclipPowerup();
}
}
void InstantiatePlatforms()
{
while(NumberOfPlatforms > 0)
{
RandNum = Random.Range(0,PlatformList.Count); //Generates a random number from zero to the total amount of things in our list
Instantiate(Platform, PlatformList[RandNum].position, Quaternion.identity);
PlatformList.RemoveAt(RandNum); //Removes the transform contained at the index we picked at random. You don't want to reuse a spot, since that could put a platform on top of a platform.
NumberOfPlatforms = NumberOfPlatforms - 1;
}
}
void NoclipPowerup()
{
while(PowerupTimer < PowerupTimer2)
{
Debug.Log("The Powerup works");
}
}
Any ideas on the powerup and/or how to fix the crash?
↧