Exemple #1
0
 protected override void Init()
 {
     EnumeratorManager.Init();
     DownloadManager.Init();
     UIManager.Init();
     InputManager.Init();
     TouchManager.Init();
     AppTime.Init();
 }
    private void Awake()
    {
        #region GameManager_Singleton.
        // Here is a singleton for the GameManager.
        if (Instance == null)
        {
            Instance = this;
        }

        else if (Instance != this)
        {
            Debug.LogWarning("WARNING!! More than one instance of GameManager!! Keeping old instance and destroying newer one...");
            Destroy(gameObject);
        }

        #endregion

        #region Enumerators_Inicialization

        Enumerator_manager = GetComponent <EnumeratorManager>();

        #endregion

        #region Player_Data_Inicialization
        // Here it checks if the player data exist already, if not then instatiate one.

        if (Player_data == null)
        {
            Player_data = new PlayerData();
        }

        else if (Player_data != Get_PlayerData())
        {
            Debug.LogWarning("WARNING!! More than one instance of PlayerData!!");
        }

        #endregion

        #region Global_Items_Inicialization

        Global_items_reference = GetComponent <ItemsReference>();

        #endregion

        #region Inventory_Inicialization
        /// Here it will instantiate the inventory data.
        // And take the tooltip reference to show the Data of an item.

        Inventory_data        = new Inventory();
        Item_holder           = GetComponent <ItemHolder> ();
        Tooltip_reference     = GetComponent <Tooltip> ();
        InventoryUI_reference = GetComponent <InventoryUI> ();

        #endregion

        #region Equipment_Inicialization

        Equipment_manager = new EquipmentManager();

        #endregion

        #region Enemy_Data_Inicialization
        // Here it initiates the enemy list and as example it adds two enemys to the list for testing.

        Enemys_data = new List <EnemyData> ();

        CreateEnemyData(new BanditData(0, "Bandit", 100, 10, "neutral"));
        CreateEnemyData(new PirateData(1, "Pirate", 200, 20, 30, "neutral"));

        #endregion
    }