Advertisement
kasru

CharacterSelect

Jun 16th, 2015
1,847
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.13 KB | None | 0 0
  1. //****** Donations are greatly appreciated.  ******
  2. //****** You can donate directly to Jesse through paypal at  https://www.paypal.me/JEtzler   ******
  3.  
  4. using UnityEngine;
  5. using System.Collections;
  6.  
  7. public class CharacterSelect : MonoBehaviour {
  8.  
  9.     public BasicStats[] AllClassStats;
  10.     public bool ClassSelectWindow;
  11.     public GameObject User;
  12.  
  13.     // Use this for initialization
  14.     void Start () {
  15.  
  16.     }
  17.  
  18.     void OnGUI () {
  19.  
  20.         if(ClassSelectWindow) {
  21.  
  22.             if (GUI.Button(new Rect(Screen.width/2 - 100, Screen.height/2 - 150, 200, 40), "CLASS 1")) {
  23.  
  24.                 AssignBaseStats(0);
  25.                 ClassSelectWindow = false;
  26.             }
  27.             if (GUI.Button(new Rect(Screen.width/2 - 100, Screen.height/2 - 100, 200, 40), "CLASS 2")) {
  28.  
  29.                 AssignBaseStats(1);
  30.                 ClassSelectWindow = false;
  31.             }
  32.         }
  33.     }
  34.    
  35.     // Update is called once per frame
  36.     void Update () {
  37.        
  38.     }
  39.  
  40.     void AssignBaseStats (int classChosen) {
  41.  
  42.         var Comp = User.GetComponent<UserStats>();
  43.  
  44.         Comp.UserClass = AllClassStats[classChosen].UserClass;
  45.         Comp.baseAttackPower = AllClassStats[classChosen].baseAttackPower;
  46.         Comp.baseAttackSpeed = AllClassStats[classChosen].baseAttackSpeed;
  47.     }
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement