예제 #1
0
 /// <summary>
 /// Updates the game variables and managers.
 /// </summary>
 /// <param name="gameTime"></param>
 protected override void Update(GameTime gameTime)
 {
     M_InputManager.Update();
     M_MapManager.Update();
     M_PartyManager.Update();
     M_MenuManager.Update();
     M_MapManager.Update();
     base.Update(gameTime);
 }
예제 #2
0
 /// <summary>
 /// Initalizes the objects and managers in the game.
 /// </summary>
 protected override void Initialize()
 {
     base.Initialize();
     M_ContentManager.Init(Content);
     M_GlobalManager.Init();
     M_TextManager.Init();
     M_InputManager.Init();
     M_PartyManager.Init();
     M_MenuManager.Init();
     I_Inventory.Init();
     M_MapManager.Init();
 }
예제 #3
0
 /// <summary>
 /// Puts itself into the player's inventory
 /// </summary>
 public void CheckPickup()
 {
     if (M_GlobalManager.CanMove())
     {
         if (M_InputManager.KeyPressed(M_InputManager.GameKeys.Accept))
         {
             if (Vector2.Distance(this.world_position, M_PartyManager.Members[0].GetCenterpoint()) < this.pickup_dist)
             {
                 if (!I_Inventory.Add(this))
                 {
                     //Pull up a textbox saying "Inventory full!" or something
                 }
             }
         }
     }
 }
예제 #4
0
 public void OnPointerExit(PointerEventData eventData)
 {
     M_InputManager.SSetProcessingEvents(true);
 }
예제 #5
0
 public void OnPointerEnter(PointerEventData eventData)
 {
     M_InputManager.SSetProcessingEvents(false);
 }
예제 #6
0
 private void OnDisable()
 {
     M_InputManager.SSetProcessingEvents(true);
 }
예제 #7
0
    void Start()
    {
        Debug.Log("GameHelper -> Start()");
        s_instance = this;

        m_camController = Camera.main.GetComponent <CameraController>();
        if (m_camController == null)
        {
            Debug.LogWarning("Couldn't get CameraController from Camera.main!");
        }

        if (dayText == null || foodText == null || researchText == null)
        {
            Debug.LogWarning("One of the TMP_Text objects is not initialized.");
        }
        else
        {
            m_resourcesManager = M_InGameResourcesManager.GetInstance(foodText, dayText, researchText);
        }

        m_buildingManager = M_BuildingManager.Instance;
        m_mapManager      = M_MapManager.Instance;
        m_settlersManager = M_SettlersManager.Instance;
        m_inputManager    = M_InputManager.Instance;
        m_waresManager    = M_WaresManager.Instance;
        m_saveManager     = M_SaveManager.Instance;

        // Load level
        GameObject menuManager = GameObject.FindGameObjectWithTag("MenuManager");

        if (menuManager != null)
        {
            SceneLoader sceneLoader = menuManager.GetComponent <SceneLoader>();
            if (sceneLoader != null)
            {
                if (sceneLoader.gameData == null)
                {
                    LoadLevel(defaultGameData);
                }
                else
                {
                    LoadLevel(sceneLoader.gameData);
                }


                if (sceneLoader.saveId > 0)
                {
                    LoadSave(sceneLoader.saveId);
                }
            }
            else
            {
                Debug.LogWarning("Cannot find " + typeof(SceneLoader).Name + " component!");
            }
        }
        else
        { // Only if we started from Game scene, because MenuManager hasn't been initialized.
            if (defaultGameData != null)
            {
                Debug.LogWarning("Loading using default data .");
                LoadLevel(defaultGameData);
            }
            else
            {
                Debug.LogWarning("Couldn't find either MenuManager or default DAT_Game!");
            }
        }
        ResumeGame();
    }