Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- public class CharacterBaseStats : MonoBehaviour {
- public int endurance = 0;
- public int intelligence = 0;
- public int agility = 0;
- public int perception = 0;
- public int courage = 0;
- public int carriable_weight = 20;
- public int health = 50;
- public bool medic = false;
- public bool hacker = false;
- public bool soldier = false;
- public bool psychic = false;
- public bool trapper = false;
- public CharacterBaseStats(int endurance, int intelligence, int agility, int perception, int courage, int carriable_weight, int health)
- {
- this.health = health;
- this.endurance = endurance;
- this.intelligence = intelligence;
- this.perception = perception;
- this.courage = courage;
- this.carriable_weight = carriable_weight;
- }
- private int getEndurance()
- {
- return endurance;
- }
- private void increaseEndurance()
- {
- endurance = endurance + 1;
- }
- private int getIntelligence()
- {
- return intelligence;
- }
- private void increaseIntelligence()
- {
- intelligence = intelligence +1;
- }
- private int getAgility()
- {
- return agility;
- }
- private void increaseagility()
- {
- agility = agility +1;
- }
- private int getPerception()
- {
- return perception;
- }
- private void increasePerception()
- {
- perception = perception +1;
- }
- private int getCarriableWeight()
- {
- return carriable_weight;
- }
- private void setCarriableWeight()
- {
- carriable_weight = endurance * 2;
- }
- public void generateCharacter()
- {
- int points_at_start = 20;
- int Char_class = Random.Range(1, 6);
- switch(Char_class)
- {
- case 1:
- {
- medic = true;
- break;
- }
- case 2:
- {
- hacker = true;
- break;
- }
- case 3:
- {
- soldier = true;
- break;
- }
- case 4:
- {
- psychic = true;
- break;
- }
- case 5:
- {
- trapper = true;
- break;
- }
- }
- do{
- int stat = Random.Range(1, 5);
- switch(stat)
- {
- case 1:
- {
- endurance = Random.Range(0, points_at_start);
- points_at_start -= endurance;
- if(medic == true)
- {
- endurance += 5;
- }else if(hacker == true)
- {
- endurance += 0;
- }else if(trapper == true)
- {
- endurance += 2;
- }else if(psychic == true)
- {
- endurance += 10;
- }
- else //soldier
- {
- endurance += 15;
- }
- break;
- }
- case 2:
- {
- intelligence = Random.Range(0, points_at_start);
- points_at_start -= agility;
- if(medic == true)
- {
- intelligence += 15;
- }else if(hacker == true)
- {
- intelligence += 20;
- }else if(trapper == true)
- {
- intelligence += 10;
- }else if(psychic == true)
- {
- intelligence += 15;
- }
- else //soldier
- {
- intelligence += 0;
- }
- break;
- }
- case 3:
- {
- agility = Random.Range(0, points_at_start);
- points_at_start -= agility;
- if(medic == true)
- {
- agility += 5;
- }else if(hacker == true)
- {
- agility += 5;
- }else if(trapper == true)
- {
- agility += 10;
- }else if(psychic == true)
- {
- agility += 0;
- }
- else //soldier
- {
- agility += 10;
- }
- break;
- }
- case 4:
- {
- courage = Random.Range(0, points_at_start);
- points_at_start -= courage;
- if(medic == true)
- {
- courage += 0;
- }else if(hacker == true)
- {
- courage += 0;
- }else if(trapper == true)
- {
- courage += 5;
- }else if(psychic == true)
- {
- courage += 5;
- }
- else //soldier
- {
- courage += 10;
- }
- break;
- }
- case 5:
- {
- perception = Random.Range(0, points_at_start);
- points_at_start -= courage;
- if(medic == true)
- {
- perception += 5;
- }else if(hacker == true)
- {
- perception += 5;
- }else if(trapper == true)
- {
- perception += 10;
- }else if(psychic == true)
- {
- perception += 20;
- }
- else //soldier
- {
- perception += 0;
- }
- break;
- }
- }
- }while(points_at_start != 0);
- }
- public string toStringChar()
- {
- return "Endurance:" + getEndurance() + ", Intelligence:" + getIntelligence() + ", Agility:" + getAgility() + ", Perception:" + getPerception() + ", Carriable Weight:" + getCarriableWeight();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement