Ejemplo n.º 1
0
 // Use this for initialization
 void Start()
 {
     GamData    = FindObjectOfType <GameDataHolder>();
     Controller = FindObjectOfType <PlayerController>();
     inventory  = FindObjectOfType <Inventory>();
     playerData = FindObjectOfType <Player>();
 }
Ejemplo n.º 2
0
    void InitGame()
    {
        gameModes = gameData.GetModes();
        Resources.UnloadAsset(gameData);
        gameData = null;

        if (PlayerPrefs.HasKey("uniqueID"))
        {
            UserID = PlayerPrefs.GetString("uniqueID");
        }
        else
        {
            System.Guid myGUID = System.Guid.NewGuid();
            PlayerPrefs.SetString("uniqueID", myGUID.ToString());
            UserID = PlayerPrefs.GetString("uniqueID");
        }


        if (PlayerPrefs.HasKey("Name"))
        {
            UserName = PlayerPrefs.GetString("Name");
        }
        else
        {
            UserName = "******" + UserID.Substring(0, 5);
            PlayerPrefs.SetString("Name", UserName);
        }

        SetMode("MainMenu");
    }
Ejemplo n.º 3
0
 private void OnEnable()
 {
     if (instance == null)
     {
         instance = this;
     }
 }
Ejemplo n.º 4
0
    // Use this for initialization
    void Start()
    {
        Gamedata    = FindObjectOfType <GameDataHolder>();
        battleEvent = FindObjectOfType <BattleEventHandler>();

        area = AreaType.area1;
    }
Ejemplo n.º 5
0
Archivo: GameUI.cs Proyecto: pitfon/1
    public void Init(GameDataHolder gameData, PlayerReferences player1, PlayerReferences player2)
    {
        _player1GameView.Init(player1);
        _player2GameView.Init(player2);

        _levelText.text = $"Level: {gameData.GameData.Level}";

        GameController.Instance.MobSpawner.OnMobDeath += UpdateMobsLeftText;
        UpdateMobsLeftText();
    }
Ejemplo n.º 6
0
 // Use this for initialization
 void Start()
 {
     InventoryPannel.gameObject.SetActive(false);
     playerControlls          = FindObjectOfType <PlayerController>();
     Gamedata                 = FindObjectOfType <GameDataHolder>();
     player                   = FindObjectOfType <Player>();
     cam                      = FindObjectOfType <ThirdPersonCam>();
     SelectedItem             = 0;
     MaxItemsInInventoryCount = Slots.Count;
     ConstructInventory();
     addItem(1);
     addItem(1);
     addItem(1);
     addItem(2);
     addItem(3);
 }
Ejemplo n.º 7
0
    public void Load()
    {
        Debug.Log("Load save file: " + mSaveFilePath);
        if (File.Exists(mSaveFilePath))
        {
            BinaryFormatter binFor  = new BinaryFormatter();
            FileStream      fileStr = File.Open(mSaveFilePath, FileMode.Open);

            mLocalData = binFor.Deserialize(fileStr) as GameDataHolder;
            fileStr.Close();
        }
        else
        {
            mLocalData = new GameDataHolder();
            Save();
        }
    }
Ejemplo n.º 8
0
    public void Init(GameDataHolder gameData)
    {
        _gameData      = gameData;
        _minPosition   = new Vector3(2, 2, 2);
        _maxPosisition = new Vector3(GameController.Instance.MapGenerator.Width - 2, 0, GameController.Instance.MapGenerator.Height - 2);

        if (_gameData.GameData.Level <= _mobPrefabs.Count)
        {
            for (int i = 0; i < 5; i++)
            {
                _mobsToSpawn.Add(_mobPrefabs[_gameData.GameData.Level - 1]);
            }

            _spawnLimit = 1;
        }
        else
        {
            _mobsToSpawn = new List <GameObject>(_mobPrefabs.Random(_gameData.GameData.Level * 2));

            _spawnLimit = Mathf.FloorToInt(_gameData.GameData.Level / 3);
        }

        SpawnMobs();
    }
Ejemplo n.º 9
0
 // Use this for initialization
 void Start()
 {
     Gamedata = FindObjectOfType <GameDataHolder>();
     StartNewPlayer();
 }