Example #1
0
    public void EndTurn()
    {
        Debug.Log("End turn");
        // Verify if we need to save game
        if (GameOptions.Instance.gameOpt.DoAutoSave >= 1)
        {
            // automatically save game
            saveGame.AutoSave();
        }
        // Get active player
        GamePlayer activePlayer = GetActivePlayer();
        // Get next player
        GamePlayer nextPlayer = GetNextPlayer();

        // Execute post turn actions for the active player
        activePlayer.ExecutePostTurnActions();
        // Execute pre-turn actions for the next player
        nextPlayer.ExecutePreTurnActions();
        // Change active player
        // Change current active player turn state to "HasMoved"
        activePlayer.PlayerTurnState = PlayerTurnState.HasMoved;
        // Change next active player turn state to active
        nextPlayer.PlayerTurnState = PlayerTurnState.Active;
        // execute pre-turn actions for MapMenu
        MapMenuManager.Instance.ExecutePreTurnActions(nextPlayer);
        // execute pre-turn actions for MapManager
        MapManager.Instance.ExecutePreTurnActions();
    }
Example #2
0
    public void ChageScene(string scenename)
    {
        SaveGame SG = GameObject.Find("DataCenter").GetComponent <SaveGame>();

        SG.AutoSave();

        StartCoroutine(WaitForSeconds(scenename));
    }
Example #3
0
    public void SceneAgain()
    {
        SaveGame SG = GameObject.Find("DataCenter").GetComponent <SaveGame>();

        SG.AutoSave();

        StartCoroutine(WaitForSeconds(Application.loadedLevelName));
    }
Example #4
0
    void Update()
    {
        if (gameObject.activeSelf)
        {
            this.transform.GetChild(0).GetComponent <Text>().text = "สำเร็จ\t" + "<i>" + LavelStage + "</i>";

            this.transform.GetChild(1).GetComponent <Text>().text = "ใช้เวลาทั้งหมด \t\t\t<b>"
                                                                    + (TimeStage % 60 > 30 ? ((TimeStage / 60) - 1).ToString("##0") : (TimeStage / 60).ToString("##0"))
                                                                    + "." + (TimeStage % 60).ToString("0#") + "</b> นาที";


            if (Input.GetMouseButtonDown(0) || Input.GetKeyDown(KeyCode.Escape))
            {
                SaveGame SG = GameObject.Find("DataCenter").GetComponent <SaveGame>();
                SG.AutoSave();
                this.gameObject.SetActive(false);
                //StartCoroutine(WaitForSeconds("Village"));
            }
        }
    }