示例#1
0
 public void OnTapStop(Toucher toucher, Vector2 position)
 {
     if (CurrentState == State.Move)
     {
         CurrentState = State.Idle;
     }
 }
示例#2
0
 public void OnTapStay(Toucher toucher, Vector2 touchPos)
 {
     if (CurrentState == State.Move)
     {
         Move(touchPos);
     }
 }
示例#3
0
 public void OnDoubleTap(Toucher toucher, Vector2 position)
 {
     if ((CurrentState == State.Idle || CurrentState == State.Emotion) && toucher == _toucher)
     {
         CurrentState = State.Tickles;
     }
 }
示例#4
0
    private void Awake()
    {
        _hexMesh              = GetComponentInChildren <HexMesh>();
        _toucher              = Instantiate(_toucher);
        _toucher.TouchedCell += OnCellTouched;


        _cells = new HexCell[_width * _height];
        for (int z = 0; z < _height; z++)
        {
            for (int x = 0; x < _width; x++)
            {
                _cells[x + z * _height] = CreateCell(x, z);
                SetNeigbor(x, z);
            }
        }
        for (int z = 0; z < _height; z++)
        {
            for (int x = 0; x < _width; x++)
            {
                var cell = _cells[x + z * _height];
                cell.SetMarkText(cell.GetRealNeigborCount().ToString());
            }
        }
    }
示例#5
0
 public void OnTapStart(Toucher toucher, Vector2 touchPos)
 {
     if (_game.Boomon.CurrentState == BoomonController.State.Idle)
     {
         Play();
     }
 }
示例#6
0
        public void Stream()
        {
            Init();

            var input = string.Empty;

            while (!input.Equals("q", StringComparison.OrdinalIgnoreCase))
            {
                Hub.Reporter.WriteMenu();

                input = Console.ReadLine();
                if (input.Equals("a", StringComparison.OrdinalIgnoreCase))
                {
                    Toucher.TouchAllAssemblyFiles(SlnProjObj);
                }
                else if (input.Equals("W", StringComparison.OrdinalIgnoreCase))
                {
                    Hub.Reporter.ListWatched(SlnProjObj);
                }
                else if (input.Equals("i", StringComparison.OrdinalIgnoreCase))
                {
                    Hub.Reporter.ListIgnored(SlnProjObj);
                }
                else if (input.Equals("u", StringComparison.OrdinalIgnoreCase))
                {
                    Hub.Reporter.ListUpStream(SlnProjObj);
                }
            }
        }
示例#7
0
 void Awake()
 {
     tin                   = GameObject.FindGameObjectWithTag("GameController").GetComponent <Toucher>();
     noiseAmt              = new float[noiseRings.Length];
     ringTime              = new float[noiseRings.Length];
     timeSinceLastRing     = 0.0f;
     loudestNoiseSinceRing = 0.0f;
 }
示例#8
0
    //----------------------------------------------------------------------------------

    #region Events.Toucher

    public void OnTapStart(Toucher toucher, Vector2 touchPos)
    {
        if (toucher != null || CurrentState != State.Idle && CurrentState != State.Emotion)
        {
            return;
        }

        CurrentState = State.Move;
    }
示例#9
0
    private void Shoot(Toucher toucher, Vector2 pos)
    {
        if (!_canBeShot)
        {
            return;
        }

        Animator.SetTrigger(_shootTriggerName);
        AudioSource.PlayOneShot(_shootClip);
        _canBeShot = false;
    }
示例#10
0
    private void OnTriggerExit2D(Collider2D collision)
    {
        Toucher toucher = collision.GetComponent <Toucher>();

        if (toucher == null)
        {
            return;
        }

        onTouchExit.OnNext(toucher);
    }
示例#11
0
    /// <summary>
    /// 対象がInteractorなら、対象に自身を登録する。
    /// </summary>
    /// <param name="interactor"></param>
    public void RegisterToInteractor(Toucher toucher)
    {
        Interactor interactor = toucher.GetComponent <Interactor>();

        if (interactor == null)
        {
            return;
        }

        interactor.SetTarget(this);
    }
示例#12
0
    /// <summary>
    /// ToucherのInteract対象を削除する。
    /// </summary>
    /// <param name="toucher"></param>
    public void RemoveFromInteractor(Toucher toucher)
    {
        Interactor interactor = toucher.GetComponent <Interactor>();

        if (interactor == null)
        {
            return;
        }

        interactor.RemoveTarget();
    }
示例#13
0
    /// <summary>
    ///
    /// </summary>
    /// <param name="toucher"></param>
    /// <param name="position"></param>
    private void OnObjectTapStay(Toucher toucher, Vector2 position)
    {
        if (toucher != null)
        {
            toucher.OnTapStay(toucher, position);
        }

        for (int i = _broadcastListeners.Count - 1; i >= 0; --i)
        {
            if (_broadcastListeners[i] != toucher)
            {
                _broadcastListeners[i].OnTapStay(toucher, position);
            }
        }
    }
示例#14
0
    /// <summary>
    ///
    /// </summary>
    /// <param name="toucher"></param>
    /// <param name="position"></param>
    private void OnObjectDoubleTap(Toucher toucher, Vector2 position)
    {
        Log("OnObjectDoubleTap");

        if (toucher != null)
        {
            toucher.OnDoubleTap(toucher, position);
        }

        for (int i = _broadcastListeners.Count - 1; i >= 0; --i)
        {
            if (_broadcastListeners[i] != toucher)
            {
                _broadcastListeners[i].OnDoubleTap(toucher, position);
            }
        }
    }
示例#15
0
    void GenerateToucher(GameObject finger, bool isRightHand)
    {
        finger.tag = "Player";

        BoxCollider fingerCollider = finger.AddComponent <BoxCollider>();

        fingerCollider.isTrigger = true;
        fingerCollider.center    = new Vector3(0.015f, 0f, 0f);
        fingerCollider.size      = new Vector3(0.03f, 0.015f, 0.015f);

        Rigidbody finderRigidbody = finger.AddComponent <Rigidbody>();

        finderRigidbody.useGravity = false;

        Toucher fingerToucher = finger.AddComponent <Toucher>();

        fingerToucher.isRightHand = isRightHand;
    }
示例#16
0
    //==============================================

    #region Private Methods

    private Toucher FindToucherAtPosition(Vector2 position)
    {
        Toucher toucher = null;

        Ray        ray = Camera.main.ScreenPointToRay(position);
        RaycastHit hitInfo;

        if (Physics.Raycast(ray, out hitInfo, _objectDistanceMax, _touchLayerMask))
        {
            toucher = hitInfo.collider.gameObject.GetComponent <Toucher>();
        }

        if (!_selfListeners.Contains(toucher) && !_broadcastListeners.Contains(toucher))
        {
            toucher = null;
        }

        return(toucher);
    }
示例#17
0
    /// <summary>
    ///
    /// </summary>
    /// <param name="toucher"></param>
    /// <param name="position"></param>
    /// <param name="direction"></param>
    /// <param name="speedRatio"></param>
    private void OnObjectSwipe(Toucher toucher, Vector2 position, Vector2 direction, float speedRatio)
    {
        if (!_selfListeners.Contains(toucher) && !_broadcastListeners.Contains(toucher))
        {
            toucher = null;
        }

        if (toucher != null)
        {
            toucher.OnSwipe(toucher, position, direction, speedRatio);
        }

        for (int i = _broadcastListeners.Count - 1; i >= 0; --i)
        {
            if (_broadcastListeners[i] != toucher)
            {
                _broadcastListeners[i].OnSwipe(toucher, position, direction, speedRatio);
            }
        }
    }
示例#18
0
    public void OnSwipe(Toucher toucher, Vector2 position, Vector2 direction, float speedRatio)
    {
        Log("OnSwipe");

        if (toucher != _toucher)
        {
            return;
        }

        float throwDegress = Mathf.Atan(direction.y / Mathf.Abs(direction.x)) * Mathf.Rad2Deg;

        if (throwDegress > _setup.ThrowDegreesMin)
        {
            Throw(position, direction, speedRatio);
        }
        else
        {
            CurrentState = State.Move;
        }
    }
示例#19
0
    public override void OnSwipe(Toucher toucher, Vector2 position, Vector2 direction, float speedRatio)
    {
        if (toucher != gameObject)
        {
            if (toucher != null)
            {
                return;
            }

            Vector2 myScreenPos = Camera.main.WorldToScreenPoint(_rigid.position);
            if ((myScreenPos - position).sqrMagnitude > _inchesSqrMax)
            {
                return;
            }
        }

        Vector3 touchPosition = Camera.main.ScreenToWorldPoint(position);

        Throw(CalcThrowVelocity(direction, speedRatio), touchPosition);
    }
示例#20
0
	public virtual void OnDoubleTap(Toucher toucher, Vector2 position)
	{
	}
示例#21
0
 public virtual void OnSwipe(Toucher toucher, Vector2 position, Vector2 direction, float speedRatio)
 {
     _swipe.Invoke(toucher, position, direction, speedRatio);
 }
示例#22
0
 public virtual void OnDoubleTap(Toucher toucher, Vector2 position)
 {
     _doubleTap.Invoke(toucher, position);
 }
示例#23
0
 public virtual void OnTapStay(Toucher toucher, Vector2 position)
 {
     _tapStay.Invoke(toucher, position);
 }
示例#24
0
 public virtual void OnTapStart(Toucher toucher, Vector2 touchPos)
 {
     _tapStart.Invoke(toucher, touchPos);
 }
示例#25
0
	public virtual void OnTapStay(Toucher toucher, Vector2 position)
	{
	}
示例#26
0
 void Start()
 {
     tin       = GameObject.FindGameObjectWithTag("GameController").GetComponent <Toucher>();
     startPos  = transform.position;
     followCam = GetComponentInChildren <Camera>();
 }
示例#27
0
 /// <summary>
 /// 触れたとき。
 /// </summary>
 /// <param name="toucher"></param>
 private void OnTouchEnter(Toucher toucher)
 {
     interactable.RegisterToInteractor(toucher);
     animator.SetBool(aKeyCanInteract, true);
 }
示例#28
0
 void Awake()
 {
     tin   = GameObject.FindGameObjectWithTag("GameController").GetComponent <Toucher>();
     spCol = GetComponent <SphereCollider>();
 }
示例#29
0
 /// <summary>
 /// 離れたとき。
 /// </summary>
 /// <param name="toucher"></param>
 private void OnTouchExit(Toucher toucher)
 {
     interactable.RemoveFromInteractor(toucher);
     animator.SetBool(aKeyCanInteract, false);
 }