Esempio n. 1
0
 public void OnTapStop(Toucher toucher, Vector2 position)
 {
     if (CurrentState == State.Move)
     {
         CurrentState = State.Idle;
     }
 }
Esempio n. 2
0
 public void OnTapStay(Toucher toucher, Vector2 touchPos)
 {
     if (CurrentState == State.Move)
     {
         Move(touchPos);
     }
 }
Esempio n. 3
0
 public void OnDoubleTap(Toucher toucher, Vector2 position)
 {
     if ((CurrentState == State.Idle || CurrentState == State.Emotion) && toucher == _toucher)
     {
         CurrentState = State.Tickles;
     }
 }
Esempio n. 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());
            }
        }
    }
Esempio n. 5
0
 public void OnTapStart(Toucher toucher, Vector2 touchPos)
 {
     if (_game.Boomon.CurrentState == BoomonController.State.Idle)
     {
         Play();
     }
 }
Esempio n. 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);
                }
            }
        }
Esempio n. 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;
 }
Esempio n. 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;
    }
Esempio n. 9
0
    private void Shoot(Toucher toucher, Vector2 pos)
    {
        if (!_canBeShot)
        {
            return;
        }

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

        if (toucher == null)
        {
            return;
        }

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