void SetupCharacterStart()
    {
        Modules.PlayAudioClipFree(Modules.audioSurprise);
        //xoa van truot
        Modules.RemoveModelUseItem(Modules.mainCharacter.transform, "Skis");
        //setup main character
        pointHeroTarget = Modules.mainCharacter.transform.position;
        Vector3 pointCreate    = Modules.mainCharacter.GetComponent <HeroController>().pointShowHero.transform.position;
        Vector3 pointCreateNew = new Vector3(pointCreate.x, Modules.pointHeroTerrain, pointCreate.z);

        Modules.mainCharacter.transform.position = pointCreateNew;
        HeroController heroNow = Modules.mainCharacter.GetComponent <HeroController>();

        //an cac object hide
        foreach (GameObject go in heroNow.listObjectHide)
        {
            go.gameObject.SetActive(false);
        }
        timeAniStart    = heroNow.CallAniMenu(heroNow.aniOhNoMenu, 1f, false);
        runTimeAniStart = 0;
        mesAniStart     = true;
        //setup enemy characters
        EnemyController enemyConLeft = createEnemyLeft.GetComponent <EnemyController>();

        enemyConLeft.CallAniMenu(enemyConLeft.aniRun, 1f);
        pointEnemyLeftTarget = new Vector3(enemyConLeft.pointX, enemyConLeft.transform.position.y, enemyConLeft.pointZNear);
        //hen gio de an xe canh sat
        Invoke("HideCarPolice", 5f);
    }
Esempio n. 2
0
 void LoadSkisChoose()
 {
     for (int i = 0; i < Modules.listSkisUse.Count; i++)
     {
         SkisController skisCon = Modules.listSkisUse[i].GetComponent <SkisController>();
         if (skisCon.idSkis == codeSkisChoose)
         {
             heroChooseShow.transform.parent      = Modules.containHeroConstruct.transform;
             heroChooseShow.transform.position    = pointShowSkis;
             heroChooseShow.transform.localScale  = scaleShowSkis;
             heroChooseShow.transform.eulerAngles = new Vector3(20, 180, 0);
             HeroController heroNow = heroChooseShow.GetComponent <HeroController>();
             heroNow.mySkis = Modules.listSkisUse[i];
             heroNow.SetupShowMenu(2);
             heroNow.CallAniMenu(heroNow.aniRunSkis, 1f);
             if (skisCon.iconSale != null)
             {
                 iconSkisSale.sprite = skisCon.iconSale;
                 iconSkisSale.color  = new Color(1, 1, 1, 1);
             }
             else
             {
                 iconSkisSale.color = new Color(1, 1, 1, 0);
             }
             Modules.RemoveModelUseItem(heroChooseShow.transform, "Skis");
             Modules.SetModelUseItem(heroChooseShow.transform, heroNow.codeBody, heroNow.mySkis, "Skis");
             Modules.SetLayer(heroChooseShow.gameObject, "MCG-Hero");
             foreach (GameObject go in heroNow.listObjectHide)
             {
                 go.gameObject.SetActive(false);
             }
             //skisCon.CallAniMenu(skisCon.aniRun, 1f);
             textNoteSkis.text  = AllLanguages.heroInfoHoverboard[skisCon.noteSkis][Modules.indexLanguage];
             textValueSkis.text = skisCon.costSkis.ToString();
             if (Modules.codeSkisUse == codeSkisChoose)
             {
                 textValueSkis.text = AllLanguages.heroSelected[Modules.indexLanguage];
             }
             else if (Modules.listSkisUnlock.Contains(codeSkisChoose))
             {
                 textValueSkis.text = AllLanguages.heroUnlocked[Modules.indexLanguage];
             }
             valueOriginButBuySkis = textValueSkis.text;
             break;
         }
     }
 }
Esempio n. 3
0
 void LoadHeroChoose()
 {
     if (heroChooseShow != null)
     {
         Destroy(heroChooseShow);
     }
     for (int i = 0; i < Modules.listHeroUse.Count; i++)
     {
         if (Modules.listHeroUse[i].GetComponent <HeroController>().idHero == codeHeroChoose)
         {
             heroChooseShow = Instantiate(Modules.listHeroUse[i], pointShowHero, Quaternion.identity) as GameObject;
             Modules.SetLayer(heroChooseShow.gameObject, "MCG-Hero");
             heroChooseShow.transform.parent      = Modules.containHeroConstruct.transform;
             heroChooseShow.transform.localScale  = scaleShowHero;
             heroChooseShow.transform.eulerAngles = new Vector3(0, 180, 0);
             HeroController heroNow = heroChooseShow.GetComponent <HeroController>();
             heroNow.SetupShowMenu(2);
             heroNow.CallAniMenu(heroNow.aniIdleMenu, 1f);
             if (heroNow.iconSale != null)
             {
                 iconHeroSale.sprite = heroNow.iconSale;
                 iconHeroSale.color  = new Color(1, 1, 1, 1);
             }
             else
             {
                 iconHeroSale.color = new Color(1, 1, 1, 0);
             }
             textNoteHero.text  = AllLanguages.heroInfoHero[heroNow.noteHero][Modules.indexLanguage];
             textValueHero.text = heroNow.costHero.ToString();
             if (Modules.codeHeroUse == codeHeroChoose)
             {
                 textValueHero.text = AllLanguages.heroSelected[Modules.indexLanguage];
             }
             else if (Modules.listHeroUnlock.Contains(codeHeroChoose))
             {
                 textValueHero.text = AllLanguages.heroUnlocked[Modules.indexLanguage];
             }
             valueOriginButBuyHero = textValueHero.text;
             PlayAudioHero(audioHero[i]);
             break;
         }
     }
 }
Esempio n. 4
0
 public void CallStart()
 {
     ChangeAllLanguage();
     textHighScore.GetComponent <EffectUpScore>().StartEffect(Modules.totalScore);
     if (myHero != null)
     {
         myHero.GetComponent <ShadowFixed>().RemoveShadow();
         Destroy(myHero);
     }
     foreach (GameObject go in Modules.listHeroUse)
     {
         HeroController heroCon = go.GetComponent <HeroController>();
         if (heroCon.idHero == Modules.codeHeroUse)
         {
             myHero = Instantiate(go, pointBeginHero, Quaternion.Euler(angleBeginHero)) as GameObject;
             myHero.transform.parent = Modules.containHighScore.transform;
             HeroController heroNow = myHero.GetComponent <HeroController>();
             heroNow.SetupShowMenu(1);
             heroNow.CallAniMenu(heroNow.aniRunNormal, 1f);
             break;
         }
     }
 }
Esempio n. 5
0
 void FixedUpdate()
 {
     //load list hero tuan tu
     if (mesLoadListHero)
     {
         if (runLoadListHero < Modules.listHeroUse.Count)
         {
             string     idNow   = Modules.listHeroUse[runLoadListHero].GetComponent <HeroController>().idHero;
             GameObject newItem = Instantiate(itemTempHero.gameObject, Vector3.zero, Quaternion.identity) as GameObject;
             newItem.transform.SetParent(contentHero.transform, false);
             newItem.GetComponent <ChangeImageClick>().codeObject = idNow;
             GameObject heroChoose = Instantiate(Modules.listHeroUse[runLoadListHero], pointShowThumHero, Quaternion.identity) as GameObject;
             heroChoose.transform.localScale  = scaleShowThumHero;
             heroChoose.transform.eulerAngles = new Vector3(0, 180, 0);
             HeroController heroNow = heroChoose.GetComponent <HeroController>();
             heroNow.SetupShowMenu(2);
             heroNow.CallAniMenu(heroNow.aniIdleMenu, 1f);
             Image iconSaleSmall = newItem.transform.GetChild(0).GetComponent <Image>();
             if (heroNow.iconSale != null)
             {
                 iconSaleSmall.sprite = heroNow.iconSale;
                 iconSaleSmall.color  = new Color(1, 1, 1, 1);
             }
             else
             {
                 iconSaleSmall.color = new Color(1, 1, 1, 0);
             }
             heroChoose.transform.SetParent(newItem.transform, false);
             if (idNow == codeHeroChoose)
             {
                 newItem.GetComponent <ChangeImageClick>().OpenImageFront(); indexChooseHero = runLoadListHero;
             }
             else
             {
                 newItem.GetComponent <ChangeImageClick>().CloseImageFront();
             }
             runLoadListHero++;
         }
         else
         {
             mesLoadListHero = false;
             //dieu chinh scroll bar toi nhan vat
             Vector2 oldPoint = contentHero.GetComponent <RectTransform>().anchoredPosition;
             contentHero.GetComponent <RectTransform>().anchoredPosition = new Vector3(valueScrollHero[indexChooseHero], oldPoint.y);
         }
     }
     //load list skis tuan tu
     if (mesLoadListSkis)
     {
         if (runLoadListSkis < Modules.listSkisUse.Count)
         {
             string     idNow   = Modules.listSkisUse[runLoadListSkis].GetComponent <SkisController>().idSkis;
             GameObject newItem = Instantiate(itemTempSkis.gameObject, Vector3.zero, Quaternion.identity) as GameObject;
             newItem.transform.SetParent(contentSkis.transform, false);
             newItem.GetComponent <ChangeImageClick>().codeObject = idNow;
             GameObject skisChoose = Instantiate(Modules.listSkisUse[runLoadListSkis], pointShowThumSkis, Quaternion.identity) as GameObject;
             skisChoose.transform.localScale  = scaleShowThumSkis;
             skisChoose.transform.eulerAngles = new Vector3(50, -215, -10);
             SkisController skisNow = skisChoose.GetComponent <SkisController>();
             RotateZModels  rotateZ = skisChoose.AddComponent <RotateZModels>();
             rotateZ.originAngle = skisChoose.transform.eulerAngles;
             //skisNow.CallAniMenu(skisNow.aniRun, 1f);
             Image iconSaleSmall = newItem.transform.GetChild(0).GetComponent <Image>();
             if (skisNow.iconSale != null)
             {
                 iconSaleSmall.sprite = skisNow.iconSale;
                 iconSaleSmall.color  = new Color(1, 1, 1, 1);
             }
             else
             {
                 iconSaleSmall.color = new Color(1, 1, 1, 0);
             }
             skisNow.transform.SetParent(newItem.transform, false);
             if (idNow == codeSkisChoose)
             {
                 newItem.GetComponent <ChangeImageClick>().OpenImageFront(); indexChooseSkis = runLoadListSkis;
             }
             else
             {
                 newItem.GetComponent <ChangeImageClick>().CloseImageFront();
             }
             runLoadListSkis++;
         }
         else
         {
             mesLoadListSkis = false;
             //dieu chinh scroll bar toi hoverboard
             Vector2 oldPoint = contentSkis.GetComponent <RectTransform>().anchoredPosition;
             contentSkis.GetComponent <RectTransform>().anchoredPosition = new Vector3(valueScrollSkis[indexChooseSkis], oldPoint.y);
         }
     }
 }
    public void CallStart()
    {
        ChangeAllLanguage();
        float scoreNow = Modules.totalScore;
        float coinNow  = Modules.totalCoin;

        CancelInvoke("BlinkDoubleCoin");
        if (Modules.showScorePlay)
        {
            scoreNow = Modules.scorePlayer;
            coinNow  = Modules.coinPlayer;
            doubleCoin.interactable = true;
            Invoke("BlinkDoubleCoin", 0f);
        }
        else
        {
            doubleCoin.transform.GetComponent <Image>().color          = colorBlinkCoinA;
            doubleCoin.transform.GetComponentInChildren <Text>().color = colorBlinkTextA;
            doubleCoin.interactable = false;
        }
        textKey.text  = Mathf.RoundToInt(Modules.totalKey).ToString();
        textCoin.text = Mathf.RoundToInt(Modules.totalCoin).ToString();
        textHighScore.GetComponent <EffectUpScore>().StartEffect(scoreNow);
        textHighCoin.GetComponent <EffectUpScore>().StartEffect(coinNow);
        fbScore.text = Mathf.RoundToInt(Modules.totalScore).ToString();
        if (mainCharacter != null)
        {
            Destroy(mainCharacter);
        }
        foreach (GameObject go in Modules.listHeroUse)
        {
            HeroController heroCon = go.GetComponent <HeroController>();
            if (heroCon.idHero == Modules.codeHeroUse)
            {
                if (Modules.showScorePlay)
                {
                    mainCharacter = Instantiate(heroCon.modelIdelStun, pointShowHero, Quaternion.identity) as GameObject;
                }
                else
                {
                    mainCharacter = Instantiate(go, pointShowHero, Quaternion.identity) as GameObject;
                }
                mainCharacter.transform.parent      = Modules.containAchievement.transform;
                mainCharacter.transform.localScale  = scaleShowHero;
                mainCharacter.transform.eulerAngles = new Vector3(0, 180, 0);
                if (!Modules.showScorePlay)
                {
                    HeroController heroNow = mainCharacter.GetComponent <HeroController>();
                    heroNow.SetupShowMenu(2);
                    heroNow.CallAniMenu(heroNow.aniIdleMenu, 1f);
                }
                break;
            }
        }
        Modules.showScorePlay = false;
        if (panelTopCountry == null)
        {
            panelLoadingC.SetActive(true);
            panelLoadingC.transform.GetComponent <TextLoading>().CallStart();
        }
        else
        {
            panelLoadingC.SetActive(false);
        }
        if (panelTopWorld == null)
        {
            panelLoadingB.SetActive(true);
            panelLoadingB.transform.GetComponent <TextLoading>().CallStart();
        }
        else
        {
            panelLoadingB.SetActive(false);
        }
        if (panelTopMultiplayer == null)
        {
            panelLoadingD.SetActive(true);
            panelLoadingD.transform.GetComponent <TextLoading>().CallStart();
        }
        else
        {
            panelLoadingD.SetActive(false);
        }
#if !(UNITY_WEBPLAYER || UNITY_WEBGL || UNITY_STANDALONE_WIN || UNITY_IOS || UNITY_ANDROID || UNITY_EDITOR)
        ButtonTopCountryClick();
        panelFBLogin.SetActive(true);
#else
        //xu ly xep hang facebook
        if (fbController == null)
        {
            fbController = Modules.facebookController.GetComponent <FacebookController>();
        }
        fbController.isPostDone = false;
        fbController.isGetDone  = false;
        fbController.getEnemy   = false;
        if (fbController.panelGetInfo != null)
        {
            Destroy(fbController.panelGetInfo);
        }
        if (FB.IsLoggedIn)
        {
            panelFBLogin.SetActive(false);
            panelLoadingA.SetActive(true);
            panelLoadingA.transform.GetComponent <TextLoading>().CallStart();
        }
        else
        {
            panelFBLogin.SetActive(true);
            panelLoadingA.SetActive(false);
        }
        Invoke("PostScoreFacebook", 0f);
        Invoke("GetScoreFacebook", 0f);
        InvokeRepeating("GetBoardScoreFacebook", 0f, 1f);
#endif
        //xu ly xep hang quoc gia va the gioi
        if (Modules.containAchievement.activeSelf)
        {
            StartCoroutine(PostScore());
        }
        Invoke("PostScoreWorld", 0f);
    }
    void CreateCharacters()
    {
        parentCam.transform.position = new Vector3(0, Modules.pointHeroTerrain, 0);
        //tao nhan vat chinh va thiet lap ban dau cho nhan vat
        Vector3 pointHero = new Vector3(0, Modules.pointHeroTerrain + 0.3f, 0);

        if (Modules.mainCharacter != null)
        {
            Modules.mainCharacter.GetComponent <ShadowFixed>().RemoveShadow();
            Destroy(Modules.mainCharacter.gameObject);
        }
        foreach (GameObject go in Modules.listHeroUse)
        {
            HeroController heroCon = go.GetComponent <HeroController>();
            if (heroCon.idHero == Modules.codeHeroUse)
            {
                Modules.mainCharacter = Instantiate(go, Modules.containMainGame.transform) as GameObject;
                Modules.mainCharacter.transform.position = pointHero;
                HeroController heroNow = Modules.mainCharacter.GetComponent <HeroController>();
                heroNow.CallAniMenu(heroNow.aniActionMenu, 1f);
                break;
            }
        }
        //tao van truot cho hero da luu
        foreach (GameObject go in Modules.listSkisUse)
        {
            SkisController skisCon = go.GetComponent <SkisController>();
            if (skisCon.idSkis == Modules.codeSkisUse)
            {
                Modules.mainCharacter.GetComponent <HeroController>().mySkis = go;
                break;
            }
        }
        //tao xe canh sat, van truot
        Vector3 pointPoliceCarNew = new Vector3(pointPoliceCar.x, pointPoliceCar.y + Modules.pointHeroTerrain, pointPoliceCar.z);

        CancelInvoke("HideCarPolice");
        if (policeCar != null)
        {
            if (carPolice)
            {
                Destroy(carPolice);
            }
            carPolice = Instantiate(policeCar, GetComponent <TerrainController>().listShowTerrain[0].transform) as GameObject;
            carPolice.transform.position = pointPoliceCarNew;
        }
        HeroController heroControl = Modules.mainCharacter.GetComponent <HeroController>();

        Modules.SetModelUseItem(Modules.mainCharacter.transform, heroControl.codeBody, heroControl.mySkis, "Skis");
        //tao cac nhan vat enemy va thiet lap ban dau
        Vector3 pointStartEnemyLeftNew = new Vector3(pointStartEnemyLeft.x, pointStartEnemyLeft.y + Modules.pointHeroTerrain, pointStartEnemyLeft.z);

        if (createEnemyLeft)
        {
            Destroy(createEnemyLeft);
        }
        createEnemyLeft = Instantiate(enemyLeft, pointStartEnemyLeftNew, Quaternion.identity) as GameObject;
        createEnemyLeft.transform.parent = Modules.containMainGame.transform;
        EnemyController enemyConLeft = createEnemyLeft.GetComponent <EnemyController>();

        enemyConLeft.CallAniMenu(enemyConLeft.aniIdleStart, 1f);
    }