예제 #1
0
 public void setCurrentSpritesKit(int id)
 {
     AppSoundManager.Get().PlaySfx(Sfx.Type.sfx_btn_click);
     if (!billing.isUnlock() /*!data.isBuy*/)
     {
         if (id == 1)
         {
             OnBuyClick();
         }
         else
         {
             return;
         }
     }
     else
     {
         for (int i = 0; i < sets.Length; i++)
         {
             if (i == id)
             {
                 sets[i].setBgColor(chooseColor, chooseColorText);
                 sets[i].choose();
             }
             else
             {
                 sets[i].setBgColor(notChooseColor, notChooseColorText);
                 sets[i].deSelect();
             }
         }
         data.spritesId = id;
         data.save();
     }
 }
예제 #2
0
    void addPoints(int points)
    {
        int pre   = 0;
        int after = 0;

        pre = currentScores / Config.pointsForTimer;

        currentScores += points;

        after = currentScores / Config.pointsForTimer;
        if (pre != after)
        {
            AppSoundManager.Get().PlaySfx(Sfx.Type.sfx_refresh_add);
            currentTimeBreakers++;
            showTimeBreakers(true);
        }
        currentScoresView.text = currentScores.ToString();

        if (points > 0)
        {
            GameObject obj = Instantiate(flyingPointsPrefab, currentScoresView.gameObject.GetComponent <RectTransform> ().position, Quaternion.identity) as GameObject;
            obj.transform.SetParent(transform);
            obj.GetComponent <RectTransform> ().localScale = new Vector3(1f, 1f, 1f);
            obj.GetComponent <FlyingPoints> ().View(points, directionsForPoints[dirIndx]);

            dirIndx++;
            if (dirIndx >= directionsForPoints.Length)
            {
                dirIndx = 0;
            }
        }
    }
예제 #3
0
 public void OnMainMenuClick()
 {
     AppSoundManager.Get().PlaySfx(Sfx.Type.sfx_btn_click);
     mainMenu.SetActive(true);
     options.SetActive(false);
     helpObj.SetActive(false);
 }
예제 #4
0
        //TODO combine/put all this data in separate data structure
        public void AppRun(AssetDataAbstractBuilder parInitialAssetBuilder,
                           IAssetDatabaseUpdateStrategy parInitialAssetDatabaseUpdateStrategy,
                           SoundManagerColleague parViewSoundManagerColleague, ViewProviderColleague parViewSideViewProviderColleague)
        {
            if (CurrentAppState.CurrentBaseAppState != EBaseAppStates.Created)
            {
                throw new Exception("Already launched application model cannot be launched again!");
            }

            CurrentAppState = new AppState()
            {
                CurrentBaseAppState = EBaseAppStates.Running
            };

            //initialize resources manager
            AppResourceManager = new ResourceManager(AppInfoConsts.ResourcesAssetsDirpath, parInitialAssetBuilder,
                                                     parInitialAssetDatabaseUpdateStrategy);

            // AppResourceManager.LoadAssetPack("packTest");
            // AppResourceManager.LoadAssetPack("gfx_smd");

            //   Console.WriteLine($"{AppResourceManager.GetAssetData<AssetDataText>("packTest", "/data.txt").TextData[0]}");

            //initialize sound manager
            ActualSoundManager = new AppSoundManager(AppResourceManager, this);
            ActualSoundManager.AppSoundManagerMediator.ViewSoundManagerColleague = parViewSoundManagerColleague;
            parViewSoundManagerColleague.Mediator = ActualSoundManager.AppSoundManagerMediator;
            ActualSoundManager.UpdateLibrary();

            AppViewProviderMediator.ViewProviderViewSide = parViewSideViewProviderColleague;

            InitializeHumanPlayers();

            /*
             * var testObj = AppGamePool.GetObject<GameObject>(typeof(GameObject));
             * testObj.Init(this);
             * Console.WriteLine($"{testObj.LinkedAppModel}");
             * testObj.DisableAndSendToPool();
             * Console.WriteLine($"{testObj.LinkedAppModel}");
             * Console.WriteLine($"{testObj.Test}");
             */

            GameObject launchingObject = AppGamePool.GetObject <GameObject>(typeof(GameObject));

            launchingObject.Init(this);

            launchingObject.AddComponent <AppStartComponent>(AppGamePool
                                                             .GetObject <AppStartComponent>(typeof(AppStartComponent)).Init(launchingObject));

            //var testComp = AppGamePool.GetObject<TestInputExitComponent>(typeof(TestInputExitComponent));
            //testComp.Init(testObj);

            //RegisterFixedUpdatableObject(new InputTestUpdatableObject(this));
            //new InputTestUpdatableObject(this);
            //TODO: Application startup logic
            //TODO: Settings loading
            //TODO: App state machine definitions
            //TODO: Multithreading for physics
        }
예제 #5
0
 public void showLeaderBoard()
 {
     AppSoundManager.Get().PlaySfx(Sfx.Type.sfx_btn_click);
             #if UNITY_IPHONE || UNITY_ANDROID
     UM_GameServiceManager.instance.ShowLeaderBoardsUI();
             #else
             #endif
 }
예제 #6
0
 public void OnOptionsClick()
 {
     options.GetComponent <Options> ().Initialize();
     AppSoundManager.Get().PlaySfx(Sfx.Type.sfx_btn_click);
     mainMenu.SetActive(false);
     options.SetActive(true);
     helpObj.SetActive(false);
 }
예제 #7
0
 public void OnRateClick()
 {
     AppSoundManager.Get().PlaySfx(Sfx.Type.sfx_btn_click);
             #if UNITY_IPHONE
     Application.OpenURL("https://itunes.apple.com/us/app/alien-the-hardest-game/id1049621532?ls=1&mt=8");
             #else
     Application.OpenURL("https://play.google.com/store/apps/developer?id=Game+Star+Co.+Ltd");
             #endif
 }
 public static AppSoundManager Get()
 {
     if (_instance == null)
     {
         GameObject go = new GameObject("SoundManager");
         go.transform.position = new Vector3(100, 100, 100);
         _instance             = go.AddComponent <AppSoundManager>();
     }
     return(_instance);
 }
예제 #9
0
 public void runGame()
 {
     preGameView.SetActive(false);
     AppSoundManager.Get().PlayMusic(Music.Type.game);
     //Random.seed = seed;
     currentLvl          = 0;
     currentScores       = 0;
     currentTimeBreakers = 0;
     addPoints(0);
     restartGame();
 }
예제 #10
0
 public void onGamePress()
 {
     AppSoundManager.Get().PlaySfx(Sfx.Type.sfx_click);
     loadScreen.SetActive(true);
     //GoTo.LoadMegaCity ();
     GoTo.LoadNewShop();
     //StartCoroutine (showIntersential ());
     AdMob_Manager.Instance.curTime = 0f;
     AdMob_Manager.Instance.hideBanner();
     //GoTo.LoadEnvironmentChoose();
 }
예제 #11
0
 public void onPlayCLick(bool isTick = true)
 {
     if (isTick)
     {
         AppSoundManager.Get().PlaySfx(Sfx.Type.sfx_btn_click);
     }
     AppSoundManager.Get().StopMusic();
     GameObject.Find("AdvertsManager").GetComponent <AdvertsManager> ().HideBaner();
     startGamePopup.SetActive(false);
     preGameView.SetActive(true);
     GetComponent <Animator> ().Play("PreGameAnim", 0, 0f);
 }
예제 #12
0
    public void itemClick(Item itm)
    {
        if (!mStartedGameplay)
        {
            return;
        }

        if (itm.type == Item.Type.bad_spy)
        {
            Handheld.Vibrate();
            AppSoundManager.Get().PlaySfx(Sfx.Type.sfx_monster_click);
            loseGame(false, itm.gameObject);
        }
        else if (itm.type == Item.Type.good)
        {
            AppSoundManager.Get().PlaySfx(Sfx.Type.sfx_item_click);
            GameObject obj = Instantiate(flashPrefab, itm.gameObject.GetComponent <RectTransform>().position, Quaternion.identity) as GameObject;
            obj.transform.SetParent(transform);
            obj.GetComponent <RectTransform>().localScale = new Vector3(1f, 1f, 1f);

            if (preItemID == itm.goodTypeID)
            {
                streak++;
                if (streak >= 2)
                {
                    showStreak(itm, streak);
                }
            }
            else
            {
                if (streak >= 2)
                {
                    addPoints(calculatePointForStreak());
                }
                streak = 1;
            }

            preItemID = itm.goodTypeID;

            itm.fadeOut();
            foundItems += 1;
            if (foundItems >= itemsForFind)
            {
                if (streak >= 2)
                {
                    addPoints(calculatePointForStreak());
                    streak = 1;
                }
                StartCoroutine(winGame());
            }
        }
    }
 void Awake()
 {
     if (_instance != null && _instance != this)
     {
         Debug.LogWarning("Destroy previous create sound manager");
         GameObject.Destroy(_instance.gameObject);
     }
     _instance = this;
     createChannels();
     pausedChannels = new List <AudioSource>();
     isPaused       = false;
     onFadeoutMusic = false;
 }
예제 #14
0
    public void loseGame(bool isTime = false, GameObject obj = null)
    {
        if (!mStartedGameplay)
        {
            return;
        }

        AppSoundManager.Get().StopMusic();
        if (data.highScore < currentScores)
        {
            data.highScore = currentScores;
            data.save();
            UM_GameServiceManager.instance.SubmitScore(leaderBoardId, (int)currentScores);
        }
        if (currentScores > 5000)
        {
            UM_AdManager.instance.StartInterstitialAd();
        }
        mStartedGameplay = false;

        if (isTime)
        {
            AppSoundManager.Get().PlaySfx(Sfx.Type.sfx_time_over);
            gameOverViewTime.SetActive(true);

            for (int i = 0; i < items.Count; i++)
            {
                if (items[i].GetComponent <Item>().type != Item.Type.good)
                {
                    //objPool.push(items[i]);
                    items[i].GetComponent <Item>().hideItem();
                }
            }

            StartCoroutine(onGameOver());
        }
        else
        {
            for (int i = 0; i < items.Count; i++)
            {
                if (items[i] != obj)
                {
                    //objPool.push(items[i]);
                    items[i].GetComponent <Item>().hideItem();
                }
            }
            StartCoroutine(gameOverByClick());
        }
    }
예제 #15
0
    public void  OnMusicTick()
    {
        data.music = !data.music;
        data.save();

        AppSoundManager.MuteSfx   = !data.music;
        AppSoundManager.MuteMusic = !data.music;
        AppSoundManager.Get().PlaySfx(Sfx.Type.sfx_btn_click);

//		if(data.music)
//			AppSoundManager.Get ().PlayMusic(Music.Type.game);
//		else
//			AppSoundManager.Get ().StopMusic ();

        setMusicImg();
    }
예제 #16
0
    public void loseGame(bool isTime = false, GameObject obj = null)
    {
        if (!mStartedGameplay)
        {
            return;
        }

        AppSoundManager.Get().StopMusic();
        if (data.highScore < currentScores)
        {
            data.highScore = currentScores;
            data.save();
        }
        mStartedGameplay = false;

        if (isTime)
        {
            AppSoundManager.Get().PlaySfx(Sfx.Type.sfx_time_over);
            gameOverViewTime.SetActive(true);

            for (int i = 0; i < items.Count; i++)
            {
                if (items[i].GetComponent <Item>().type != Item.Type.good)
                {
                    //objPool.push(items[i]);
                    items[i].GetComponent <Item>().hideItem();
                }
            }

            StartCoroutine(onGameOver());
        }
        else
        {
            for (int i = 0; i < items.Count; i++)
            {
                if (items[i] != obj)
                {
                    //objPool.push(items[i]);
                    items[i].GetComponent <Item>().hideItem();
                }
            }
            StartCoroutine(gameOverByClick());
        }

        PlayGamesPlatform.Instance.ReportScore(data.highScore, Config.borderId, (bool succes) => {});
    }
예제 #17
0
    public void onTimeClick()
    {
        if (currentTimeBreakers <= 0)
        {
            return;
        }

        AppSoundManager.Get().PlaySfx(Sfx.Type.sfx_refresh_click);
        currentTimeBreakers -= 1;
        int count = items.Count;

        for (int i = 0; i < count; i++)
        {
            items[i].GetComponent <Item>().resetTime();
        }

        showTimeBreakers();
        timeBreakerAnimator.Play("useTimeBreakerPoints", 0, 0f);
    }
예제 #18
0
 public void OnBtnPress()
 {
     state = !state;
     if (type == Type.MUSIC)
     {
         if (state)
         {
             Debug.Log("Music On");
             setOnImg();
             AppSoundManager.MuteMusic = false;
             GameData.Get().music = true;
             GameData.Get().save();
         }
         else
         {
             setOffImg();
             Debug.Log("Music OFF");
             AppSoundManager.MuteMusic = true;
             GameData.Get().music = false;
             GameData.Get().save();
         }
     }
     else
     {
         if (state)
         {
             setOnImg();
             Debug.Log("SFX On");
             AppSoundManager.MuteSfx = false;
             GameData.Get().sfx = true;
             GameData.Get().save();
         }
         else
         {
             setOffImg();
             Debug.Log("SFX OFF");
             AppSoundManager.MuteSfx = true;
             GameData.Get().sfx = false;
             GameData.Get().save();
         }
     }
     AppSoundManager.Get().PlaySfx(Sfx.Type.sfx_click);
 }
예제 #19
0
    public void showScreenBetweenLvl()
    {
        if (streakInGame < 7)
        {
            return;
        }

        betweenLvlvAnimator.gameObject.SetActive(true);

        AppSoundManager.Get().PlaySfx(Sfx.Type.sfx_streak);
        if (streakInGame >= 7 && streakInGame < 9)
        {
            betweenLvlvAnimator.Play("good", 0, 0f);
        }
        else if (streakInGame >= 9 && streakInGame < 11)
        {
            betweenLvlvAnimator.Play("perfect", 0, 0f);
        }
        else if (streakInGame >= 11)
        {
            betweenLvlvAnimator.Play("exelent", 0, 0f);
        }
    }
예제 #20
0
 public void setCurrentSpritesKit(int id)
 {
     AppSoundManager.Get().PlaySfx(Sfx.Type.sfx_btn_click);
     data.spritesId = id;
     data.save();
 }
예제 #21
0
 public void OnRateClick()
 {
     AppSoundManager.Get().PlaySfx(Sfx.Type.sfx_btn_click);
     UniRate.Instance.PromptIfNetworkAvailable();
 }
예제 #22
0
 public void OnHighScoreClick()
 {
     AppSoundManager.Get().PlaySfx(Sfx.Type.sfx_btn_click);
     PlayGamesPlatform.Instance.ShowLeaderboardUI(Config.borderId);
 }
예제 #23
0
 public void OnPlayClick()
 {
     AppSoundManager.Get().PlaySfx(Sfx.Type.sfx_btn_click);
     GameObject.Find("AdvertsManager").GetComponent <AdvertsManager> ().HideBaner();
     GoTo.LoadGame();
 }
예제 #24
0
 public void OnExitClick()
 {
     AppSoundManager.Get().PlaySfx(Sfx.Type.sfx_btn_click);
     Application.Quit();
     Debug.Log("exit");
 }
예제 #25
0
    public void switchCamera()
    {
        AppSoundManager.Get().PlaySfx(Sfx.Type.sfx_click);
        var BikeScript = (BikeControl)target.GetComponent <BikeControl>();

        camera.fieldOfView = Mathf.Clamp(BikeScript.speed / 10.0f + 60.0f, 60, 90.0f);

        if (BikeScript.curTorque == BikeScript.bikeSetting.shiftPower)
        {
            //transform.GetComponent<MotionBlur>().blurAmount = Mathf.Lerp(transform.GetComponent<MotionBlur>().blurAmount, 1.0f, Time.deltaTime * 5);
        }
        else
        {
            //transform.GetComponent<MotionBlur>().blurAmount = Mathf.Lerp(transform.GetComponent<MotionBlur>().blurAmount, 0.0f, Time.deltaTime);
        }
        Switch++;
        if (Switch > cameraSwitchView.Length)
        {
            Switch = 0;
        }
        if (Switch == 0)
        {
            if (BikeScript.currentGear == 0 && BikeScript.speed > 2)
            {
                backAngle = 180;
            }
            else
            {
                backAngle = 0;
            }


            float yAngle = Mathf.SmoothDampAngle(transform.eulerAngles.y,
                                                 target.eulerAngles.y + backAngle, ref yVelocity, smooth);

            /*
             * float xAngle = Mathf.SmoothDampAngle(transform.eulerAngles.x,
             * target.eulerAngles.x + Angle, ref xVelocity, smooth);
             */


            // Position at the target
            Vector3 position = target.position;
            // Then offset by distance behind the new angle
            position += Quaternion.Euler(0, yAngle, 0) * new Vector3(0, 0, -distance);
            // Apply the position
            //  transform.position = position;

            // Look at the target
            transform.eulerAngles = new Vector3(Angle, yAngle, 0);

            var direction      = transform.rotation * -Vector3.forward;
            var targetDistance = AdjustLineOfSight(target.position + new Vector3(0, haight, 0), direction);



            transform.position = target.position + new Vector3(0, haight, 0) + direction * targetDistance;
        }
        else
        {
            transform.position = cameraSwitchView[Switch - 1].position;
            transform.rotation = Quaternion.Lerp(transform.rotation, cameraSwitchView[Switch - 1].rotation, Time.deltaTime * 10.0f);
        }
    }
 public static AppSoundManager Get()
 {
     if (_instance == null)
     {
         GameObject go = new GameObject("SoundManager");
         go.transform.position = new Vector3(100,100,100);
         _instance = go.AddComponent<AppSoundManager>();
     }
     return _instance;
 }
 void Awake()
 {
     if (_instance != null && _instance != this)
     {
         Debug.LogWarning("Destroy previous create sound manager");
         GameObject.Destroy(_instance.gameObject);
     }
     _instance = this;
     createChannels();
     pausedChannels = new List<AudioSource>();
     isPaused = false;
     onFadeoutMusic = false;
 }
예제 #28
0
 public void OnBuyClick()
 {
     AppSoundManager.Get().PlaySfx(Sfx.Type.sfx_btn_click);
     billing.unlockKit(onBuy);
 }
예제 #29
0
 public void onGamePress()
 {
     AppSoundManager.Get().PlaySfx(Sfx.Type.sfx_click);
     loadScreen.SetActive(true);
     GoTo.LoadEnvironmentChoose();
 }
예제 #30
0
    public void onMenuClick()
    {
        AppSoundManager.Get().PlaySfx(Sfx.Type.sfx_btn_click);

        GoTo.LoadMenu();
    }
예제 #31
0
 public void onMenuClick()
 {
     AppSoundManager.Get().PlaySfx(Sfx.Type.sfx_btn_click);
     GameObject.Find("AdvertsManager").GetComponent <AdvertsManager> ().ShowBaner();
     GoTo.LoadMenu();
 }
예제 #32
0
 public void OnBuyClick()
 {
     AppSoundManager.Get().PlaySfx(Sfx.Type.sfx_btn_click);
 }