Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- using UnityEngine.SceneManagement;
- using UnityEditor;
- public class CreateNewCharacter : MonoBehaviour {
- private BasePlayer newPlayer;
- private bool isMageClass = false;
- private bool isWarriorClass = false;
- private bool isRogueClass = false;
- private bool isArcherClass = false;
- private bool isWarlockClass = false;
- private bool isPaladinClass = false;
- private string playerName = "Wprowadź imię";
- void Start () {
- newPlayer = new BasePlayer();
- }
- void Update () {
- }
- void OnGUI(){
- playerName = GUILayout.TextArea (playerName,15);
- isMageClass = EditorGUILayout.Toggle ("Mag", isMageClass);
- isWarriorClass = EditorGUILayout.Toggle ("Wojownik", isWarriorClass);
- isRogueClass = EditorGUILayout.Toggle ( "Łotrzyk", isRogueClass);
- isArcherClass = EditorGUILayout.Toggle ( "Łucznik", isArcherClass);
- isWarlockClass = EditorGUILayout.Toggle ( "Czarodziej", isWarlockClass);
- isPaladinClass = EditorGUILayout.Toggle ( "Paladyn", isPaladinClass);
- if (GUILayout.Button ("Stwórz")) {
- if (isMageClass) {
- newPlayer.PlayerClass = new BaseMageClass ();
- } else if (isWarriorClass) {
- newPlayer.PlayerClass = new BaseWarriorClass ();
- } else if (isRogueClass) {
- newPlayer.PlayerClass = new BaseRogueClass ();
- } else if (isArcherClass) {
- newPlayer.PlayerClass = new BaseArcherClass ();
- } else if (isWarlockClass) {
- newPlayer.PlayerClass = new BaseWarlockClass ();
- } else if (isPaladinClass) {
- newPlayer.PlayerClass = new BasePaladinClass ();
- }
- CreateNewPlayer ();
- StoreNewPlayerInfo ();
- SaveInformation.SaveAllInformation ();
- }
- if (GUILayout.Button ("Load")) {
- SceneManager.LoadScene ("tset");
- }
- }
- private void StoreNewPlayerInfo(){
- GameInformation.PlayerName = newPlayer.PlayerName;
- GameInformation.PlayerLevel = newPlayer.PlayerLevel;
- GameInformation.Stamina = newPlayer.Stamina;
- GameInformation.Endurance = newPlayer.Endurance;
- GameInformation.Intellect = newPlayer.Intellect;
- GameInformation.Strength = newPlayer.Strength;
- GameInformation.Agility = newPlayer.Agility;
- GameInformation.Resistance = newPlayer.Resistance;
- GameInformation.Gold = newPlayer.Gold;
- }
- private void CreateNewPlayer(){
- newPlayer.PlayerLevel = 1;
- newPlayer.Stamina = newPlayer.PlayerClass.Stamina;
- newPlayer.Endurance = newPlayer.PlayerClass.Endurance;
- newPlayer.Intellect = newPlayer.PlayerClass.Intellect;
- newPlayer.Strength = newPlayer.PlayerClass.Strength;
- newPlayer.Agility = newPlayer.PlayerClass.Agility;
- newPlayer.Resistance = newPlayer.PlayerClass.Resistance;
- newPlayer.Gold = 10;
- newPlayer.PlayerName = playerName;
- Debug.Log("Imię postaci: " + newPlayer.PlayerName);
- Debug.Log("Klasa postaci: " + newPlayer.PlayerClass.CharacterClassName);
- Debug.Log("Poziom postaci: " + newPlayer.PlayerLevel);
- Debug.Log("Poziom staminy: " + newPlayer.Stamina);
- Debug.Log("Poziom wytrzymałości: " + newPlayer.Endurance);
- Debug.Log("Poziom intelektu: " + newPlayer.Intellect);
- Debug.Log("Poziom siły: " + newPlayer.Strength);
- Debug.Log("Poziom zwinności: " + newPlayer.Agility);
- Debug.Log("Poziom odporności: " + newPlayer.Resistance);
- Debug.Log("Ilość złota: " + newPlayer.Gold);
- }
- }
Add Comment
Please, Sign In to add comment