Max Attribute Points (C#)

I am following this video tutorial guide on making a RPG, but I felt like skipping ahead on my own and adding a function that restricts the player from adding more than 100 points to their attributes. The piece of code I wrote to create this isn’t working and I was wondering if anyone would be able to take a look and see what I am doing wrong. This is the whole script and the part where it calls the Max_attribute_points is at lines 115 through 125. I figured I could just copy the same thing on line 99 and reverse that to allow me to do what I want but it’s giving me these errors:

Assets/Scripts/Character Classes/CharacterGenerator.cs(123,53): error CS1525: Unexpected symbol `;’

Assets/Scripts/Character Classes/CharacterGenerator.cs(122,83): error CS1525: Unexpected symbol `;’

The Script:

using UnityEngine;
using System.Collections;
using System;

public class CharacterGenerator : MonoBehaviour
{
	private PlayerCharacter _toon;
	//Assignable Attribute Points
	public const int STARTING_POINTS = 495;
	//Base attribute points (lowest you can go)
	private const int BASE_ATTRIBUTE_POINTS = 10;
	private int pointsLeft;
	//Starting attribute points
	private const int STARTING_VALUE = 25;
	//The max points an attribute may have
	private const int MAX_ATTRIBUTE_POINTS = 100;
	
	//For the GUI
	private const int OFFSET = 5;
	private const int LINE_HEIGHT = 20;
	private const int STAT_LABEL_WIDTH = 100;
	private const int BASEVALUE_LABEL_WIDTH = 30;
	private const int BUTTON_WIDTH = 20;
	private const int BUTTON_HEIGHT = 20;
	private int statStartingPos = 40;
	//The total number of available attributes
	private int numberOfAttributes = 19;
	//GUI Skin
	public GUISkin Skin_1;

	// Use this for initialization
	void Start ()
	{
		_toon = new PlayerCharacter();
		_toon.Awake();
		pointsLeft = STARTING_POINTS;
		
		for(int cnt = 0; cnt < Enum.GetValues(typeof(AttributeName)).Length; cnt++)
		{
			_toon.GetPrimaryAttribute(cnt).BaseValue = STARTING_VALUE;
			pointsLeft -= (STARTING_VALUE - BASE_ATTRIBUTE_POINTS);
		}
		_toon.StatUpdate();
	}
	
	// Update is called once per frame
	void Update ()
	{

	}
	void OnGUI()
	{
		GUI.skin = Skin_1;
		DisplayName();
		DisplayPointsLeft();
		DisplayAttributes();
		DisplayVitals();
		DisplaySkills();
	}
	//GUI position for the name input area
	private void DisplayName()
	{
		GUI.Label(new Rect(	10,		//x
							10,		//y
							50,		//width
							25),	//height
							"Name:");
		_toon.Name = GUI.TextField(new Rect(65,		//x
											10,		//y
											100,	//width
											25),	//height
											_toon.Name);
	}
	//GUI position of Base Attributes
	private void DisplayAttributes()
	{
		for(int cnt = 0; cnt < Enum.GetValues(typeof(AttributeName)).Length; cnt++)
		{
			GUI.Label(new Rect(	OFFSET,									//x axis
								statStartingPos + (cnt * LINE_HEIGHT),	//y axis
								STAT_LABEL_WIDTH,						//width
								LINE_HEIGHT),							//height
								((AttributeName)cnt).ToString());
			
			GUI.Label(new Rect(	STAT_LABEL_WIDTH + OFFSET,				//x
								statStartingPos + (cnt * LINE_HEIGHT),	//y
								BASEVALUE_LABEL_WIDTH,					//width
								LINE_HEIGHT),							//height
								_toon.GetPrimaryAttribute(cnt).AdjustedBaseValue.ToString());
			
			//GUI button for removing attribute points
			if(GUI.Button(new Rect(	OFFSET + STAT_LABEL_WIDTH + BASEVALUE_LABEL_WIDTH,	//x
									statStartingPos + (cnt * BUTTON_HEIGHT),			//y
									BUTTON_WIDTH,										//width
									BUTTON_HEIGHT),										//height
									"-"))
				
			{
				if(_toon.GetPrimaryAttribute(cnt).BaseValue > BASE_ATTRIBUTE_POINTS)
				{
					_toon.GetPrimaryAttribute(cnt).BaseValue--;
					pointsLeft++;
				_toon.StatUpdate();
				}	
			}
			//GUI button for adding attribute points
			if(GUI.Button(new Rect(	OFFSET + STAT_LABEL_WIDTH + BASEVALUE_LABEL_WIDTH + BUTTON_WIDTH,	//x
									statStartingPos + (cnt * BUTTON_HEIGHT),							//y
									BUTTON_WIDTH,														//width
									BUTTON_HEIGHT),														//height
									"+"))
				
			{
				if(pointsLeft > 0)
				{
					_toon.GetPrimaryAttribute(cnt).BaseValue++;
					pointsLeft--;
				_toon.StatUpdate();
				}
				if(_toon.GetPrimaryAttribute(cnt).BaseValue == MAX_ATTRIBUTE_POINTS)
				{
					_toon.GetPrimaryAttribute(cnt).BaseValue==;
					pointsLeft==;
				_toon.StatUpdate();
				}
			}
		}
	}
	//GUI position of Vitals
	private void DisplayVitals()
	{
		for(int cnt = 0; cnt < Enum.GetValues(typeof(VitalName)).Length; cnt++)
		{
			GUI.Label(new Rect(	OFFSET,																//x
								statStartingPos + ((cnt + numberOfAttributes)* LINE_HEIGHT),		//y
								STAT_LABEL_WIDTH,													//width
								LINE_HEIGHT),														//height
								((VitalName)cnt).ToString());
			
			GUI.Label(new Rect(	OFFSET + STAT_LABEL_WIDTH,											//x
								statStartingPos + ((cnt + numberOfAttributes)* LINE_HEIGHT),		//y
								BASEVALUE_LABEL_WIDTH,												//width
								LINE_HEIGHT),														//height
								_toon.GetVital(cnt).AdjustedBaseValue.ToString());
			
		}
	}
	//GUI position of Skills
	private void DisplaySkills()
	{
		for(int cnt = 0; cnt < Enum.GetValues(typeof(SkillName)).Length; cnt++)
		{
			GUI.Label(new Rect(	OFFSET + STAT_LABEL_WIDTH + BASEVALUE_LABEL_WIDTH + BUTTON_WIDTH * 2 + OFFSET * 2,		//x
								statStartingPos + (cnt * LINE_HEIGHT),													//y
								STAT_LABEL_WIDTH,																		//width
								LINE_HEIGHT),																			//height
								((SkillName)cnt).ToString());
			
			GUI.Label(new Rect(	OFFSET + STAT_LABEL_WIDTH + BASEVALUE_LABEL_WIDTH + BUTTON_WIDTH * 2 + OFFSET * 2 + STAT_LABEL_WIDTH,		//x
								statStartingPos + (cnt * LINE_HEIGHT),																		//y
								BASEVALUE_LABEL_WIDTH,																						//width
								LINE_HEIGHT),																								//height
								_toon.GetSkill(cnt).AdjustedBaseValue.ToString());
			
		}
	}
	//GUI position of Attribute Points Left
	private void DisplayPointsLeft()
	{
		GUI.Label(new Rect(	250,		//x
							10,			//y
							100,		//width
							25),		//height
							"Points Left: " + pointsLeft.ToString());
	}
}


//Might be important: http://www.youtube.com/watch?v=yQiEov5E2K0

//Left off @ 2:30: http://www.youtube.com/watch?v=kK1eIk4inAU

On a quick look, I think you want to remove the code you wrote and then change line 114 to:

if(pointsLeft > 0 && _toon.GetPrimaryAttribute(cnt).BaseValue < MAX_ATTRIBUTE_POINTS)

Note there is no unary ‘==’ operator. I think you are looking for the ‘++’ and ‘–’ operators which add one and subtract one from a variable. Your code might work like this:

if(_toon.GetPrimaryAttribute(cnt).BaseValue > MAX_ATTRIBUTE_POINTS)
{
     _toon.GetPrimaryAttribute(cnt).BaseValue--;
     pointsLeft++;
     _toon.StatUpdate();
}