PlaySound() public method

public PlaySound ( int i ) : void
i int
return void
Ejemplo n.º 1
0
 public void SpinWheelLuck() // button Spin Click Event
 {
     this.gameObject.GetComponent <Animator>().enabled = false;
     if (isAgain)
     {
         if (!isSpinning)
         {
             audioControl.PlaySound("Quay xo so");
             isSpinning = true;
             isLight    = true;
             float zChange = Random.Range(-4150, -2000);
             LeanTween.rotateZ(wheelLuck, zChange, 5).setEase(LeanTweenType.easeInOutQuad).setOnComplete(delegate()
             {
                 isCompleteSpin = true;
                 isLight        = false;
             });
             SetStatusButtonSpin(false);
             DialogAchievement.AddDataAchievement(6, 1);
             MissionData.townDataMission.currentNumber += 1;
         }
         isAgain = false;
     }
     else
     {
         if (!isSpinning)
         {
             if (VariableSystem.diamond >= countSpin)
             {
                 audioControl.PlaySound("Quay xo so");
                 isSpinning = true;
                 isLight    = true;
                 float zChange = Random.Range(-4150, -2000);
                 LeanTween.rotateZ(wheelLuck, zChange, 5).setEase(LeanTweenType.easeInOutQuad).setOnComplete(delegate()
                 {
                     isCompleteSpin = true;
                     isLight        = false;
                 });
                 AddCommonObject(0, -countSpin);
                 countSpin++;
                 SetStatusButtonSpin(false);
                 DialogAchievement.AddDataAchievement(6, 1);
                 MissionData.townDataMission.currentNumber += 1;
             }
             else
             {
                 audioControl.PlaySound("Click 1");
                 DialogInapp.ShowInapp();
             }
         }
     }
     // SaveCountSpin();
 }
Ejemplo n.º 2
0
 public void OKButton_Click()
 {
     audioControl.PlaySound("Click 1");
     if (VariableSystem.diamond >= diamondChange)
     {
         //print("hieu ưng kim cuong va tien");
         AddCommonObject(coinAdd, -diamondChange);
     }
     else
     {
         // DialogInapp.ShowDialogInapp();
         DialogInapp.ShowInapp();
     }
     CancelButton_Click();
 }
Ejemplo n.º 3
0
    public void UseDiamond()
    {
        //audioControl.PlaySoundInstance("Click 1", false, false, 0.5f);

        if (Application.loadedLevelName.Equals("Town"))
        {
            audioControl.PlaySound("Click 1");
            if (!isEfect)
            {
                if (VariableSystem.diamond >= 1)
                {
                    Diamond_EfectClone = (GameObject)Instantiate(Diamond_EfectPrefabs, transform.position, transform.rotation);
                    Diamond_EfectClone.transform.parent        = transform;
                    Diamond_EfectClone.transform.localPosition = new Vector3(50, -50, 0);
                    Diamond_EfectClone.transform.localScale    = new Vector3(-1, 1, 1);
                    isEfect = true;
                    AddCommonObject(0, -1);
                }
                else
                {
                    DialogInapp.ShowInapp();
                }
            }
        }
    }
Ejemplo n.º 4
0
    void Start()
    {
        audioControl    = GameObject.Find("AudioControl").GetComponent <AudioControl>();
        timeRandomSound = 10f;
        audioControl.PlaySound("May moc chay");

        listIDMaterialOfMachine = new List <int>();
        // timeCheck = Random.Range(10000, 20000) / 1000;
        timeCheck            = 20;
        timeCheckWarning     = 30.0f;
        timeCheckWarningLack = 30.0f;

        commonObject = GameObject.Find("CommonObject");

        animator = GetComponent <Animator>();
        SetIDLayer(this.sortingLayerID);
        machineClonePrefabs = (GameObject)Resources.Load("Factory/Button/Prefabs/MachineClone");

        //timeProduct = 10.0f;
        //print(idMachineType);
        rationFail    = FactoryScenesController.listMachineInfomation[idMachineType].listRationFail[levelMachine - 1];
        rePairPrefabs = (GameObject)Resources.Load("Factory/Machine/RePair");

        timeCount      = timeProduct;
        productPrefabs = (GameObject)Resources.Load("Factory/Product/Product");

        ReadMaterialForMachine();

        factoryTextPrefabs    = (GameObject)Resources.Load("Factory/Queue/TimeLeftMachine");
        nameMachinePrefabs    = (GameObject)Resources.Load("Factory/Queue/NameMachine");
        buttonClickPayPrefabs = (GameObject)Resources.Load("Factory/Queue/ButtonClickPay");
    }
Ejemplo n.º 5
0
 public void Close_Click()
 {
     audioControl.PlaySound("Click 1");
     if (!TownScenesController.isHelp)
     {
         this.gameObject.GetComponent <Animator>().Play("InVisible");
     }
 }
Ejemplo n.º 6
0
    void CreatProduct()
    {
        if (IDProductQueue.Count != 0)
        {
            if (!isFail)
            {
                timeCount += Time.deltaTime;
            }
            timeProduct = IDProductQueue.Peek().productionTime;
            if (FactoryScenesController.isHelp)
            {
                timeLeft = timeProduct - 0;
                if (CreatAndControlPanelHelp.countClickHelpPanel == 16)
                {
                    timeLeft = 0;
                }
            }
            else
            {
                timeLeft = timeProduct - timeCount;
            }
            if (timeCount >= timeProduct)
            {
                if (Application.loadedLevelName.Equals("Factory"))
                {
                    audioControl.PlaySound("Lo vi Song");
                    productClone = (GameObject)Instantiate(productPrefabs, new Vector3(transform.position.x - 0.5f, transform.position.y + 0.5f, transform.position.z), transform.rotation);
                    productClone.GetComponent <ProductController>().IDProduct      = IDProductQueue.Peek().IDProduct;
                    productClone.GetComponent <ProductController>().sortingLayerID = this.sortingLayerID > 6 ? 10 : 7;
                    productClone.GetComponent <ProductController>().countPosition  = (int)(idMachinePosition);
                    productClone.name = productPrefabs.name;
                }
                //tăng chỉ số mục tiêu ở đây
                MissionData.shopDataMission.listProducts[listIndext[0]].currentLevel += 1;
                //  print("Product have index " + listIndext[0] + " haved count: " + MissionData.shopDataMission.listProducts[listIndext[0]].currentLevel);
                //tăng tổng lượng sản phẩm từng loại
                CommonObjectScript.arrayProducts[IDProductQueue.Peek().IDProduct - 7] += 1;
                StorageController.checknewProduct(IDProductQueue.Peek().IDProduct - 7);
                MissionData.factoryDataMission.currentNumber += 1;
                listIndext.RemoveAt(0);
                IDProductQueue.Dequeue();
                if (queueClone != null)
                {
                    queueClone.GetComponent <ProductQueueController>().CreatProductInQueue();
                }


                //for (int i = 0; i < CommonObjectScript.arrayProducts.Length; i++)
                //{
                //    print("product " + i + " : " + CommonObjectScript.arrayProducts[i]);
                //}
                // print("countBread : " + FactoryScenesController.countBread);

                timeCount = 0;
            }
        }
    }
 public void OKButton_Click()
 {
     audioControl.PlaySound("Click 1");
     if (!FactoryScenesController.isHelp)
     {
         ControlOKClick();
     }
     else
     {
         if (VariableSystem.mission == 8 && CreatAndControlPanelHelp.countClickHelpPanel == 2)
         {
             ControlOKClick();
             DestroyObjecHelp("CircleHelp");
             DestroyObjecHelp("HandHelp");
             CreatAndControlPanelHelp.countClickHelpPanel = 3;
         }
     }
 }
Ejemplo n.º 8
0
 public void Menu_Click()
 {
     audioControl.PlaySound("Click 1");
     IDButtonInPause = 1;
     Time.timeScale  = 1;
     print("aaaaaaaaaaa");
     this.gameObject.GetComponent <Animator>().Play("Invisible");
 }
Ejemplo n.º 9
0
 void OnMouseDown()
 {
     // audioControl.PlaySoundInstance("Click 1", false, false, 0.5f);
     audioControl.PlaySound("Click 1");
     if (!isClick)
     {
         iconButon.transform.localScale = new Vector3(1.1f, 1.1f, 1f);
         dinamondPrefabs = (GameObject)Resources.Load("Factory/Queue/Diamond");
     }
 }
    public void BtnOK_Click()
    {
        MissionControl.ResetAllItem();
        audioControl.PlaySound("Click 1");
        DataCache.SaveAchievementCache();
        Time.timeScale = 1;
        print("aaaaaaaaaaa");
        //Application.LoadLevel("Mission");
        LoadingScene.ShowLoadingScene("Mission", true);

        //  CommonObjectScript.nameScenes = "Mission";

        //Hungbv19/01
        //FactoryScenesController.isCreat = false;
        //TownScenesController.isCreat = false;
        //CreatAndControlPanelHelp.countClickHelpPanel = 0;

        CommonObjectScript.isViewPoppup = false;
        Destroy(gameObject);
    }
Ejemplo n.º 11
0
 public void OKButton_Click()
 {
     audioControl.PlaySound("Click 1");
     if (!FactoryScenesController.isHelp)
     {
         ControlOKClick();
     }
     else
     {
         if (VariableSystem.mission == 4 && CreatAndControlPanelHelp.countClickHelpPanel == 3)
         {
             ControlOKClick();
             DestroyObjecHelp("CircleHelp");
             DestroyObjecHelp("HandHelp");
             FactoryScenesController.isHelp = false;
             EndHelp();
             //kết thúc hướng dẫn bán máy
         }
     }
 }
Ejemplo n.º 12
0
 public void BtnItem_Click()
 {
     audioControl.PlaySound("Click 1");
     if (!TownScenesController.isHelp)
     {
         SetDataButtonItem(this.iDSelected, this.levelSelected, this.maxSelected);
     }
     else
     {
         if (VariableSystem.mission == 15)
         {
             if (this.iDSelected == 1)
             {
                 SetDataButtonItem(this.iDSelected, this.levelSelected, this.maxSelected);
                 ChangeHelpPosition("CircleHelp", new Vector3(124, -270, 0));
                 ChangeHelpPosition("HandHelp", new Vector3(124, -270, 0));
                 CreatAndControlPanelHelp.countClickHelpPanel = 4;
             }
         }
     }
 }
Ejemplo n.º 13
0
 void OnClick()
 {
     audioControl.PlaySound("Chon sp");
     if (CommonObjectScript.dollar >= costProduct)
     {
         CreateContainerCoinEfect();
         CreateObjectItem();
         AddProduct();
         AddCommonObject(-costProduct, 0);
     }
     else
     {
         panelFrame.transform.parent.parent.GetComponent <MaketController>().ButtonCloseClick();
         GameObject.Find("CommonObject").GetComponent <CommonObjectScript>().ChangeDolar(costProduct - CommonObjectScript.dollar);
     }
 }
 public void Close_Click()
 {
     audioControl.PlaySound("Click 1");
     if (!TownScenesController.isHelp)
     {
         this.gameObject.GetComponent <Animator>().Play("InVisible");
     }
     else
     {
         if (VariableSystem.mission == 11 && CreatAndControlPanelHelp.countClickHelpPanel == 7)
         {
             this.gameObject.GetComponent <Animator>().Play("InVisible");
         }
         DestroyObjecHelp("CircleHelp");
         DestroyObjecHelp("HandHelp");
         CreatAndControlPanelHelp.countClickHelpPanel = 8;
     }
     CommonObjectScript.isViewPoppup = false;
 }
Ejemplo n.º 15
0
    void Start()
    {
        AudioControl.PlaySound(soundsGame.nhacnen);
        //Tương tự GokuController, ngăn không spawn ball khỏi màn hình
        if (cam == null)
        {
            cam = Camera.main;
        }
        playing = false;
        Vector3 upperCorner = new Vector3(Screen.width, Screen.height, 0.0f);
        Vector3 targetWidth = cam.ScreenToWorldPoint(upperCorner);
        float   ballWidth   = ball.GetComponent <Renderer>().bounds.extents.x;

        maxWidth = targetWidth.x - ballWidth;
        UpdateText();
        UpdateHealthText();
        Goku.SetActive(false);
        TutText.SetActive(false);
        HomeButton.SetActive(false);
        levelText.SetActive(false);
        bonus = false;
    }
Ejemplo n.º 16
0
    void CreatProduct()
    {
        audioControl.PlaySound("Chon sp");
        if (machineSelected.GetComponent <MachineController>().IDProductQueue.Count < ((machineSelected.GetComponent <MachineController>().levelMachine - 1) * 2 + 5))
        {
            if (!machineSelected.GetComponent <MachineController>().isFail)
            {
                if (FactoryScenesController.listProductInformation[IDbutton - 7].levelMachineUnlock <= machineSelected.GetComponent <MachineController>().levelMachine)
                {
                    if (CheckAllowCreatProduct())
                    {
                        machineSelected.GetComponent <MachineController>().IDProductQueue.Enqueue(FactoryScenesController.listProductInformation[IDbutton - 7]); // add sản phẩm vào hàng chờ đang sản xuất
                        machineSelected.GetComponent <MachineController>().listIndext.Add(indextInList);
                        CreateMaterialFall(IDbutton);
                    }
                    else
                    {
                        CreatNote(machineSelected.transform, new Vector3(1.2f, 1.2f, 1), new Vector3(0, 0, 0), FactoryScenesController.languageHungBV["LACKOFMATERIAL"]);
                    }
                }
                else
                {
                    CreatNote(machineSelected.transform, new Vector3(1.2f, 1.2f, 1), new Vector3(0, 0, 0), FactoryScenesController.languageHungBV["UNLOCKPRODUCT"] + FactoryScenesController.listProductInformation[IDbutton - 7].levelMachineUnlock);
                }
            }
            SetDataProductQueue(machineSelected.GetComponent <MachineController>().IDProductQueue);
        }
        else
        {
            // print("full queue");
            //foreach (ProductInfomation pr in machineSelected.GetComponent<MachineController>().IDProductQueue)
            //{
            //    print("Machine" + machineSelected.GetComponent<MachineController>().idMachinePosition + " : ProductID : " + pr.IDProduct);
            //}

            CreatNote(machineSelected.transform, new Vector3(1.2f, 1.2f, 1), new Vector3(0, 0, 0), FactoryScenesController.languageHungBV["FULLQUEU"]);
        }
    }
Ejemplo n.º 17
0
 void SetDataClickEven(UIButton button, int id, int missionUnlock, bool visible)
 {
     audioControl.PlaySound("Click 1");
     if (button.defaultColor == new Color32(70, 70, 70, 255))
     {
         labelInfor.text     = TownScenesController.languageTowns["Unlock"] + missionUnlock;
         labelInfor.fontSize = 90;
         SetStatusInforUnder(false);
         ResetStatusPreButton();
     }
     else
     {
         SetStatusButtonAfterClick(button, id);
         SetStatusInforUnder(visible);
         idButton = id;
         setDataInfor(id);
         if (id == 0 || id == 1)
         {
             setImagesButtonItem(id);
             SetDataEvenClickButtonItem(0);
         }
     }
 }
Ejemplo n.º 18
0
 public void ButtonCloseClick()
 {
     audioControl.PlaySound("Click 1");
     this.animator.Play("Invisible");
 }
 public void Close_Click()
 {
     audioControl.PlaySound("Click 1");
     animator.Play("InVisible");
 }
 //Điều điểm khi va chạm
 void OnCollisionEnter2D(Collision2D other)
 {
     //tăng điểm khi ăn bóng
     if (other.gameObject.tag == "Ball")
     {
         //Nếu va chạm với banh -> xóa banh
         Destroy(other.gameObject);
         AudioControl.PlaySound(soundsGame.ball);
         score += 1;
         UpdateScore();
     }
     //tăng điểm và mạng khi ăn heart
     else if (other.gameObject.tag == "Heart")
     {
         //Nếu va chạm với banh -> xóa banh
         Destroy(other.gameObject);
         AudioControl.PlaySound(soundsGame.heart);
         if (GameControl.health > 0)
         {
             GameControl.health++;
         }
         score++;
         GameControl.UpdateHealthText();
     }
     //giảm điểm và mạng khi ăn boom
     else if (other.gameObject.tag == "Boom")
     {
         //Nếu va chạm với boom -> xóa boom
         Destroy(other.gameObject);
         AudioControl.PlaySound(soundsGame.boom);
         if (GameControl.health > 0)
         {
             GameControl.health--;
         }
         score--;
         if (score < 0)
         {
             score = 0;
         }
         if (GameControl.health < 0)
         {
             GameControl.health = 0;
         }
         GameControl.UpdateHealthText();
         UpdateScore();
     }
     //giảm điểm và mạng khi ăn shuriken
     else if (other.gameObject.tag == "Shuriken")
     {
         //Nếu va chạm với shuriken -> xóa shuriken
         Destroy(other.gameObject);
         AudioControl.PlaySound(soundsGame.boom);
         if (GameControl.health > 0)
         {
             GameControl.health -= 2;
         }
         score -= 2;
         if (score < 0)
         {
             score = 0;
         }
         if (GameControl.health < 0)
         {
             GameControl.health = 0;
         }
         GameControl.UpdateHealthText();
         UpdateScore();
     }
     //giảm điểm và mạng khi ăn energy
     else if (other.gameObject.tag == "Energy")
     {
         //Nếu va chạm với energy -> xóa banh
         Destroy(other.gameObject);
         AudioControl.PlaySound(soundsGame.boom);
         if (GameControl.health > 0)
         {
             GameControl.health -= 3;
         }
         score -= 3;
         if (score < 0)
         {
             score = 0;
         }
         if (GameControl.health < 0)
         {
             GameControl.health = 0;
         }
         GameControl.UpdateHealthText();
         UpdateScore();
     }
     //giảm điểm và mạng khi ăn GenkiDama
     else if (other.gameObject.tag == "GenkiDama")
     {
         //Nếu va chạm với GenkiDama -> xóa GenkiDama
         Destroy(other.gameObject);
         AudioControl.PlaySound(soundsGame.boom);
         if (GameControl.health > 0)
         {
             GameControl.health -= 20;
         }
         score -= 20;
         if (score < 0)
         {
             score = 0;
         }
         if (GameControl.health < 0)
         {
             GameControl.health = 0;
         }
         GameControl.UpdateHealthText();
         UpdateScore();
     }
 }
Ejemplo n.º 21
0
 void Start()
 {
     audioControl = GameObject.Find("AudioControl").GetComponent <AudioControl>();
     audioControl.PlaySound("Kim cuong roi xuong");
 }
Ejemplo n.º 22
0
 void Start()
 {
     label.GetComponent <New3FontRead>().New3Read("ButtonBG2", 1, TextAlignment.Left, "-1", 0f, 0f);
     audioControl = GameObject.Find("AudioControl").GetComponent <AudioControl>();
     audioControl.PlaySound("Kim cuong roi xuong");
 }
Ejemplo n.º 23
0
 public void Close_Click()
 {
     audioControl.PlaySound("Click 1");
     this.gameObject.GetComponent <Animator>().Play("InVisible");
 }
Ejemplo n.º 24
0
    void Update()
    {
        if (isChangedDollar)
        {
            labelsInCommon[2].text = DString.ConvertToMoneyString(dollar.ToString());
            isChangedDollar        = false;
        }
        if (VariableSystem.isNeedUpdateValueDiamond)
        {
            labelsInCommon[3].text = DString.ConvertToMoneyString(VariableSystem.diamond.ToString());
            VariableSystem.isNeedUpdateValueDiamond = false;
        }

        if (isLeavedFarm && !Application.loadedLevelName.Equals("Farm"))//restore position of commonObject
        {
            transform.localPosition = Vector3.zero;
            isLeavedFarm            = false;
            if (FarmCenterScript.isNeedWarning)
            {
                WarningVisible(CommonObjectScript.Button.Farm);
            }
        }

        //auto time
        if (!(isOpennew || isGuide || maxTimeOfMission <= 0))
        {
            countTimeOneDay    += Time.deltaTime;
            clockBar.fillAmount = 1 - countTimeOneDay / 24;
            if (countTimeOneDay >= 24)
            {
                Nextday();
                weatherDay             = getNextDay();
                iconWeather.spriteName = weatherDay;
                countTimeOneDay        = 0;
                if (weatherDay.Equals("nang") || weatherDay.Equals("mua") || weatherDay.Equals("tuyet"))
                {
                    IconWeatherController.setScale(true);
                }
                else
                {
                    IconWeatherController.setScale(false);
                }
            }
            if (maxTimeOfMission == 1 && countTimeOneDay >= 14 && !isPlayHetGio)
            {
                audioControl.PlaySound("Het gio");
                isPlayHetGio = true;
            }
        }

        #region auto effect storage, coin, star
        if (storageActiveTime > 0)
        {
            storageActiveTime--;
            if (btnStorage.width > 118)
            {
                btnStorage.width  -= 2;
                btnStorage.height -= 2;
            }
        }
        if (starActiveTime > 0)
        {
            starActiveTime--;
            if (starIcon.width > 62)
            {
                starIcon.width  -= 1;
                starIcon.height -= 1;
            }
        }
        if (coinActiveTime > 0)
        {
            coinActiveTime--;
            if (coinIcon.width > 62)
            {
                coinIcon.width  -= 1;
                coinIcon.height -= 1;
            }
        }
        #endregion

        // Back Button
        BackButton();
    }