예제 #1
0
파일: InGame.cs 프로젝트: srk9110/TestGit
    public void Init()
    {
        this.uiInGame = GameObject.FindObjectOfType <UIInGame>();

        Debug.Log("InGame: Init");
        this.uiInGame.Init();
        for (int i = 0; i < this.uiInGame.arrUiBinderMission.Length; i++)
        {
            var uiBinderMission = this.uiInGame.arrUiBinderMission[i];
            var idx             = i;


            uiBinderMission.OnClick = (id) =>
            {
                InfoManager.GetInstance().DoMission(id, 1);

                //info변경이 없으면 ui업데이트를 안함
                this.uiInGame.UpdateUI();
            };
        }
        this.uiInGame.btnSave.onClick.AddListener(() =>
        {
            GameInfo gameInfo = InfoManager.GetInstance().gameInfo;
            string json       = JsonConvert.SerializeObject(gameInfo);
            File.WriteAllText(Application.persistentDataPath + "/gameInfo.json", json);
            Debug.Log(json);
            Debug.Log("save");
        });
    }
예제 #2
0
 private void Awake()
 {
     gameOverPanel.SetActive(false);
     if (SingleInstance == null)
     {
         SingleInstance = this;
     }
 }
예제 #3
0
    private void OnDisable()
    {
        BounceStats.OnKeyCollect        -= OnKeyCollectUpdate;
        BounceController.OnPlayerDamage -= ChangeLifeStateOnPlayerDamage;
        GameManager.OnGameOver          -= OnGameOver;
        BounceStats.OnMaskCollect       -= ChangeMaskImage;
        BounceStats.OnMaskCollect       -= UpdateMask;

        SingleInstance = null;
    }
예제 #4
0
 private void Awake()
 {
     if (_instance != null)
     {
         Destroy(this.gameObject);
     }
     else
     {
         _instance = this;
         DontDestroyOnLoad(this.gameObject);
     }
 }
예제 #5
0
 public void StartWriting()
 {
     isGameStarted = false;
     canSkip       = true;
     UIInMenu.SetActive(true);
     StartCoroutine(ReadHistory());
     resultScreen.SetActive(false);
     UIInGame.SetActive(false);
     history.GetComponentInChildren <Text>().text = "";
     canSkip       = false;
     isGameStarted = false;
     pressKeyToStart.GetComponent <Text>().text = "Нажмите на любую клавишу, чтобы пропустить историю";
 }
예제 #6
0
    IEnumerator WaitForTransitionToMenu()
    {
        transitor.SetTrigger("End");
        yield return(new WaitForSeconds(1.5f));

        UIInMenu.SetActive(true);
        history.GetComponentInChildren <Text>().text = "";
        StartCoroutine(ReadHistory());
        resultScreen.SetActive(false);
        UIInGame.SetActive(false);
        canSkip       = false;
        isGameStarted = false;
        transitor.SetTrigger("Start");
    }
예제 #7
0
    private void Start()
    {
        UIInstance = this;
        if (PlayerPrefs.GetString("player") == "Tomato")
        {
            player = Instantiate(Tomato);
        }
        else if (PlayerPrefs.GetString("player") == "Lemon")
        {
            player = Instantiate(Lemon);
        }
        else if (PlayerPrefs.GetString("player") == "Melon")
        {
            player = Instantiate(Melon);
        }
        else if (PlayerPrefs.GetString("player") == "Grape")
        {
            player = Instantiate(Grape);
        }
        if (PlayerPrefs.GetInt("warpGate") == 1)
        {
            player.transform.position = warpGate1.transform.position + new Vector3(0, 1, 0);
        }
        else if (PlayerPrefs.GetInt("warpGate") == 2)
        {
            player.transform.position = warpGate2.transform.position + new Vector3(0, 1, 0);
        }
        else if (PlayerPrefs.GetInt("warpGate") == 3)
        {
            player.transform.position = warpGate3.transform.position + new Vector3(0, 1, 0);
        }
        else if (PlayerPrefs.GetInt("warpGate") == 4)
        {
            player.transform.position = warpGate4.transform.position + new Vector3(0, 1, 0);
        }
        if (PlayerPrefs.GetInt("playerCurrentHp") == -1)
        {
            player.GetComponent <PlayerController>().player.playerCurrentHp = player.GetComponent <PlayerController>().player.playerMaxHp;
        }
        else
        {
            player.GetComponent <PlayerController>().player.playerCurrentHp = PlayerPrefs.GetInt("playerCurrentHp");
        }


        Initialization.SetInitializationInGame_Player(player.GetComponent <PlayerController>(), playerUI);
        Initialization.SetInitializationInGame_Enemy();
    }
예제 #8
0
    void OnDestroy()
    {
        instance = null;

        uiInGame         = null;
        uiTowerPlacement = null;
        uiTowerBuy       = null;
        uiPathArray      = null;
        uiMessageBox     = null;
        uiWaiting        = null;

        rootPanelArray = null;
        gameStatus     = null;

        enemyList = null;

        startPointArray = null;
        endPointArray   = null;
    }
예제 #9
0
    IEnumerator WaitForTransitionToGame()
    {
        transitor.SetTrigger("End");
        yield return(new WaitForSeconds(1.5f));

        UIInMenu.SetActive(false);
        infoPanel.SetActive(false);
        buyPanel.SetActive(false);
        UIInGame.SetActive(true);
        resultScreen.SetActive(false);
        transitor.SetTrigger("Start");
        //Начало игры
        //TowerFabric.Instance.placeTower(0, new TowerStatsList.TowerTomatoT1());
        //TowerFabric.Instance.placeTower(1, new TowerStatsList.TowerTomatoT2());
        //TowerFabric.Instance.placeTower(2, new TowerStatsList.TowerTomatoT3());
        //TowerFabric.Instance.placeTower(3, new TowerStatsList.TowerCabbageT1());
        //TowerFabric.Instance.placeTower(4, new TowerStatsList.TowerPeasT1());

        Game.Instance.StartGame();
        //TowerFabric.Instance.placeTower(0, new TowerStatsList.TowerPeasT3());
        //TowerFabric.Instance.placeTower(1, new TowerStatsList.TowerPeasT3());
    }
예제 #10
0
    private void LoadUICompleteCB(GameObject gameObj, System.Guid uid, params object[] param)
    {
        if (gameObj != null)
        {
            GameObject createObj = Instantiate(gameObj) as GameObject;

            createObj.transform.parent        = rootPanelArray[(int)eRootPanelType.Type_Root].transform;
            createObj.transform.localPosition = Vector3.zero;
            createObj.transform.localScale    = gameObj.transform.localScale;

            switch ((eUIType)param[0])
            {
            case eUIType.Type_InGame:
                uiInGame = createObj.GetComponent <UIInGame>();
                break;

            case eUIType.Type_TowerBuy:
                uiTowerBuy = createObj.GetComponent <UITowerBuy>();
                break;

            case eUIType.Type_TowerPlacement:
                uiTowerPlacement = createObj.GetComponent <UITowerPlacement>();
                break;

            case eUIType.Type_MessageBox:
                uiMessageBox = createObj.GetComponent <UIMessageBox>();
                break;

            case eUIType.Type_GameResult:
                uiGameResult = createObj.GetComponent <UIGameResult>();
                break;

            case eUIType.Type_Waiting:
                uiWaiting = createObj.GetComponent <UIWaiting>();
                break;
            }
        }
    }
예제 #11
0
파일: UIInGame.cs 프로젝트: kyn320/Festival
 void Awake()
 {
     instance = this;
 }
예제 #12
0
 // Use this for initialization
 void Start()
 {
     ui       = UIInGame.instance;
     playTime = sec;
 }