Пример #1
0
	void Start()
	{

		tapGesture = GetComponent<TapGesture>();
		if (tapGesture != null)
		{
			tapGesture.Tapped += (sender, args) =>
			{
				Debug.Log(transform.name + " tapped");

				if (field_wall == null)
				{
					AddObjects(CellObjects.WALL);
				}
				else
				{
					RemoveObjects(CellObjects.WALL);
				}
			};
		}
		pressGesture = GetComponent<PressGesture>();
		if (pressGesture != null)
		{
			pressGesture.Pressed += (sender, args) =>
			{
				Debug.Log(transform.name + " pressed");
			};
		}
	}
Пример #2
0
 protected override void OnEnable()
 {
     base.OnEnable();
     gesture = GetComponent<TapGesture>();
     if (gesture)
         gesture.Tapped += pressedHandler;
 }
Пример #3
0
        private void OnEnable()
        {
            rb = GetComponent<Rigidbody>();
			activeCamera = GameObject.Find("Scene Camera").GetComponent<Camera>();
            gesture = GetComponent<TapGesture>();
            gesture.Tapped += tappedHandler;
        }
        protected override void OnUnityStart()
        {
            tapGesture = TapObject.GetComponent<TapGesture>();
            pressGesture = TapObject.GetComponent<PressGesture>();

            tapGesture.StateChanged += TapGestureOnStateChanged;
            pressGesture.Pressed += PressGestureOnPressed;
        }
Пример #5
0
	private void OnEnable()
	{
		tapGesture = GetComponent<TapGesture>();

		tapGesture.Tapped += tappedHandler;

		Debug.Log("Subscribed to tap");


	}
Пример #6
0
        public override void OnEnter()
        {
            gesture = GestureUtils.GetGesture<TapGesture>(Fsm, GameObject, Component, true);
            if (gesture == null)
            {
                LogError("Gesture is missing");
                return;
            }

            gesture.Tapped += gestureTappedHandler;
        }
    void Start()
    {
        _waypointList = new List <TextureTrailWaypoint>(_waypoint.GetComponentsInChildren <TextureTrailWaypoint>());

        _cursorPositionObject = new GameObject("CursorPosition");

        _tapGesture = (TouchScript.Gestures.TapGesture)FindObjectOfType(typeof(TouchScript.Gestures.TapGesture));

        _rope = (TextureTrailRope)FindObjectOfType(typeof(TextureTrailRope));

        _rope.StartPoint.localPosition = _rope.EndPoint.localPosition = _waypointList[0].transform.position;

        _tapPositionList.Add(_rope.EndPoint.localPosition);
    }
Пример #8
0
	// Use this for initialization
	void Start () 
	{
		if (Locked) 
		{
			renderer.material.SetTexture (0, LockTexture);

		} 
		else 
		{
			checkTexture();
			tap = gameObject.GetComponent<TapGesture>();
			tap.Tapped += (object sender, System.EventArgs e) => 
			{
				Enabled = !Enabled;
				checkTexture();
				if(EnableChangeEvent!=null)EnableChangeEvent(Enabled);

				//Debug.Log("Option "+name+" : "+Enabled );
			};
		}
	}
Пример #9
0
	// Use this for initialization
	void Start () {
		tap = gameObject.GetComponent<TapGesture>();

		tap.Tapped += (object sender, System.EventArgs e) => 
		{
			enabled = !enabled;

			if(enabled)
			{
				originState.Clear();

				foreach(GameObject g in DisableList)
				{
					originState.Add(g.activeSelf);
					g.SetActive(false);
				}

				foreach(GameObject g in EnableList)
				{
					g.SetActive(true);
				}
			}
			else
			{
				for(int i = 0 ; i<originState.Count ;i++)
				{
					DisableList[i].SetActive(originState[i]);
				}

				foreach(GameObject g in EnableList)
				{
					g.SetActive(false);
				}
			}

		};
	
	}
Пример #10
0
 protected override void OnEnable()
 {
     base.OnEnable();
     gesture = GetComponent<TapGesture>();
     gesture.Tapped += pressedHandler;
     longGesture = GetComponent<LongPressGesture>();
     longGesture.LongPressed += longPressedHandler;
 }
Пример #11
0
    /// <summary>
    /// Cria os botoes de movimentaçao do personagem.
    /// </summary>
    private void CreateButtons()
    {
        Vector3 cameraPos = Camera.main.transform.position;
        GameObject button = new GameObject();
        button.AddComponent<BoxCollider>();
        button.AddComponent<TapGesture>();
        button.transform.localScale = new Vector3(12, 12, 1);

        GameObject right = Instantiate(button) as GameObject;
        right.transform.parent = Camera.main.transform;
        right.transform.position = new Vector3(cameraPos.x + (right.collider.bounds.size.x / 2) + .2f,
                                               cameraPos.y, cameraPos.z + 5) ;

        rightButton = right.GetComponent<TapGesture>();

        GameObject left = Instantiate(button) as GameObject;
        left.transform.parent = Camera.main.transform;
        left.transform.position = new Vector3(cameraPos.x - (right.collider.bounds.size.x / 2) - .2f,
                                              cameraPos.y, cameraPos.z + 5) ;

        leftButton = left.GetComponent<TapGesture>();

        Destroy(button);
    }
Пример #12
0
 private void OnEnable()
 {
     rb = GetComponent<Rigidbody>();
     gesture = GetComponent<TapGesture>();
     gesture.Tapped += tappedHandler;
 }