Пример #1
0
 private void _off()
 {
     if (m_LastTouch == this)
     {
         m_LastTouch = null;
     }
 }
Пример #2
0
    // プレイヤーがタッチしている敵を取得.タッチしていなければ -1 が返る
    public int checkTouchEnemy(bool is_long_touch)
    {
        BattleTouchInput battle_touch_input = BattleTouchInput.Instance;
        bool             triger             = false;

        if (is_long_touch)
        {
            triger = battle_touch_input.isTouching() && battle_touch_input.isDrag() == false && battle_touch_input.getTouchingTime() >= 0.5f;
        }
        else
        {
            triger = battle_touch_input.isTapped();
        }

        if (triger)
        {
            BattleScene.FieldCollision field_collision = GetComponent <BattleScene.FieldCollision>();
            if (field_collision != null)
            {
                if (field_collision.IsMouseOver)
                {
                    Vector2 mouse_position = battle_touch_input.getPosition();
                    float   dist_sqr_min   = 1.0e+30f;
                    int     touch_index    = -1;
                    for (int idx = 0; idx < m_EnemyObjectViewControls.Length; idx++)
                    {
                        BattleEnemyObjectViewControl enemy_view_control = m_EnemyObjectViewControls[idx];
                        if (enemy_view_control != null)
                        {
                            Vector3 enemy_screen_position = battle_touch_input.getScreenPosition(enemy_view_control.m_TargetCursorObject.transform.position);
                            Vector2 dir      = mouse_position - new Vector2(enemy_screen_position.x, enemy_screen_position.y);
                            float   dist_sqr = dir.sqrMagnitude;
                            if (dist_sqr < dist_sqr_min)
                            {
                                dist_sqr_min = dist_sqr;
                                touch_index  = idx;
                            }
                        }
                    }
                    return(touch_index);
                }
            }
        }

        return(-1);
    }
Пример #3
0
    /// <summary>
    /// 敵領域をタップしたかどうか(カウントダウン短縮の判定で使用)
    /// </summary>
    /// <returns></returns>
    public bool isTappedEnemyArea()
    {
        BattleTouchInput battle_touch_input = BattleTouchInput.Instance;

        if (battle_touch_input.isDeviceTouchTriger() &&
            battle_touch_input.isOverrideTouchMode() == false
            )
        {
            BattleScene.FieldCollision field_collision = GetComponent <BattleScene.FieldCollision>();
            if (field_collision != null)
            {
                if (field_collision.IsMouseOver)
                {
                    return(true);
                }
            }
        }

        return(false);
    }
Пример #4
0
 void OnMouseOver()
 {
     m_LastTouch = this;
 }