コード例 #1
0
ファイル: BatScript.cs プロジェクト: inatonix/GrandFather
    // 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);
    }
コード例 #2
0
	protected void shouldChangeScene(object sender, TouchScript.Events.GestureStateChangeEventArgs e) {
		switch( e.State ){
		case Gesture.GestureState.Recognized:
			OnClick( );
			break;
		}
	}
コード例 #3
0
 private void HandleTap(object sender, TouchScript.Events.GestureStateChangeEventArgs e)
 {
     if (e.State == Gesture.GestureState.Recognized)
     {
         FlowView.Instance.Flow(gameObject);
     }
 }
コード例 #4
0
ファイル: DoorTween.cs プロジェクト: herman-rogers/Relic
	void StateChangeHandler( object sender, TouchScript.Events.GestureStateChangeEventArgs e ) {
		switch( e.State ) {
		case Gesture.GestureState.Recognized:
			DoorTrigger( );
			break;
		}
	}
コード例 #5
0
ファイル: TapView.cs プロジェクト: rakkarage/Flow
 private void HandleTap(object sender, TouchScript.Events.GestureStateChangeEventArgs e)
 {
     if (e.State == Gesture.GestureState.Recognized)
     {
         FlowToSignal.Dispatch(gameObject);
     }
 }
コード例 #6
0
ファイル: BumpView.cs プロジェクト: rakkarage/Flow
 private void HandleRelease(object sender, TouchScript.Events.GestureStateChangeEventArgs e)
 {
     if (e.State == Gesture.GestureState.Recognized)
     {
         ReleaseGesture gesture = sender as ReleaseGesture;
         ScaleDown(gesture.gameObject);
     }
 }
コード例 #7
0
ファイル: GemTouchScript.cs プロジェクト: AuremMJS/StayHome
 private void Awake()
 {
     touchScript = GetComponent <TouchScript>();
     if (touchScript != null)
     {
         touchScript.Tapped += TouchScript_Tapped;
     }
 }
コード例 #8
0
	protected void shouldChangeScene(object sender, TouchScript.Events.GestureStateChangeEventArgs e) {
		switch( e.State ){
		case Gesture.GestureState.Recognized:
			LoadScene( sceneName );
			break;
		case Gesture.GestureState.Began:
			break;
		}
	}
コード例 #9
0
ファイル: BumpView.cs プロジェクト: rakkarage/Flow
 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);
     }
 }
コード例 #10
0
 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);
     }
 }
コード例 #11
0
	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;
		}
	}
コード例 #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);
        }
    }
コード例 #13
0
    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;

        }
    }
コード例 #14
0
 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;
     }
 }
コード例 #15
0
ファイル: Breaker.cs プロジェクト: sfszh/TouchScript
 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);
     }
 }
コード例 #16
0
    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;

        }
    }
コード例 #17
0
 void Start()
 {
     GameObject canvas = GameObject.Find ("Canvas");
     t1 = canvas.GetComponent<TouchScript> ();
 }
コード例 #18
0
 void TouchesBegan(object sender, TouchScript.Events.TouchEventArgs e)
 {
     lefSwipeInterpreter.TouchBegan(e.TouchPoints);
     rightSwipeInterpreter.TouchBegan(e.TouchPoints);
     pinchInterpreter.TouchBegan(e.TouchPoints);
     panListener.TouchBegan(e.TouchPoints);
 }
コード例 #19
0
 void Instance_TouchesEnded(object sender, TouchScript.Events.TouchEventArgs e)
 {
     if (point != null && e.TouchPoints.Contains(point))
     {
         SendRealeseEvent(point.Position);
         point = null;
     }
 }
コード例 #20
0
 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);
         }
     }
 }
コード例 #21
0
 void Instance_TouchesBegan(object sender, TouchScript.Events.TouchEventArgs e)
 {
     if (point == null )
     {
         point = GetInsideTouchFromList(e.TouchPoints);
         if(point != null)
             SendEnterEvent(point.Position);
     }
 }
コード例 #22
0
 void Instance_TouchesCancelled(object sender, TouchScript.Events.TouchEventArgs e)
 {
     if (e.TouchPoints.Contains(point))
         SendCancelEvent(point.Position);
 }
コード例 #23
0
    // 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();
    }
コード例 #24
0
ファイル: BirdScript.cs プロジェクト: wadams246/PopperUp
 // 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> ();
 }
コード例 #25
0
    void RightButtonPress(object sender, TouchScript.Events.GestureStateChangeEventArgs e)
    {
        if(!isPaused && isEnabled && e.State == Gesture.GestureState.Began)

            _controller.velocity = new Vector2(xVelocity, yVelocity);
    }
コード例 #26
0
	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;
		}
	}
コード例 #27
0
 void OnDestroy()
 {
     m_Instance = null;
 }
コード例 #28
0
    // 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];
        }
    }
コード例 #29
0
 void Awake()
 {
     m_Instance = this;
     StartCoroutine("MultiTouchesRoutine");
 }