예제 #1
0
        // Player walks in field of view of NPC
        public void OnTriggerEnter2D(Collider2D player)
        {
            if (!hasTriggered)
            {
                Handheld.Vibrate();
                hasTriggered = true;
                PlayerMovement.Inst.StopMoving();

                // Pop up notification chat bubble
                notificaiton.enabled = true;

                // Set character sprite and slide in
                UIManager.Inst.StartMessage(null, UIManager.Inst.characterSlideIn(largeCharacerSprite));

                // Starting dialogue
                foreach (string message in preBattleDialogue)
                {
                    UIManager.Inst.StartNPCMessage(message, NPCName);
                }

                // Set Opp Delt stats
                foreach (DeltemonClass oppDelt in oppDelts)
                {
                    // Set stats for oppDelts at runtime if not customized in inspector
                    if (!customDeltPosse)
                    {
                        oppDelt.initializeDelt();
                    }

                    // So opp Delts do not alter move prefabs
                    foreach (MoveClass move in oppDelt.moveset)
                    {
                        Instantiate(move, oppDelt.transform);
                    }
                }
                UIManager.Inst.StartMessage(null, UIManager.Inst.characterSlideOut(), () => UIManager.Inst.StartTrainerBattle(this, isGymLeader));
                UIManager.Inst.StartMessage(null, null, () => notificaiton.enabled = false);
            }
        }
예제 #2
0
    void Update()
    {
        if (!Input.GetMouseButtonDown(0))
        {
            return;
        }

        RaycastHit hit;
        Ray        ray = GetComponent <Camera>().ScreenPointToRay(Input.mousePosition);

        if (Physics.Raycast(ray, out hit))
        {
            Transform objectHit = hit.transform;   {
                if (!(objectHit.gameObject.tag == "box"))
                {
                    return;
                }

                //             objectHit.gameObject.SetActive(false);
                StartCoroutine(ScaleDownAnimation(objectHit, 1.0f));
                if (debug)
                {
                    debug.text = objectHit.gameObject.ToString();
                }

                removed++;
                Handheld.Vibrate();
                source.PlayOneShot(soundClip, 1.0f);


                if (removed >= 3)
                {
                    waypoint.Visited = true;
                    waypoint.Enabled = false;
                }
            }
        }
    }
예제 #3
0
    public void Reset()
    {
        //destroy track
        if (!gameObject.GetComponent <AI>())
        {
            Handheld.Vibrate();
        }
        for (int i = 0; i < m_laidTrack.Count; ++i)
        {
            Destroy(m_laidTrack[m_laidTrack.Count - 1 - i], i / 20.0f);
        }

        //reset trail length
        trailLengthCount = 0;

        //drop gold

        /*while (m_goldCount > 0)
         * {
         *  Instantiate(grid.m_goldPrefab, new Vector3((int)transform.position.x, (int)transform.position.y, (int)transform.position.z), Quaternion.identity);
         *  m_goldCount--;
         *  UpdateGoldCountText();
         * }*/
        //clear list
        m_laidTrack.Clear();

        //reset position
        grid.ResetTiles(playerNumber);
        direction = startDirection;
        gameObject.transform.position = startingNode.position;
        currentNode = startingNode;
        path.Clear();
        path.Add(currentNode);
        pathIndex = 1;
        //m_goldCount = 0;
        wallHit = false;
        UpdateGoldCountText();
    }
예제 #4
0
    IEnumerator False()
    {
        Handheld.Vibrate();
        maytimerrun = false;
        isdied      = true;
        gameover.SetActive(false);
        aftergameover.SetActive(true);

        if (LevelsDataBase.isTaskString == true)
        {
            right_answer_after_gameover.text = LevelsDataBase.right_answer_string;
        }

        else
        {
            right_answer_after_gameover.text = LevelsDataBase.right_answer.ToString();
        }

        Instantiate(effect, effectpoint_gameover.position, Quaternion.identity);
        yield return(new WaitForSeconds(2.5f));

        if (Convert.ToInt32(MyDataBaseConnection.ExecuteQueryWithAnswer($"SELECT isRevivalBonusActive FROM Shop WHERE id = {CurrentUser};")) == 1)
        {
            revival_bonus_panel.SetActive(true); //Если есть бонус возрождения, откроется окошко с предложением использовать его
        }

        else
        {
            gameover.SetActive(true);

            if (isrecord == true)
            {
                record_panel_after.SetActive(true);
            }
        }

        aftergameover.SetActive(false);
    }
예제 #5
0
    // Update is called once per frame
    private void Update()
    {
        if (GameManager.Instance == null)
        {
            return;
        }

        if (life <= 0 && isDead == false)
        {
            Handheld.Vibrate();
            source.PlayOneShot(deadSound);
            GameManager.Instance.GameOver();
            isDead = true;
        }
        else
        {
            if (!GameManager.Instance.pause)
            {
                GroundEffect();
                if (IsGrounded() && (Input.GetKeyDown(KeyCode.Space) || Input.GetMouseButtonDown(0)))
                {
                    rigidbody.AddForce(Vector2.up * jampHight, ForceMode2D.Impulse);
                    animator.SetBool("jump", true);

                    if (jampSound != null)
                    {
                        source.PlayOneShot(jampSound);
                        Handheld.Vibrate();
                    }
                }
                else
                {
                    animator.SetBool("jump", false);
                }
                //rotObj.transform.eulerAngles = new Vector3 (0, 0, rigidbody.velocity.y * dirMultipl);
            }
        }
    }
예제 #6
0
    void OnCollisionEnter(Collision col)
    {
        //camera.transform.DOShakePosition(2, Vector3.one, 10, 90);
        Handheld.Vibrate();
        if (col.gameObject.tag == "outline")
        {
            this.AudioSource.PlayOneShot(SoundEffectsInGame.soundEffects[6], 0.1f);
            if (gameObject.transform.parent.name == "StoryMode1")
            {
                timer.HadSuccess = 1;
                camera.transform.DOMove(new Vector3(0.2799f, -1.010172f, 7.6226f), 2.0f);
                camera.transform.DORotate(new Vector3(0, 0, 0), 2.0f);
                Camera.main.orthographic     = true;
                Camera.main.orthographicSize = 4.2f;
                transform.GetComponent <Rigidbody>().velocity = Vector3.zero;
            }

            if (gameObject.transform.parent.name == "StoryMode2")
            {
                timer.HadSuccess = 1;
                camera.transform.DOMove(new Vector3(138.3961f, -954.5437f, 12.21743f), 2.0f);
                camera.transform.DORotate(new Vector3(0, 0, 0), 2.0f);
                Camera.main.orthographic     = true;
                Camera.main.orthographicSize = 3.47f;
                transform.GetComponent <Rigidbody>().velocity = Vector3.zero;
            }

            if (gameObject.transform.parent.name == "StoryMode3")
            {
                timer.HadSuccess = 1;
                camera.transform.DOMove(new Vector3(138.4361f, -954.6637f, 15.5594f), 2.0f);
                camera.transform.DORotate(new Vector3(0, 0, 0), 2.0f);
                Camera.main.orthographic     = true;
                Camera.main.orthographicSize = 3.5f;
                transform.GetComponent <Rigidbody>().velocity = Vector3.zero;
            }
        }
    }
예제 #7
0
    void Collide_Left()
    {
        bLeftCollide = true;
        //transform.position +=  Vector3.left * (2.5f);
        transform.Translate(-Vector3.left * (1.5f), Space.Self);
        transform.Translate(-Vector3.forward * (2.0f), Space.Self);
        Debug.Log("Collide_Left");



                #if UNITY_ANDROID
        Handheld.Vibrate();
                #endif

        BGMPlayer_Play("dead", null, false);


        if (bLeftCollide == true && bRightCollide == true)
        {
            Debug.Log("Collide LR-L");
            //transform.position+=  Vector3.forward*(4.0f);
            transform.Translate(-Vector3.forward * (2.0f), Space.Self);
            //Speed = Speed_LowLimit-1;
            Speed = 0;

            Speed_SlowDown();
            return;
        }


        Vector3 eulerAngles = transform.eulerAngles;
        eulerAngles.y        += 15;
        transform.eulerAngles = eulerAngles;



        Speed_SlowDown();
    }
예제 #8
0
        static Vibration()
        {
            // Trick Unity into giving the App vibration permission when it builds.
            // This check will always be false, but the compiler doesn't know that.
            if (Application.isEditor)
            {
                Handheld.Vibrate();
            }

            if (!IsAndroid())
            {
                return;
            }

            using (var version = new AndroidJavaClass("android.os.Build$VERSION"))
            {
                Sdk = version.GetStatic <int>("SDK_INT");
            }

            Vibrator = new AndroidJavaClass("com.unity3d.player.UnityPlayer")      // Get the Unity Player.
                       .GetStatic <AndroidJavaObject>("currentActivity")           // Get the Current Activity from the Unity Player.
                       ?.Call <AndroidJavaObject>("getSystemService", "vibrator"); // Then get the Vibration Service from the Current Activity.

            if (Vibrator != null)
            {
                VibratorPtr = Vibrator.GetRawObject();

                VibrateWithEffectMethodPtr =
                    AndroidJNI.GetMethodID(Vibrator.GetRawClass(), "vibrate", "(Landroid/os/VibrationEffect;)V");

                VibrateMethodPtr = AndroidJNI.GetMethodID(Vibrator.GetRawClass(), "vibrate", "(J)V");
            }

            if (Sdk >= MinSdkForVibrationEffect)
            {
                VibrationEffectClass = new AndroidJavaClass("android.os.VibrationEffect");
            }
        }
예제 #9
0
    public void PontuarNotaComum(Nota nota, Player p)
    {
        if (nota.kill)
        {
            return;
        }

        nota.kill = true;

        if (Vivaldos.VIBRAR)
        {
            Handheld.Vibrate();
        }

        int pontuacaoAtual = p.mInfo.pontuacao;

        p.mInfo.pontuacao += pontosPorNota * multiplicador;

        notasAcertadasNaSequencia++;

        if (notasAcertadasNaSequencia >= (aCadaXNotas * multiplicador))
        {
            multiplicador += 1;
            multiplicador  = Mathf.Clamp(multiplicador, 1, maxMultiplicador);
        }
        acertos++;

        pontuacao = p.mInfo.pontuacao;

        if (p.mInfo.pontuacao == pontuacaoAtual)
        {
            return;
        }

        Atualizar(p.mInfo.pontuacao, 0, multiplicador);

        AtualizarErrosEAcertos();
    }
예제 #10
0
    public IEnumerator FillBlank()
    {
        //Debug.Log("touchLetter=" + touchLetter);
        //Debug.Log("gameComponent.letterUILabel.text=" + gameComponent.letterUILabel.text);
        //Debug.Log("g.texName=" + g.texName);
        //Debug.Log("blankPos[correctPos]=" + blankPos[correctPos] + " correctPos=" + correctPos);

        touchLetter = gameComponent.letterUILabel.text[0];
        // correct
        if (touchLetter == g.texName [blankPos[correctPos]])
        {
            tempTexName  = g.texName.Substring(0, blankPos[correctPos] + 1);
            blankTexName = tempTexName + blankTexName.Substring(blankPos[correctPos] + 1, blankTexName.Length - blankPos[correctPos] - 1);
            correctPos++;

            gameComponent.clickWordUILabel.text = blankTexName;

            // incorrect
        }
        else
        {
            // Vibrate
            if (g.isVibrate)
            {
                Handheld.Vibrate();
            }

            gameState.BlankInCorrect.SetActive(true);
            gameComponent.EnableGridBoxCollider(false);

            yield return(new WaitForSeconds(inCorrectPeneltyTime));

            gameState.BlankInCorrect.SetActive(false);
            gameComponent.EnableGridBoxCollider(true);

            //Debug.Log( g.texName [ blankPos[correctPos] ]  + " : " + touchLetter );
        }
    }
예제 #11
0
        //---------------------------------------------------------------------------------------------------------------
        public void VeggieClicked(Veggie veggie)
        {
            if (veggie == null)
            {
                Debug.LogError("Null veggie came trough Veggie clicked event");
                return;
            }

            if (veggie.IsVanished)
            {
                return;
            }

            SingleTask task = this.Tasks.FirstOrDefault(t => !t.Fulfilled && t.Model.IsEqual(veggie.CurrentModel));


            if (task == null)
            {
                this.WrongClick(veggie);
                return;
            }

            veggie.Vanish();
            task.MakeFulfilled();
            Game.Settings.SessionMoney = Game.Settings.SessionMoney + DefaultContent.DefaultTargetReward;

            if (Game.Settings.VibrationEnabled)
            {
                Handheld.Vibrate();
                Game.TimerManager.Start(0.3f, Handheld.Vibrate);
            }
            Game.AudioManager.PlaySound(AudioId.PositiveClick16);

            if (!this.HasMoreTasks)
            {
                Game.TimerManager.Start(0.35f, () => { Game.Events.GameWon.Invoke(); });
            }
        }
예제 #12
0
    IEnumerator TimerText(float s)
    {
        float  _inputSeconds = s;                       //saving seconds to temp variable
        string minSec;                                  //string variable for building timer's text
        bool   sound = true;

        while (true)
        {                                               //converting from sec to min:sec
            minSec = string.Format("{0}' {1:00}\"",
                                   Mathf.Floor(_inputSeconds / 60), _inputSeconds % 60);
            timerText.text = minSec;                    //displaying min:sec time on screen
            yield return(new WaitForSecondsRealtime(1));

            _inputSeconds--;                            //counting down
            if (_inputSeconds <= 1 && sound)
            {
                audioSource.Play(0);                    //playing sound 1 sec before timer goes to
                Handheld.Vibrate();                     //zero, so sound comes first :)
                sound = false;                          //preventing sound to play again
            }

            if (_inputSeconds < 0 && useRepositionTime)  //if we have reposition on adding 5 sec
            {                                            //between timers
                _inputSeconds = 5;
                for (int i = 0; i < _inputSeconds; i++)
                {
                    yield return(new WaitForSecondsRealtime(1));
                }
                _inputSeconds = s;                      //setting number of seconds to initial value
                sound         = true;                   //and enabling sounds
            }
            else if (_inputSeconds < 0)
            {
                _inputSeconds = s;                      //setting number of seconds to initial value
                sound         = true;                   //and enabling sounds
            }
        }
    }
예제 #13
0
    private void OnCollisionEnter2D(Collision2D collision)
    {
        //Çarpışma olduğunda yapılacaklar
        if (collision.gameObject.tag == interactive_object.gameObject.tag)
        {
            if (interactive_object.gameObject.tag == "Peanut")
            {
                scene.SetActive(true);
                btn_restart.gameObject.SetActive(false);
                btn_next.gameObject.SetActive(true);

                finish_text.text  = "BASARDINIZ !";
                finish_text.color = Color.green;
                GameObject fistik = GameObject.Find("Peanut");
                Destroy(fistik);
                Debug.Log("peanut");
                LevelSave();
            }

            else if (interactive_object.gameObject.tag == "Elephant")
            {
                scene.SetActive(true);
                btn_next.gameObject.SetActive(false);
                btn_restart.gameObject.SetActive(true);
                finish_text.text  = "BASARAMADINIZ !";
                finish_text.color = Color.red;
                Debug.Log("Duvar");
            }
            //Seviye kayıt işlemi
            Destroy(interactive_object);
            gamesettings = JsonUtility.FromJson <GameSettings>(File.ReadAllText(Application.persistentDataPath + "/gamesettings.json"));

            if (gamesettings.vibration)
            {
                Handheld.Vibrate();
            }
        }
    }
    ///<summary>
    /// Only on Android
    /// https://developer.android.com/reference/android/os/Vibrator.html#vibrate(long)
    ///</summary>
    public static void Vibrate(long milliseconds)
    {
        if (Application.isMobilePlatform)
        {
#if !UNITY_WEBGL
#if UNITY_ANDROID
            if (AndroidVersion >= 26)
            {
                AndroidJavaObject createOneShot = vibrationEffect.CallStatic <AndroidJavaObject> ("createOneShot", milliseconds, -1);
                vibrator.Call("vibrate", createOneShot);
            }
            else
            {
                vibrator.Call("vibrate", milliseconds);
            }
#elif UNITY_IOS
            Handheld.Vibrate();
#else
            Handheld.Vibrate();
#endif
#endif
        }
    }
예제 #15
0
 // Fireball collisons - player loses a heart
 void OnTriggerEnter(Collider other)
 {
     if (other.gameObject.tag == "Fireball")
     {
         if (!isInPowerupMode)
         {
             UIController.singleton.DecrementHeart();
             Sounds.singleton.PlayIncorrectColorSound();
             if (Sounds.singleton.GetSoundsAreOn())
             {
                 Handheld.Vibrate();
             }
             CameraAnimationsController.singleton.ShakeCamera();
         }
         else
         {
             ActivateFireballDeathParticleSystem(other.transform.position);
             Destroy(other.gameObject);
             Sounds.singleton.PlayCorrectColorSound();
             PlayerPrefsController.singleton.SetCurrentAmountOfAchievementByAchievementType("Demolishers");
         }
     }
 }
예제 #16
0
 private void OnTriggerEnter(Collider other)
 {
     if (other.CompareTag("Player"))
     {
         SoundManager.Instance.playAudio(AudioType.bump);
         Handheld.Vibrate();
         cameraScript.Shake();
         gameObject.SetActive(false);
         for (int i = 0; i < explosionCubeAmount; i++)
         {
             explosionCubePool.spawnObject(transform.position, 0, 2);
         }
         if (!player)
         {
             player = other.GetComponent <Player>();
         }
         if (player)
         {
             player.shedCube();
             player.rb.AddForce(-transform.forward * player.rb.velocity.z * 2, ForceMode.Impulse);
         }
     }
 }
예제 #17
0
 public static void Vibrate(long milliseconds)
 {
     if (apiLevel >= 26)
     {
         vibrationEffectClass = new AndroidJavaClass("android.os.VibrationEffect");
         defaultAmplitude     = vibrationEffectClass.GetStatic <int>("DEFAULT_AMPLITUDE");
     }
     if (apiLevel >= 26)
     {
         CreateVibrationEffect("createOneShot", new object[] { milliseconds, defaultAmplitude });
     }
     else
     {
         if (isAndroid())
         {
             vibrator.Call("vibrate", milliseconds);
         }
         else
         {
             Handheld.Vibrate();
         }
     }
 }
예제 #18
0
        public override void OnEnterStruggle()
        {
            base.OnEnterStruggle();
            _bApplyedResult = false;
            _level.raiseHookStruggleEvent(true);
            //Calculate the time limit
            int         size     = InfoManager.Instance.GetFishInfo(_toEscapeFishes[0].ObjType).size;
            ResSizeInfo sizeInfo = InfoManager.Instance.GetSizeInfo(size);

            _fEndStruggleTime = _fHookPassTime + sizeInfo.struggleTime * 1000;
            //Randomly generate how many times does player need to tap.
            _nTapTimes = UnityEngine.Random.Range(_nFloorTapTimes, _nCeilTapTimes + 1);

            //Vibration!!
#if !UNITY_STANDALONE_WIN && !UNITY_EDITOR
            if (_level.bVibration)
            {
                Handheld.Vibrate();
            }
#endif

            _raiseEnterStruggleEvent();
        }
예제 #19
0
    // Square was created. Select all dots of given type
    public void Create(DotManager.DotType dotType)
    {
        for (int i = 0; i < board.BoardArray.Count; i++)
        {
            for (int k = 0; k < board.BoardArray[i].Count; k++)
            {
                BoardSpace    curSpace = board.BoardArray[i][k];
                DotController curDot   = curSpace.GetCurrentDot();
                if (curDot.GetDotType().typeID == dotType.typeID)
                {
                    curDot.Select();

                    // only add to our toScore list once
                    if (!squareCreated)
                    {
                        toScore.Add(curSpace);
                    }
                }
            }
        }
        squareCreated = true;
        Handheld.Vibrate();
    }
예제 #20
0
        /// <summary>
        /// When player hit by player
        /// </summary>
        /// <param name="collision"></param>
        private void OnCollisionEnter2D(Collision2D collision)
        {
            var enemyBullet = collision.gameObject.GetComponent <TagAssigner>()?.AssignedTag;

            if (enemyBullet != null && enemyBullet == TagAssigner.Tag.EnemyBullet)
            {
                _playerLive--;
                Handheld.Vibrate();
            }
            else if (enemyBullet != null && enemyBullet == TagAssigner.Tag.Enemy)
            {
                _playerLive = 0;
                Handheld.Vibrate();
            }

            if (_playerLive <= 0)
            {
                _isPlayerDead = true;

                // End Game
                PlayerStateController(true);
            }
        }
예제 #21
0
    public void AddGameOver()
    {
        //cameraParent.GetComponent<CameraController>().enabled = false;
        cameraParent.transform.parent = playerParent.transform;;
        Physics.IgnoreLayerCollision(playerObject, collideObject, true);
        playerParent.GetComponent <SphereCollider>().isTrigger = false;
        BrokePlatform.SetActive(true);
        PlayerPrefs.SetInt("BoolGameOver", 0);
        PlayerPrefs.SetInt("Loser", Loser += 1);
        Handheld.Vibrate();
        FBanalytic.Instanse.LevelLose(Loser);



        if (playerParent.GetComponent <Rigidbody>().velocity.y < 0)
        {
            eggFall.Play();
        }



        BigPlatform.GetComponent <Platform>().enabled = false;
    }
예제 #22
0
 public void Thrust()
 {
     if (burning)
     {
         if (fuel >= burnRate)
         {
             rb.AddForce(Vector3.Normalize(rb.transform.right) * thrust, ForceMode.Acceleration);
             flame.Play();
             Handheld.Vibrate();
             fuel -= burnRate;
             print("fuel remaining " + fuel);
         }
         else
         {
             print("Out of fuel");
             flame.Stop();
         }
     }
     else
     {
         flame.Stop();
     }
 }
예제 #23
0
 void OnTriggerEnter2D(Collider2D col)
 {
     if (col.gameObject.tag == "Ground")
     {
         if (rb.velocity.magnitude > 799 && ad.inAir == true)
         {
             #if !UNITY_EDITOR
             Handheld.Vibrate();
             #endif
             rb.velocity = Vector2.zero;
             gp.GameOver();
         }
     }
     else if (col.gameObject.tag == "Coin")
     {
         gp.AddCoin();
         Destroy(col.gameObject);
     }
     else if (col.gameObject.tag == "Switcher")
     {
         SwitchColor();
     }
 }
예제 #24
0
 /* Notify server that player has left the station */
 public void goBack()
 {
     Handheld.Vibrate();
     if (Client.gameState.Equals(ClientGameState.MainMode))
     {
         player = GameObject.Find("Player").GetComponent <Player>();
         player.notifyAboutStationLeft();
         SceneManager.LoadScene("PlayerMainScreen");
     }
     else if (FoodData.Instance.isChoppable(ingredient))     /* Set the mode to the next step of the tutorial */
     {
         Client.gameState = ClientGameState.ChoppingTutorial;
         SceneManager.LoadScene("PlayerMainScreen");
     }
     else if (ingredient.Name != "potato")
     {
         infoPanel.SetActive(true);
         fadeBackground.SetActive(true);
         imageTargetCupboard.SetActive(false);
         imageTargetFridge.SetActive(false);
         infoText.text = "Make sure you grab \n a potato before leaving!";
     }
 }
예제 #25
0
 private void OnDestroy()
 {
     if (paleFlag == false && Game2Manager.instance.quitSceneFlag == false)
     { //상하지 않았는데 파괴되면, 먹힌것으로 가정하여 현재 위치에 점수를 띄우고, 점수를 합산한다.
         Vector3    pos   = transform.position;
         Quaternion angle = Quaternion.Euler(0, 0, 0);
         if (myScore > 0)
         {
             GameObject explode = (GameObject)Instantiate(explosion, pos + new Vector3(0, 3, 1), angle);
             Sound2Manager.instance.EatGoodSound();
         }
         else
         {
             GameObject explode = (GameObject)Instantiate(explosion, pos + new Vector3(0, 3, 1), angle);
             Game2Manager.instance.badFlag = true;
             Handheld.Vibrate();
             Sound2Manager.instance.EatBadSound();
             Bar2Script.instance.TimePanelty(1);
         }
         GameObject score = (GameObject)Instantiate(Score, pos + new Vector3(0, 2, 0), angle);
         Game2Manager.instance.AddScore(myScore);
     }
 }
예제 #26
0
 // Update is called once per frame
 void FixedUpdate()
 {
     if (transform.position.sqrMagnitude >= killY)
     {
         Destroy(gameObject);
     }
     if (touch != -1)
     {
         Handheld.Vibrate();
         damage += Time.fixedDeltaTime * 5f;
         if (damage >= size)
         {
             Bang();
         }
     }
     else if (animator.GetCurrentAnimatorStateInfo(0).IsName("hold"))
     {
         animator.Play("idle");
         //Debug.Log("Fix");
     }
     //bangTime -= Time.fixedDeltaTime;
     //if (bangTime <= 0f) Bang();
 }
예제 #27
0
    void OnTriggerEnter(Collider other)
    {
        if (other.gameObject.CompareTag("POI"))
        {
            var poi = other.GetComponent <POIMarker>().data;

            InfoBoxLayout.instance.OpenInfoBoxWithPOI(poi);

            //Shake Device
            Handheld.Vibrate();

            if (other.gameObject.transform.childCount == 0)
            {
                return;
            }

            Transform child = other.gameObject.transform.GetChild(0);
            if (child != null)
            {
                child.GetComponent <Renderer>().material.color = Color.green;
            }
        }
    }
예제 #28
0
    private void StartScanner()
    {
        BarcodeScanner.Scan((barCodeType, barCodeValue) => {
            BarcodeScanner.Stop();
            if (TextHeader.text.Length > 250)
            {
                TextHeader.text = "";
            }
            TextHeader.text += "Found: " + barCodeType + " / " + barCodeValue + "\n";
            RestartTime     += Time.realtimeSinceStartup + 1f;

            // Feedback
            Audio.Play();

                        #if UNITY_ANDROID || UNITY_IOS
            Handheld.Vibrate();
                        #endif

            //tempQrValue = barCodeValue;

            UpdateStartPos(barCodeValue);
        });
    }
예제 #29
0
        void OnTriggerEnter2D(Collider2D collider)
        {
            if (collider.gameObject.name == "puck")
            {
                collider.gameObject.GetComponent <Rigidbody2D>().transform.position = new Vector2(0, 1.9f);

                puck.SetActive(false);
                Invoke("ResetPuckplayer", 0.75f);
                Invoke("rest", 1f);
                Invoke("issettriggerr", 1.5f);
                Invoke("rest1", 1.6f);
                GameControler.Increment(GameControler.Score.PlayerScore);
                GetComponent <AudioSource>().PlayOneShot(goalsound);
                particel.SetActive(true);
                Invoke("Activate", 0.5f);
                playerGoal.SetActive(true);
                Invoke("ActivateAi", 0.5f);
                if (PlayerPrefsManager.Instance.Vibrate)
                {
                    Handheld.Vibrate();
                }
            }
        }
예제 #30
0
    private void StartScanner()
    {
        BarcodeScanner.Scan((barCodeType, barCodeValue) => {
            BarcodeScanner.Stop();
            if (TextHeader.text.Length > 250)
            {
                TextHeader.text = "";
            }
            print("Found: " + barCodeType + " / " + barCodeValue + "\n");
            TextHeader.text = barCodeValue;
            RestartTime    += Time.realtimeSinceStartup + 1f;

            // Feedback
            //Audio.Play();



            transform.parent.gameObject.SetActive(false);
                        #if UNITY_ANDROID || UNITY_IOS
            Handheld.Vibrate();
                        #endif
        });
    }