// Use this for initialization
    void Start()
    {
        _screenHSize = Screen.height;
        _screenWsize = Screen.width;
        GUITexture GameSetting = FindObjectOfType(typeof(GUITexture)) as GUITexture;

        if (GameSetting.name == "Main Camera")
        {
            GameSetting.transform.position   = Vector3.zero;
            GameSetting.transform.localScale = Vector3.zero;
            GameSetting.pixelInset           = new Rect(0, 0, _screenWsize, _screenHSize);
        }

        GameObject player = Instantiate(playerPrefab, Vector3.zero, Quaternion.identity) as GameObject;

        player.name = "player";

        _playerInformation = new PlayerInformation();
        _playerInformation.Awake();

        for (int i = 0; i < Enum.GetValues(typeof(AttributeName)).Length; i++)
        {
            _playerInformation.GetPrimaryAttribute(i).BaseValue = STARTING_VALUE;
        }

        _playerInformation.StatUpdate();
    }
    private void DisplayAttributes()
    {
        for (int i = 0; i < Enum.GetValues(typeof(AttributeName)).Length; i++)
        {
            GUI.Label(new Rect(OFFSET,
                               statStartingPos + (i * LINE_HEIGHT),
                               STAT_LABEL_WIDTH,
                               LINE_HEIGHT),
                      ((AttributeName)i).ToString(), fontCharGenStyling);

            GUI.Label(new Rect(STAT_LABEL_WIDTH + OFFSET,
                               statStartingPos + (i * LINE_HEIGHT),
                               BASEVALUE_LABEL_WIDTH,
                               LINE_HEIGHT),
                      _playerInformation.GetPrimaryAttribute(i).AdjustedBaseValue.ToString(), fontCharGenStyling);
        }
    }
Example #3
0
    // Use this for initialization
    public void Start()
    {
        info = new PlayerInformation();
        info.Awake();
        chars           = new CharacterGen();
        enemyTypeNumber = 0;
        playerNumber    = 1;
        for (int i = 0; i < Enum.GetValues(typeof(AttributeName)).Length; i++)
        {
            info.GetPrimaryAttribute(i).BaseValue = chars.STARTING_VALUE;
        }
        characterName           = String.Empty;
        itemAmount              = 0;
        _primaryAttribute       = new string[info._primaryAttribute.Length];
        _primaryAttributeValues = new int[info._primaryAttribute.Length];
        _vital            = new string[info._vital.Length];
        _vitalValue       = new int[info._vital.Length];
        _mana             = new string[info._mana.Length];
        _manaValue        = new int[info._mana.Length];
        _attack           = new string[info._attack.Length];
        _attackValue      = new int[info._attack.Length];
        _defence          = new string[info._defence.Length];
        _defenceValue     = new int[info._defence.Length];
        moneyTotal        = 0;
        money             = new MoneySystem();
        itemsNameArray    = new ArrayList();
        itemsContentArray = new ArrayList();
        experience        = 100;

        nextLevelvalue = experience * 1.2f;
        nextLevel      = (int)(experience * 1.2f);
        level          = 1;
        initiliseConstantVariables();

        playerPos = GameObject.FindGameObjectWithTag("Player");
        if (playerPos != null)
        {
            positionOnScreen = playerPos.transform.position;
        }


        if (PlayerPrefs.GetString("Player Name") != "")
        {
            LoadData();
        }
    }
    // Use this for initialization
    public void Start()
    {
        info = new PlayerInformation();
        info.Awake();
        chars = new CharacterGen();
        enemyTypeNumber =0;
        playerNumber =1;
        for (int i = 0; i < Enum.GetValues(typeof(AttributeName)).Length; i++) {
            info.GetPrimaryAttribute (i).BaseValue = chars.STARTING_VALUE;
        }
        characterName = String.Empty;
        itemAmount = 0;
        _primaryAttribute = new string[info._primaryAttribute.Length];
        _primaryAttributeValues=new int[info._primaryAttribute.Length];
        _vital = new string[info._vital.Length];
        _vitalValue=new int[info._vital.Length];
        _mana = new string[info._mana.Length];
        _manaValue=new int[info._mana.Length];
        _attack = new string[info._attack.Length];
        _attackValue = new int[info._attack.Length];
        _defence = new string[info._defence.Length];
        _defenceValue = new int[info._defence.Length];
        moneyTotal=0;
        money = new MoneySystem();
        itemsNameArray = new ArrayList();
        itemsContentArray = new ArrayList();
        experience =100;

        nextLevelvalue = experience*1.2f;
        nextLevel = (int)(experience*1.2f);
        level =1;
        initiliseConstantVariables();

        playerPos = GameObject.FindGameObjectWithTag("Player");
        if(playerPos!=null)
            positionOnScreen= playerPos.transform.position;

        if(PlayerPrefs.GetString ("Player Name")!= ""){
            LoadData();
        }
    }
    // Use this for initialization
    void Start()
    {
        _screenHSize = Screen.height;
        _screenWsize = Screen.width;
        GUITexture GameSetting = FindObjectOfType (typeof(GUITexture)) as GUITexture;
        if (GameSetting.name == "Main Camera") {
            GameSetting.transform.position = Vector3.zero;
            GameSetting.transform.localScale = Vector3.zero;
            GameSetting.pixelInset = new Rect (0,0, _screenWsize,_screenHSize);
        }

        GameObject player = Instantiate(playerPrefab,Vector3.zero, Quaternion.identity) as GameObject;

        player.name = "player";

        _playerInformation = new PlayerInformation();
        _playerInformation.Awake();

        for (int i = 0; i < Enum.GetValues(typeof(AttributeName)).Length; i++) {
            _playerInformation.GetPrimaryAttribute (i).BaseValue = STARTING_VALUE;
        }

        _playerInformation.StatUpdate();
    }
Example #6
0
    /// <summary>
    /// Initilises the variables.
    /// </summary>
    public void initiliseConstantVariables()
    {
        for (int cnt = 0; cnt < Enum.GetValues(typeof(AttributeName)).Length; cnt++)
        {
            _primaryAttribute [cnt]      = ((AttributeName)cnt).ToString();
            _primaryAttributeValues[cnt] = info.GetPrimaryAttribute(cnt).AdjustedBaseValue;
        }

        for (int i = 0; i < Enum.GetValues(typeof(VitalName)).Length; i++)
        {
            _vital[i]      = ((VitalName)i).ToString();
            _vitalValue[i] = info.GetVitals(i).AdjustedBaseValue;
        }

        for (int i = 0; i < Enum.GetValues(typeof(ManaName)).Length; i++)
        {
            _mana[i]      = ((ManaName)i).ToString();
            _manaValue[i] = info.GetMana(i).AdjustedBaseValue;
        }

        for (int i = 0; i < Enum.GetValues(typeof(AttackName)).Length; i++)
        {
            _attack[i]      = ((AttackName)i).ToString();
            _attackValue[i] = info.GetAttack(i).AdjustedBaseValue;
        }

        for (int i = 0; i < Enum.GetValues(typeof(DefenceName)).Length; i++)
        {
            _defence[i]      = ((DefenceName)i).ToString();
            _defenceValue[i] = info.GetDefence(i).AdjustedBaseValue;
        }
        positionOnScreen.x = PlayerPrefs.GetFloat("Position - x");
        positionOnScreen.y = PlayerPrefs.GetFloat("Position - y");
        positionOnScreen.z = PlayerPrefs.GetFloat("Position - z");

        GameObject        objGame  = GameObject.FindGameObjectWithTag("Constant");
        StoredInformation storedIN = objGame.GetComponent <StoredInformation>();

        moneyTotal = 0;
        money      = new MoneySystem();

        if (Application.loadedLevelName == "NewGame")
        {
            level               = 1;
            experience          = 100;
            storedIN.level      = 1;
            storedIN.experience = 100;

            storedIN.nextLevelvalue = experience * 1.2f;
            storedIN.nextLevel      = (int)(experience * 1.2f);
            nextLevelvalue          = experience * 1.2f;
            nextLevel = (int)(experience * 1.2f);

            moneyTotal          = money.StarterMoney();
            storedIN.moneyTotal = moneyTotal;
        }
        else if ((PlayerPrefs.GetInt("Money") != null) || (PlayerPrefs.GetInt("Money") != 0))
        {
            moneyTotal          = PlayerPrefs.GetInt("Money");
            storedIN.moneyTotal = moneyTotal;
            level               = PlayerPrefs.GetInt("Level");
            experience          = PlayerPrefs.GetInt("Experience");
            storedIN.experience = experience;

            storedIN.level = level;
            if (level == 0)
            {
                level               = 1;
                storedIN.level      = 1;
                storedIN.experience = 100;
                experience          = 100;
            }
        }
        else if (moneyTotal == 0)
        {
            moneyTotal          = money.StarterMoney();
            storedIN.moneyTotal = moneyTotal;
        }
        else
        {
            moneyTotal          = PlayerPrefs.GetInt("Money");
            storedIN.moneyTotal = moneyTotal;
        }

        info.StatUpdate();
        _vitalValue   = info.VitalUpdate();
        _attackValue  = info.AttackUpdate();
        _defenceValue = info.DefenceUpdate();
        _manaValue    = info.ManaUpdate();

        if (characterName == String.Empty)
        {
            characterName          = PlayerPrefs.GetString("Player Name");
            storedIN.characterName = PlayerPrefs.GetString("Player Name");
        }

        itemsNameArray    = new ArrayList();
        itemsContentArray = new ArrayList();
    }