Esempio n. 1
0
    public void addUnit()
    {
        switch (job)
        {
        case GameManager.Job.crook:
            Debug.Log(crook.unitPrice());
            GameManager.instance.crooks.Add(crook);
            StoreManager.instance.isCrookBuyed[index] = true;
            GameManager.instance.playerMoney         -= (int)crook.unitPrice();
            GameManager.instance.UpdateResourcesUI();
            break;

        case GameManager.Job.snake:
            Debug.Log(snake.unitPrice());
            GameManager.instance.snakes.Add(snake);
            StoreManager.instance.isSnakeBuyed[index] = true;
            GameManager.instance.playerMoney         -= (int)snake.unitPrice();
            GameManager.instance.UpdateResourcesUI();
            break;

        case GameManager.Job.gang:
            GameManager.instance.gangs.Add(gang);
            StoreManager.instance.isGangBuyed[index] = true;
            GameManager.instance.playerMoney        -= (int)gang.unitPrice();
            GameManager.instance.UpdateResourcesUI();
            break;
        }
    }
Esempio n. 2
0
 public void setGangUnitInformation(int index, GameManager.Gang gang)
 {
     job        = GameManager.Job.gang;
     this.gang  = gang;
     this.index = index;
     transform.Find("Level").GetComponent <Text>().text        = gang.level.ToString();
     transform.Find("Price").GetComponent <Text>().text        = ((int)gang.unitPrice()).ToString() + "만원";
     transform.Find("Type").GetComponent <Text>().text         = gang.GetType();
     transform.Find("Character").GetComponent <Image>().sprite = gang.GetSprite();
 }
Esempio n. 3
0
    public void showBuyInfo()
    {
        switch (job)
        {
        case GameManager.Job.crook:
            if (StoreManager.instance.isCrookBuyed[index])
            {
                //이미 구매했다는 팝업창
                StoreManager.instance.showAlreadyPurchased();
                break;
            }
            if (crook.unitPrice() > GameManager.instance.playerMoney)
            {
                //돈이 모자라다는 팝업창
                StoreManager.instance.showNotEnoughMoney();
                break;
            }
            buyInfo = StoreManager.instance.buyInfo;
            buyInfo.SetActive(true);
            StoreManager.instance.buyYes.job   = GameManager.Job.crook;
            StoreManager.instance.buyYes.crook = crook;
            StoreManager.instance.buyYes.index = index;
            break;

        case GameManager.Job.snake:
            if (StoreManager.instance.isSnakeBuyed[index])
            {
                //이미 구매했다는 팝업창
                StoreManager.instance.showAlreadyPurchased();
                break;
            }
            if (snake.unitPrice() > GameManager.instance.playerMoney)
            {
                //돈이 모자라다는 팝업창
                StoreManager.instance.showNotEnoughMoney();
                break;
            }
            buyInfo = StoreManager.instance.buyInfo;
            buyInfo.SetActive(true);
            StoreManager.instance.buyYes.job   = GameManager.Job.snake;
            StoreManager.instance.buyYes.snake = snake;
            StoreManager.instance.buyYes.index = index;

            break;

        case GameManager.Job.gang:
            if (StoreManager.instance.isGangBuyed[index])
            {
                //이미 구매했다는 팝업창
                StoreManager.instance.showAlreadyPurchased();
                break;
            }
            if (gang.unitPrice() > GameManager.instance.playerMoney)
            {
                //돈이 모자라다는 팝업창
                StoreManager.instance.showNotEnoughMoney();
                break;
            }
            buyInfo = StoreManager.instance.buyInfo;
            buyInfo.SetActive(true);
            StoreManager.instance.buyYes.job   = GameManager.Job.gang;
            StoreManager.instance.buyYes.gang  = gang;
            StoreManager.instance.buyYes.index = index;
            break;
        }
    }