Hello!
Iam working on a perk-system and have a question about saving:
If you can find in the code below the perk named “Sleight Of Hand”,
you can see that i have made that the reload time on the gun
gets much faster when selected. But the problem is that
i wan’t to SAVE that the reload time on the gun goes faster when chosen, or else it is normal speed.
And if you can ready make a code, and use PlayerPrefs, i will learn to
use playerprefs so i don’t need to ask more about saving!(or if you have other methodes, i will accept that too)
Thanks for all answers
//Code:
var isInWC = false;
var isInCC = false;
var isInPerks = false;
var isInExtra = false;
var backLevel : String;
var Perks : GameObject;
public var gun : Transform;
function OnGUI ()
{
GUI.backgroundColor = Color.blue;
GUI.color = Color.cyan;
if (GUI.Button(Rect(20,100,200,20),"Weapon costumazation"))
{
isInWC = true;
isInCC = false;
isInPerks = false;
isInExtra = false;
}
if (GUI.Button(Rect(20,150,200,20),"Character costumazation"))
{
isInCC = true;
isInWC = false;
isInPerks = false;
isInExtra = false;
}
if (GUI.Button(Rect(20,200,70,20),"Perks"))
{
isInPerks = true;
isInWC = false;
isInCC = false;
isInExtra = false;
}
if (GUI.Button(Rect(20,250,70,20),"Extra"))
{
isInExtra = true;
isInWC = false;
isInCC = false;
isInPerks = false;
}
if(isInPerks)
{
if (GUI.Button(Rect(450,130,120,20),"Sleight Of Hand"))
{
gun.animation["Fire"].speed = 2;
}
if (GUI.Button(Rect(450,160,120,20),"Aimer"))
{
}
if (GUI.Button(Rect(450,190,120,20),"Backpack"))
{
}
if (GUI.Button(Rect(450,220,120,20),"Kick"))
{
}
}
if (GUI.Button(Rect(20,350,70,20),"Back"))
{
Application.LoadLevel(backLevel);
}
}