Example #1
0
    public void UpdateBackground(BasicGameInfo info)
    {
        GetComponent<Button>().onClick.RemoveAllListeners();

        Transform gameData = transform.GetChild(0);
        Transform noData = transform.GetChild(1);
        Transform fileData = gameData.GetChild(3);
        if(info != null)
        {
            if(Controller.GetComponent<GameSelectController>().Load)
            {

                GetComponent<Button>().onClick.AddListener(delegate
                {
                    Background.SetActive(false);
                    GameMaster.GM.LoadGame(SlotNumber);
                });
            }
            else
            {

                GetComponent<Button>().onClick.AddListener(delegate
                {
                    Background.SetActive(false);
                    MessageBox.SetActive(true);
                    MessageBoxYes.GetComponent<Button>().onClick.RemoveAllListeners();
                    MessageBoxYes.GetComponent<Button>().onClick.AddListener(delegate
                    {
                        MessageBox.SetActive(false);
                        GameMaster.GM.StartNewGame(SlotNumber);
                    });

                });
            }
            gameData.gameObject.SetActive(true);
            noData.gameObject.SetActive(false);
            gameData.GetChild(0).GetComponent<Text>().text = "[ File: " + SlotNumber + " ]"; //sets the slot number
            gameData.GetChild(1).GetComponent<Text>().text = info.Name; //set character name
            gameData.GetChild(2).GetComponent<Text>().text = info.CharClass; //set character class
            Transform basicStats = fileData.GetChild(0);
            basicStats.GetChild(0).GetComponent<Text>().text = "Loc:\t" + info.Location; //sets the location
            basicStats.GetChild(1).GetComponent<Text>().text = "GP:\t\t" + info.Gold; //sets the gold value
            basicStats.GetChild(2).GetComponent<Text>().text = "LvL:\t" + info.Level; //sets the gold value
        }
        else
        {
            gameData.gameObject.SetActive(false);
            noData.gameObject.SetActive(true);
            if(!Controller.GetComponent<GameSelectController>().Load)
            {
                GetComponent<Button>().onClick.AddListener(delegate
                {
                    Background.SetActive(false);
                    GameMaster.GM.StartNewGame(SlotNumber);
                });
            }
        }
    }
 void Awake()
 {
     if (instance)
     {
         Destroy(gameObject);
     }
     else
     {
         instance = this;
         gameMode = 0;
         isMute   = false;
         DontDestroyOnLoad(gameObject);
     }
 }
Example #3
0
    //newGame
    public GameData(string name, string charClass, string gender)
    {
        _basic = new BasicGameInfo(name, charClass, "NewGame", 0, 1);
        _gender = gender;

        //if character class do things... also roll motherfucka
        /*
                    Fighter: Str, Con, Dex
                    Ranger: Dex, Str, Wis
                    Rogue: Dex, Cha, Int
                    Wizard: Wis, Cha, Str
                    =========> Paladin: Con Str, Wis <========= Excluding due to forced alignment (Lawful Good. eww...)
                    Sorcerer: Cha, Int, Con
                    Cleric: Wis, Str, Con

                    I would like to thank the entire Silverfist clan for this info
        */

        int highBegin = 12;
        int highEnd = 17;
        int lowBegin = 9;
        int lowEnd = 13;
        if(charClass.ToLower() == "Fighter".ToLower())
        {
            //Fighter: Str, Con, Dex

            int HighRoll = Random.Range(highBegin, highEnd);
            _str = HighRoll + modRoll();
            HighRoll = Random.Range(highBegin, highEnd);
            _dex = HighRoll;
            HighRoll = Random.Range(highBegin, highEnd);
            _con = HighRoll;

            int LowRoll = Random.Range(lowBegin, lowEnd);
            _int = LowRoll - modRoll();
            LowRoll = Random.Range(lowBegin, lowEnd);
            _wis = LowRoll - modRoll();
            LowRoll = Random.Range(lowBegin, lowEnd);
            _cha = LowRoll - modRoll();

        }
        else if(charClass.ToLower() == "Ranger".ToLower())
        {
            //Ranger: Dex, Str, Wis
            int HighRoll = Random.Range(highBegin, highEnd);
            _dex = HighRoll + modRoll();
            HighRoll = Random.Range(highBegin, highEnd);
            _str = HighRoll;
            HighRoll = Random.Range(highBegin, highEnd);
            _wis = HighRoll;

            int LowRoll = Random.Range(lowBegin, lowEnd);
            _con = LowRoll - modRoll();
            LowRoll = Random.Range(lowBegin, lowEnd);
            _int = LowRoll - modRoll();
            LowRoll = Random.Range(lowBegin, lowEnd);
            _cha = LowRoll - modRoll();
        }
        else if(charClass.ToLower() == "Rogue".ToLower())
        {
            // Rogue: Dex, Cha, Int
            int HighRoll = Random.Range(highBegin, highEnd);
            _dex = HighRoll + modRoll();
            HighRoll = Random.Range(highBegin, highEnd);
            _int = HighRoll;
            HighRoll = Random.Range(highBegin, highEnd);
            _cha = HighRoll;

            int LowRoll = Random.Range(lowBegin, lowEnd);
            _str = LowRoll - modRoll();
            LowRoll = Random.Range(lowBegin, lowEnd);
            _con = LowRoll - modRoll();
            LowRoll = Random.Range(lowBegin, lowEnd);
            _wis = LowRoll - modRoll();

        }
        else if(charClass.ToLower() == "Wizard".ToLower())
        {
            //Wizard: Wis, Cha, Str
            int HighRoll = Random.Range(highBegin, highEnd);
            _wis = HighRoll + modRoll();
            HighRoll = Random.Range(highBegin, highEnd);
            _str = HighRoll;
            HighRoll = Random.Range(highBegin, highEnd);
            _cha = HighRoll;

            int LowRoll = Random.Range(lowBegin, lowEnd);
            _dex = LowRoll - modRoll();
            LowRoll = Random.Range(lowBegin, lowEnd);
            _con = LowRoll - modRoll();
            LowRoll = Random.Range(lowBegin, lowEnd);
            _int = LowRoll - modRoll();

        }
        else if(charClass.ToLower() == "Sorcerer".ToLower())
        {
            //Sorcerer: Cha, Int, Con
            int HighRoll = Random.Range(highBegin, highEnd);
            _cha = HighRoll + modRoll();
            HighRoll = Random.Range(highBegin, highEnd);
            _con = HighRoll;
            HighRoll = Random.Range(highBegin, highEnd);
            _int = HighRoll;

            int LowRoll = Random.Range(lowBegin, lowEnd);
            _str = LowRoll - modRoll();
            LowRoll = Random.Range(lowBegin, lowEnd);
            _dex = LowRoll - modRoll();
            LowRoll = Random.Range(lowBegin, lowEnd);
            _wis = LowRoll - modRoll();

        }
        else if(charClass.ToLower() == "Cleric".ToLower())
        {
            //Cleric: Wis, Str, Con

            int HighRoll = Random.Range(highBegin, highEnd);
            _wis = HighRoll + modRoll();
            HighRoll = Random.Range(highBegin, highEnd);
            _str = HighRoll;
            HighRoll = Random.Range(highBegin, highEnd);
            _con = HighRoll;

            int LowRoll = Random.Range(lowBegin, lowEnd);
            _dex = LowRoll - modRoll();
            LowRoll = Random.Range(lowBegin, lowEnd);
            _int = LowRoll - modRoll();
            LowRoll = Random.Range(lowBegin, lowEnd);
            _cha = LowRoll - modRoll();
        }
        else
        {
            int HighRoll = Random.Range(highBegin, highEnd);
            _str = HighRoll + modRoll();
            HighRoll = Random.Range(highBegin, highEnd);
            _dex = HighRoll;
            HighRoll = Random.Range(highBegin, highEnd);
            _con = HighRoll;

            int LowRoll = Random.Range(lowBegin, lowEnd);
            _int = LowRoll;
            LowRoll = Random.Range(lowBegin, lowEnd);
            _wis = LowRoll - modRoll();
            LowRoll = Random.Range(lowBegin, lowEnd);
            _cha = LowRoll - modRoll();
        }

        _xp = 0;
        _nodeNo = 0;
        _maxHp = (_str + _dex/2 + _con);
        _maxMp = (_wis + _int/2 + _con/2);
        _hp = _maxHp;
        _mp = _maxMp;
    }