Hello
I have made a script that stores certain variables in players prefs and set a few variables depending on another variable. My code is here
using UnityEngine;
using System.Collections;
public class League : MonoBehaviour {
int DivisionNumber;
int RacesLeft;
int Points;
int PointsForWin;
int PointsForPrize;
int PointsForOut;
int MoneyForWin;
int MoneyForPrize;
int MoneyForOut;
int MoneyForRelegation;
int TotalMoney;
int FameForWin;
int FameForPrize;
int FameForOut;
int FameForRelegation;
int TotalFame;
// Use this for initialization
void Start () {
Career_Variables Career_Variables = GameObject.Find("career_Variables").GetComponent<Career_Variables>();
}
// Update is called once per frame
void Update () {
if (DivisionNumber == 15)
{
PointsForWin = 10;
PointsForPrize = 6;
PointsForOut = 3;
MoneyForWin = 20000;
MoneyForPrize = 10000;
MoneyForOut = 7500;
MoneyForRelegation = 3500;
FameForWin = 30000;
FameForPrize = 20000;
FameForOut = 12500;
FameForRelegation = 5000;
}
if (DivisionNumber == 14)
{
PointsForWin = 11;
PointsForPrize = 7;
PointsForOut = 4;
MoneyForWin = 30000;
MoneyForPrize = 15000;
MoneyForOut = 17500;
MoneyForRelegation = 7500;
FameForWin = 40000;
FameForPrize = 27500;
FameForOut = 17500;
FameForRelegation = 7500;
}
if (DivisionNumber == 13)
{
PointsForWin = 12;
PointsForPrize = 9;
PointsForOut = 5;
MoneyForWin = 50000;
MoneyForPrize = 35000;
MoneyForOut = 25000;
MoneyForRelegation = 10000;
FameForWin = 50000;
FameForPrize = 35000;
FameForOut = 25000;
FameForRelegation = 10000;
}
if (DivisionNumber == 12)
{
PointsForWin = 15;
PointsForPrize = 12;
PointsForOut = 7;
MoneyForWin = 75000;
MoneyForPrize = 50000;
MoneyForOut = 35000;
MoneyForRelegation = 15000;
FameForWin = 75000;
FameForPrize = 50000;
FameForOut = 35000;
FameForRelegation = 15000;
}
if (DivisionNumber == 11)
{
PointsForWin = 16;
PointsForPrize = 13;
PointsForOut = 8;
MoneyForWin = 100000;
MoneyForPrize = 65000;
MoneyForOut = 45000;
MoneyForRelegation = 20000;
FameForWin = 100000;
FameForPrize = 65000;
FameForOut = 45000;
FameForRelegation = 20000;
}
if (DivisionNumber == 10)
{
PointsForWin = 17;
PointsForPrize = 14;
PointsForOut = 9;
MoneyForWin = 125000;
MoneyForPrize = 80000;
MoneyForOut = 50000;
MoneyForRelegation = 25000;
FameForWin = 125000;
FameForPrize = 80000;
FameForOut = 50000;
FameForRelegation = 25000;
}
if (DivisionNumber == 9)
{
PointsForWin = 21;
PointsForPrize = 17;
PointsForOut = 12;
MoneyForWin = 175000;
MoneyForPrize = 100000;
MoneyForOut = 60000;
MoneyForRelegation = 40000;
FameForWin = 175000;
FameForPrize = 100000;
FameForOut = 60000;
FameForRelegation = 40000;
}
if (DivisionNumber == 8)
{
PointsForWin = 22;
PointsForPrize = 18;
PointsForOut = 13;
MoneyForWin = 225000;
MoneyForPrize = 120000;
MoneyForOut = 70000;
MoneyForRelegation = 50000;
FameForWin = 225000;
FameForPrize = 120000;
FameForOut = 70000;
FameForRelegation = 50000;
}
if (DivisionNumber == 7)
{
PointsForWin = 23;
PointsForPrize = 18;
PointsForOut = 13;
MoneyForWin = 275000;
MoneyForPrize = 150000;
MoneyForOut = 85000;
MoneyForRelegation = 65000;
FameForWin = 275000;
FameForPrize = 150000;
FameForOut = 85000;
FameForRelegation = 65000;
}
if (DivisionNumber == 6)
{
PointsForWin = 24;
PointsForPrize = 19;
PointsForOut = 14;
MoneyForWin = 400000;
MoneyForPrize = 250000;
MoneyForOut = 100000;
MoneyForRelegation = 10000;
FameForWin = 400000;
FameForPrize = 250000;
FameForOut = 100000;
FameForRelegation = 10000;
}if (DivisionNumber == 5)
{
PointsForWin = 25;
PointsForPrize = 20;
PointsForOut = 15;
MoneyForWin = 500000;
MoneyForPrize = 150000;
MoneyForOut = 25000;
MoneyForRelegation = 10000;
FameForWin = 275000;
FameForPrize = 150000;
FameForOut = 25000;
FameForRelegation = 10000;
}if (DivisionNumber == 4)
{
PointsForWin = 26;
PointsForPrize = 18;
PointsForOut = 13;
MoneyForWin = 275000;
MoneyForPrize = 150000;
MoneyForOut = 25000;
MoneyForRelegation = 10000;
FameForWin = 275000;
FameForPrize = 150000;
FameForOut = 25000;
FameForRelegation = 10000;
}
if (DivisionNumber == 3)
{
PointsForWin = 26;
PointsForPrize = 18;
PointsForOut = 13;
MoneyForWin = 275000;
MoneyForPrize = 150000;
MoneyForOut = 25000;
MoneyForRelegation = 10000;
FameForWin = 275000;
FameForPrize = 150000;
FameForOut = 25000;
FameForRelegation = 10000;
}
if (DivisionNumber == 2)
{
PointsForWin = 26;
PointsForPrize = 18;
PointsForOut = 13;
MoneyForWin = 275000;
MoneyForPrize = 150000;
MoneyForOut = 25000;
MoneyForRelegation = 10000;
FameForWin = 275000;
FameForPrize = 150000;
FameForOut = 25000;
FameForRelegation = 10000;
}
if (DivisionNumber == 1)
{
PointsForWin = 26;
PointsForPrize = 18;
PointsForOut = 13;
MoneyForWin = 275000;
MoneyForPrize = 150000;
MoneyForOut = 25000;
MoneyForRelegation = 10000;
FameForWin = 275000;
FameForPrize = 150000;
FameForOut = 25000;
FameForRelegation = 10000;
}
}
if (RacesLeft == 0 && Points >= PointsForWin)
{
TotalFame = FameForWin + Career_Variables.Fame;
TotalMoney = MoneyForWin + Career_Variables.money;
}
if (RacesLeft == 0 && Points >= PointsForPrize && Points < PointsForWin)
{
TotalFame = FameForPrize + Career_Variables.Fame;
TotalMoney = MoneyForPrize + Career_Variables.money;
}
if (RacesLeft == 0 && Points >= PointsForOut && Points < PointsForPrize)
{
TotalFame = FameForOut + Career_Variables.Fame;
TotalMoney = MoneyForOut + Career_Variables.money;
}
if (RacesLeft == 0 && Points < PointsForOut)
{
TotalFame = FameForRelegation + Career_Variables.Fame;
TotalMoney = MoneyForRelegation + Career_Variables.money;
}
if (RacesLeft == 0 && Points >= PointsForPrize)
{
if (DivisionNumber > 1)
{
PlayerPrefs.SetInt("DivisionNumber", DivisionNumber --);
PlayerPrefs.SetInt("Career_Variables.Fame", TotalFame);
PlayerPrefs.SetInt("Career_Variables.money", TotalMoney);
}
else
{
PlayerPrefs.SetInt("Career_Variables.Fame", TotalFame);
PlayerPrefs.SetInt("Career_Variables.money", TotalMoney);
}
}
if (RacesLeft == 0 && Points < PointsForPrize && Points > PointsForOut)
{
PlayerPrefs.SetInt("Career_Variables.Fame", TotalFame);
PlayerPrefs.SetInt("Career_Variables.money", TotalMoney);
}
if (RacesLeft == 0 && Points < PointsForWin)
{
if (DivisionNumber == 15)
{
PlayerPrefs.SetInt("Career_Variables.Fame", TotalFame);
PlayerPrefs.SetInt("Career_Variables.money", TotalMoney);
}
else
{
PlayerPrefs.SetInt("DivisionNumber", DivisionNumber ++);
PlayerPrefs.SetInt("Career_Variables.Fame", TotalFame);
PlayerPrefs.SetInt("Career_Variables.money", TotalMoney);
}
}
}
}
I know that its not the most efficient piece of code and I may shorten it and use arrays later but for now I get 11 errors. 10 of them say error CS1519: Unexpected symbol (whatever the symbol is e.g. +, ; etc.) in class, struct, or interface member declaration.
One example of an error is (244,32): error CS1519: Unexpected symbol `==’ in class, struct, or interface member declaration
The other type of error is (250,18): error CS8025: Parsing error.
Im not sure what the problem is so any help will be appreciated
Thank you