Exemple #1
0
    // Use this for initialization
    void Start()
    {
        player = GameObject.Find("player");
        offset = gameObject.transform.position;

        touchScript    = GameObject.Find("GameManager").GetComponent <TouchScript> ();
        animator       = gameObject.GetComponent <Animator> ();
        spriteRenderer = gameObject.GetComponent <SpriteRenderer> ();

        //タグによって敵の種類を判別
        switch (gameObject.tag)
        {
        case "Bat1":
            enemyKind = 0;
            break;

        case "Bat2":
            enemyKind = 1;
            break;

        case "Bat3":
            enemyKind = 2;
            break;
        }
        //print (animator);
    }
	protected void shouldChangeScene(object sender, TouchScript.Events.GestureStateChangeEventArgs e) {
		switch( e.State ){
		case Gesture.GestureState.Recognized:
			OnClick( );
			break;
		}
	}
 private void HandleTap(object sender, TouchScript.Events.GestureStateChangeEventArgs e)
 {
     if (e.State == Gesture.GestureState.Recognized)
     {
         FlowView.Instance.Flow(gameObject);
     }
 }
Exemple #4
0
	void StateChangeHandler( object sender, TouchScript.Events.GestureStateChangeEventArgs e ) {
		switch( e.State ) {
		case Gesture.GestureState.Recognized:
			DoorTrigger( );
			break;
		}
	}
Exemple #5
0
 private void HandleTap(object sender, TouchScript.Events.GestureStateChangeEventArgs e)
 {
     if (e.State == Gesture.GestureState.Recognized)
     {
         FlowToSignal.Dispatch(gameObject);
     }
 }
Exemple #6
0
 private void HandleRelease(object sender, TouchScript.Events.GestureStateChangeEventArgs e)
 {
     if (e.State == Gesture.GestureState.Recognized)
     {
         ReleaseGesture gesture = sender as ReleaseGesture;
         ScaleDown(gesture.gameObject);
     }
 }
Exemple #7
0
 private void Awake()
 {
     touchScript = GetComponent <TouchScript>();
     if (touchScript != null)
     {
         touchScript.Tapped += TouchScript_Tapped;
     }
 }
	protected void shouldChangeScene(object sender, TouchScript.Events.GestureStateChangeEventArgs e) {
		switch( e.State ){
		case Gesture.GestureState.Recognized:
			LoadScene( sceneName );
			break;
		case Gesture.GestureState.Began:
			break;
		}
	}
Exemple #9
0
 private void HandlePress(object sender, TouchScript.Events.GestureStateChangeEventArgs e)
 {
     if (e.State == Gesture.GestureState.Recognized)
     {
         InertiaStopSignal.Dispatch();
         PressGesture gesture = sender as PressGesture;
         ScaleUp(gesture.gameObject);
     }
 }
 private void HandlePress(object sender, TouchScript.Events.GestureStateChangeEventArgs e)
 {
     if (e.State == Gesture.GestureState.Recognized)
     {
         FlowView.Instance.StopInertia();
         PressGesture gesture = sender as PressGesture;
         ScaleUp(gesture.gameObject);
     }
 }
	void ObjectInteraction( object sender, TouchScript.Events.GestureStateChangeEventArgs e ){
		switch( e.State ) {
		case Gesture.GestureState.Recognized:
			if( IsPlayerCloseEnough( ) ){ GestureStateRecognized( ); }
			break;
		case Gesture.GestureState.Began:
			if( IsPlayerCloseEnough( ) ) { GestureStateBegan( ); }
			break;
		}
	}
Exemple #12
0
    //



    //
    // Start is called before the first frame update
    private void Awake()
    {
        if (instance != null)
        {
            if (instance != this)
            {
                Destroy(this.gameObject);
            }
            Debug.Log("More then one TouchScript in scene");
        }
        else
        {
            instance = this;
            DontDestroyOnLoad(gameObject);
        }
    }
    private void HandleStateChanged(object sender, TouchScript.Events.GestureStateChangeEventArgs e)
    {
        if (e.State == Gesture.GestureState.Recognized)
        {
            var gesture = sender as TapGesture;
            TouchHit hit;
            gesture.GetTargetHitResult(out hit);

            Color color = new Color(Random.value, Random.value, Random.value);
            var c = Instantiate(CubePrefab) as Transform;
            c.parent = Container;
            c.name = "Cube";
            c.localScale = Vector3.one*Scale*c.localScale.x;
            c.position = hit.Point + hit.Normal * 2;
            c.renderer.material.color = color;

        }
    }
 private void HandleSimplePanStateChanged(object sender, TouchScript.Events.GestureStateChangeEventArgs e)
 {
     SimplePanGesture target = sender as SimplePanGesture;
     switch (e.State)
     {
         case Gesture.GestureState.Began:
         case Gesture.GestureState.Changed:
             if (target.LocalDeltaPosition != Vector3.zero)
                 FlowView.Instance.Flow(target.LocalDeltaPosition.x);
             break;
         case Gesture.GestureState.Ended:
             float velocity = (target.LocalTransformCenter.x - target.PreviousLocalTransformCenter.x) * 0.5f;
             if (Mathf.Abs(velocity) > Threshold)
                 FlowView.Instance.Inertia(velocity);
             else
                 FlowView.Instance.Flow();
             break;
     }
 }
Exemple #15
0
 private void HandleStateChanged(object sender, TouchScript.Events.GestureStateChangeEventArgs e)
 {
     if (e.State == Gesture.GestureState.Recognized)
     {
         if (transform.localScale.x > 0.05f)
         {
             Color color = new Color(Random.value, Random.value, Random.value);
             for (int i = 0; i < 8; i++)
             {
                 var c = Instantiate(CubePrefab) as Transform;
                 c.parent = transform.parent;
                 c.name = "Cube";
                 c.localScale = 0.5f*transform.localScale;
                 c.position = transform.TransformPoint(c.localScale.x/10.0f*directions[i]);
                 c.rigidbody.velocity = Power*Random.insideUnitSphere;
                 c.renderer.material.color = color;
             }
         }
         Destroy(gameObject);
     }
 }
    void HandleStateChanged(object sender, TouchScript.Events.GestureStateChangeEventArgs e)
    {
        Debug.Log("In PanCamera HandleStateChanged!!!????!?!");

        switch(e.State)
        {
        case Gesture.GestureState.Began:
        case Gesture.GestureState.Changed:

            var gesture = (SimplePanGesture)sender;

            if (gesture.LocalDeltaPosition != Vector3.zero)
            {
                Debug.Log ("Got Delta!");
                Vector3 delta = gesture.LocalDeltaPosition;

                TargetLocation += new Vector3(delta.x, 0, delta.y) * Time.deltaTime * speed_multiplier;
            }
            break;

        }
    }
 void Start()
 {
     GameObject canvas = GameObject.Find ("Canvas");
     t1 = canvas.GetComponent<TouchScript> ();
 }
 void TouchesBegan(object sender, TouchScript.Events.TouchEventArgs e)
 {
     lefSwipeInterpreter.TouchBegan(e.TouchPoints);
     rightSwipeInterpreter.TouchBegan(e.TouchPoints);
     pinchInterpreter.TouchBegan(e.TouchPoints);
     panListener.TouchBegan(e.TouchPoints);
 }
 void Instance_TouchesEnded(object sender, TouchScript.Events.TouchEventArgs e)
 {
     if (point != null && e.TouchPoints.Contains(point))
     {
         SendRealeseEvent(point.Position);
         point = null;
     }
 }
 void Instance_TouchesMoved(object sender, TouchScript.Events.TouchEventArgs e)
 {
     if (point != null)
     {
         if (e.TouchPoints.Contains(point))
         {
             CheckMovedTouch();
         }
     }
     else
     {
         if(TouchSlidingInEnabled)
         {
             point = GetInsideTouchFromList(e.TouchPoints);
             if (point != null)
                 SendEnterEvent(point.Position);
         }
     }
 }
 void Instance_TouchesBegan(object sender, TouchScript.Events.TouchEventArgs e)
 {
     if (point == null )
     {
         point = GetInsideTouchFromList(e.TouchPoints);
         if(point != null)
             SendEnterEvent(point.Position);
     }
 }
 void Instance_TouchesCancelled(object sender, TouchScript.Events.TouchEventArgs e)
 {
     if (e.TouchPoints.Contains(point))
         SendCancelEvent(point.Position);
 }
    // Use this for initialization
    void Start()
    {
        switchToGui ();

        InfoPanel.SetActive(false);
        GameOver.SetActive(false);
        buildMineOnAsteroid.SetActive(false);

        gameController = GameObject.FindGameObjectWithTag("GameController").GetComponent<GameController>();
        mothershipController = gameController.getMothership().GetComponent<MothershipController>();
        touchScript = GameObject.FindGameObjectWithTag("TouchScript").GetComponent<TouchScript>();
        GameObject androidalke = GameObject.Find ("Android");
        if (androidalke != null)
            android = androidalke.GetComponent<Android>();

        hasGameEnded = false;
        MoveUp = false;
        gamePaused = false;

        CameraMinus = false;
        CameraPlus = false;

        SetupControls();
    }
Exemple #24
0
 // Use this for initialization
 void Start()
 {
     rend = GetComponent<Renderer> ();
     GameObject canvas = GameObject.Find ("Canvas");
     markerObj = (GameObject)Instantiate(marker);
     markerObj.SetActive(false);
     t1 = canvas.GetComponent<TouchScript> ();
 }
    void RightButtonPress(object sender, TouchScript.Events.GestureStateChangeEventArgs e)
    {
        if(!isPaused && isEnabled && e.State == Gesture.GestureState.Began)

            _controller.velocity = new Vector2(xVelocity, yVelocity);
    }
	void StateChangeHandler( object sender, TouchScript.Events.GestureStateChangeEventArgs e ) {
		switch( e.State ) {
		case Gesture.GestureState.Recognized:
                Vector3 worldCoords = ConvertScreenToWorldSpace( ScreenPositionAsVector3( ) );
                if( navMesh.CanMoveTo( worldCoords ) ) {
                    this.MoveMonster( worldCoords , CharacterAnimations.AnimationList.Walking );
                }
			break;
		}
	}
 void OnDestroy()
 {
     m_Instance = null;
 }
    // CALLED WHEN CARD IS SPAWNED
    void Start()
    {
        touchScript    = GameObject.Find("Camera").GetComponent <TouchScript>();
        newPosition    = transform.position;
        createdSubCard = false;

        // RANDOM NAME ATTRIBUTION
        int randName = Random.Range(0, nameDictionnary.Length);

        GetComponentInChildren <TextMesh>().text = nameDictionnary[randName];

        // RANDOM FACE COLOR
        int randFaceColor = Random.Range(0, faceColorDictionnary.Length);

        faceSprite.color = faceColorDictionnary[randFaceColor];

        // RANDOM HAT OBJECT
        int randhatObject = Random.Range(0, hatObjectDictionnary.Length);

        for (int i = 0; i < hatObjectDictionnary.Length; i++)
        {
            if (i == randhatObject)
            {
                hatObjectDictionnary[i].gameObject.SetActive(true);
            }
            else
            {
                hatObjectDictionnary[i].gameObject.SetActive(false);
            }
        }

        // RANDOM BEARD OBJECT
        int randbeardObject = Random.Range(0, beardObjectDictionnary.Length);

        for (int i = 0; i < beardObjectDictionnary.Length; i++)
        {
            if (i == randbeardObject)
            {
                beardObjectDictionnary[i].gameObject.SetActive(true);
            }
            else
            {
                beardObjectDictionnary[i].gameObject.SetActive(false);
            }
        }

        // RANDOM HAT COLOR
        int randHatColor = Random.Range(0, hatColorDictionnary.Length);

        SpriteRenderer[] hatRenderers = hatObjectDictionnary[randhatObject].GetComponentsInChildren <SpriteRenderer>();
        foreach (SpriteRenderer hatRenderer in hatRenderers)
        {
            hatRenderer.color = hatColorDictionnary[randHatColor];
        }

        // RANDOM BEARD COLOR
        int randBeardColor = Random.Range(0, hatColorDictionnary.Length);

        SpriteRenderer[] beardRenderers = beardObjectDictionnary[randbeardObject].GetComponentsInChildren <SpriteRenderer>();
        foreach (SpriteRenderer beardRenderer in beardRenderers)
        {
            beardRenderer.color = hatColorDictionnary[randBeardColor];
        }
    }
 void Awake()
 {
     m_Instance = this;
     StartCoroutine("MultiTouchesRoutine");
 }