Пример #1
0
 /// <summary>
 /// 押された
 /// </summary>
 /// <param name="e">PointerEventData</param>
 public void OnPointerDown(PointerEventData e)
 {
     isRunning = true;
     SetType(EventType.Pressed);
     startPos  = GodTouch.GetPosition();
     startTime = Time.time;
 }
Пример #2
0
 /// <summary>
 /// 更新処理
 /// </summary>
 void Update()
 {
     if (type == EventType.Pressed)
     {
         // 押されてる
         var pos = GodTouch.GetPosition();
         var dx  = Mathf.Abs(pos.x - startPos.x);
         var dy  = Mathf.Abs(pos.y - startPos.y);
         var dt  = Time.time - startTime;
         if (dx > CheckDistance || dy > CheckDistance)
         {
             // 一定距離動いていたらドラッグ実行
             SetType(EventType.Drag);
         }
         else if (dt > CheckTime)
         {
             // 一定時間経過していたら長押し実行
             SetType(EventType.LongPress);
         }
     }
     else if (type == EventType.Drag)
     {
         // ドラッグ中(動かす)
         transform.position = GodTouch.GetPosition();
     }
 }
 void OnTriggerStay2D(Collider2D other)
 {
     if (other.tag == "enemy" || other.tag == "Boss")
     {
         var phase = GodTouch.GetPhase();
         //タッチ判定
         if (phase == GodPhase.Began)
         {
             startTime = Time.time;
         }
         else if (phase == GodPhase.Ended)
         {
             if (Time.time - startTime < CheckTime)
             {
                 //相手のDamage関数を実行する
                 if (other.tag == "enemy")
                 {
                     EnemyDamageScript Edam = other.GetComponent <EnemyDamageScript> ();
                     Edam.Damage();
                     DamageSeScript DamSEScript = this.GetComponent <DamageSeScript>();
                     DamSEScript.EmemyDamageSound();
                 }
                 else if (other.tag == "Boss")
                 {
                     BossDamageScript Bdam = other.GetComponent <BossDamageScript> ();
                     Bdam.Damage();
                     DamageSeScript DamSEScript = this.GetComponent <DamageSeScript>();
                     DamSEScript.BossDamageSound();
                 }
                 //相手がいたところにエフェクト
                 Instantiate(AttackEffect, other.transform.position, Quaternion.identity);
             }
         }
     }
 }
        // Update is called once per frame
        void Update()
        {
            //float limitHorizontal = 0.0f;
            var phase = GodTouch.GetPhase();

            if (phase == GodPhase.Began)
            {
                //タッチ開始処理
                startPos = GodTouch.GetPosition();
                //startRot = rb.transform.rotation;
            }
            else if (phase == GodPhase.Moved)
            {
                horizontal = (GodTouch.GetPosition().x - startPos.x) / width;  //横移動量(-1<tx<1)
                vertical   = (GodTouch.GetPosition().y - startPos.y) / height; //縦移動量(-1<ty<1)
                //limitVertical = Mathf.Clamp(vertical, 0.1f, 0.5f);
                //obj.transform.rotation = startRot;
                //obj.transform.Rotate(new Vector3(90 * ty, -90 * tx, 0), Space.World);
                rb.angularVelocity = new Vector3(90 * vertical, -90 * horizontal, 0);
            }
            else if (phase == GodPhase.Ended)
            {
                //タッチ終了
                Debug.Log("TouchEnded");
            }
            else
            {
                limitVertical = 0.1f;
            }

            //rb.angularVelocity = new Vector3(90 * limitVertical, -90 * horizontal, 0);
        }
 void Update()
 {
     if (fadeChecker == 9)
     {
         this.GetComponent <Image> ().color = new Color(red, green, blue, alfa);
         alfa -= Time.deltaTime;
         if (alfa <= 0)
         {
             fadeOn();
         }
     }
     else
     {
         var phase = GodTouch.GetPhase();
         if (phase == GodPhase.Began && fadeChecker == 0)
         {
             fadeIn();
             SoundWind();
             Invoke("StartPlay", 1.5f);
             Invoke("fadeOut", 2.0f);
             Invoke("fadeOff", 4.0f);
         }
         if (fadeChecker == 1)
         {
             this.GetComponent <Image> ().color = new Color(red, green, blue, alfa);
             alfa += Time.deltaTime;
         }
         else if (fadeChecker == 2)
         {
             this.GetComponent <Image> ().color = new Color(red, green, blue, alfa);
             alfa -= Time.deltaTime;
         }
     }
 }
Пример #6
0
        private void Flick()
        {
            var phase = GodTouch.GetPhase();

            if (phase == GodPhase.Began)
            {
                startPos = GodTouch.GetPosition();
            }
            if (phase == GodPhase.Ended)
            {
                endPos = GodTouch.GetPosition();
                GetDireciton();
            }
        }
        void Update()
        {
            var phase = GodTouch.GetPhase();

            if (phase == GodPhase.Began)
            {
                if ((player.activeSelf == false && title.activeSelf == false) || BossFlagControllerScript.BossFlag == 5)
                {
                    Invoke("Restart", 2.0f);
                    title.SetActive(true);
                    titleScript titleS = title.gameObject.GetComponent <titleScript>();
                    titleS.fadeIn();
                }
            }
        }
Пример #8
0
        // Update is called once per frame
        private void Update()
        {
            var phase = GodTouch.GetPhase();

            vY = -1.0f;

            //タッチされたときとあとの処理
            if (phase == GodPhase.Began)
            {
                //タッチ開始
                sPos = GodTouch.GetPosition().x;
            }
            else if (phase == GodPhase.Ended)
            {
                //タッチされた場所の開始位置と最終位置を比較して上ならspeedを上げる
                //下ならspeedを下げる
                ePos    = GodTouch.GetPosition().x;
                trigger = true;
            }

            //タッチされている間の処理
            if (phase == GodPhase.Stationary)
            {
                Debug.Log("Idle");
                vY = -0.2f;
                vX = 0f;
            }
            else if (Input.GetMouseButton(0))
            {
                Debug.Log("Idle");
                vY = -0.2f;
                vX = 0f;
            }

            if (sPos > ePos && trigger)
            {
                vX      = Mathf.Clamp(vX += 0.3f, -1.0f, 1.0f);
                trigger = false;
                Debug.Log(vX);
            }
            else if (sPos < ePos && trigger)
            {
                vX      = Mathf.Clamp(vX -= 0.3f, -1.0f, 1.0f);
                trigger = false;
                Debug.Log(vX);
            }
            rb.angularVelocity = new Vector3(vY, vZ, vX);
        }
Пример #9
0
        void Update()
        {
            var phase = GodTouch.GetPhase();

            //タッチ判定
            if (phase == GodPhase.Began)
            {
                startTime = Time.time;
            }
            else if (phase == GodPhase.Ended)
            {
                if (Time.time - startTime < CheckTime)
                {
                    AttackMitame();
                }
            }
        }
        // Update is called once per frame
        void Update()
        {
            var phase = GodTouch.GetPhase();

            if (phase == GodPhase.Began)
            {
                startPos = GodTouch.GetPosition();
                startRot = stage.transform.rotation;
            }
            else if (phase == GodPhase.Moved)
            {
                horizontal = (GodTouch.GetPosition().x - startPos.x) / width;
                vertical   = (GodTouch.GetPosition().y - startPos.y) / height;
                stage.transform.rotation = startRot;
                stage.transform.Rotate(new Vector3(90 * vertical, -90 * horizontal, 0), Space.World);
            }
        }
        void Update()
        {
            //移動処理
            player.transform.position += transform.up * playerYspeed * Time.deltaTime;

            if (player.transform.position.x <= ScreenLeft && Xcontroller < 0)
            {
                Xcontroller += 1 * Time.deltaTime;
            }
            else if (player.transform.position.x >= ScreenRight && Xcontroller > 0)
            {
                Xcontroller -= 1 * Time.deltaTime;
            }
            else
            {
                player.transform.position += transform.right * Xcontroller * playerXspeed * Time.deltaTime;
            }

            //回転処理
            player.transform.rotation = Quaternion.Euler(0, 0, Xcontroller * -80);


            var phase = GodTouch.GetPhase();

            //タッチ中
            if (phase == GodPhase.Moved)
            {
                //ドラッグの移動量でXcontrollerを変化(-1から1の中で)
                dragspeed = GodTouch.GetDeltaPosition().x / Screen.width * 2f;
                if (Xcontroller >= 1)
                {
                    Xcontroller -= 3 * Time.deltaTime;
                }
                else if (Xcontroller <= -1)
                {
                    Xcontroller += 3 * Time.deltaTime;
                }
                else
                {
                    Xcontroller += dragspeed;
                }
            }
        }
Пример #12
0
        void Update()
        {
            var phase = GodTouch.GetPhase();

            //タッチ判定
            if (phase == GodPhase.Began)
            {
                startTime = Time.time;
            }
            else if (phase == GodPhase.Ended)
            {
                if (Time.time - startTime < CheckTime)
                {
                    PlayerSEscript SEscript = this.gameObject.GetComponent <PlayerSEscript>();
                    animator.SetBool("Attack", true);
                    Invoke("AttackAnimationOFF", 0.1f);
                    SEscript.attackSound();
                }
            }
        }
Пример #13
0
        void Update()
        {
            if (ClickLongPressDrag.IsRunning)
            {
                return;                                           // 他のサンプルが動作してる時は無効
            }
            // タッチを検出して動かす
            var phase = GodTouch.GetPhase();

            if (phase == GodPhase.Began)
            {
                startPos = Move.position;
            }
            else if (phase == GodPhase.Moved)
            {
                Move.position = GodTouch.GetPosition();
//				Move.position += GodTouch.GetDeltaPosition();
            }
            else if (phase == GodPhase.Ended)
            {
                Move.position = startPos;
            }
        }