当前位置: 首页>>代码示例>>C#>>正文


C# FTouch类代码示例

本文整理汇总了C#中FTouch的典型用法代码示例。如果您正苦于以下问题:C# FTouch类的具体用法?C# FTouch怎么用?C# FTouch使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


FTouch类属于命名空间,在下文中一共展示了FTouch类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: HandleMultiTouch

    public void HandleMultiTouch(FTouch[] touches)
    {
        foreach(FTouch touch in touches)
        {
            if(touch.phase == TouchPhase.Began)
            {

                //we go reverse order so that if we remove a banana it doesn't matter
                //and also so that that we check from front to back

                for (int b = _bananas.Count-1; b >= 0; b--)
                {
                    BBanana banana = _bananas[b];

                    Vector2 touchPos = banana.GlobalToLocal(touch.position);

                    if(banana.textureRect.Contains(touchPos))
                    {
                        HandleGotBanana(banana);
                        break; //break so that a touch can only hit one banana at a time
                    }
                }
            }
        }
    }
开发者ID:stylophone,项目名称:Futile,代码行数:25,代码来源:BInGamePage.cs

示例2: HandleMultiTouch

 public void HandleMultiTouch(FTouch[] touches)
 {
     foreach(FTouch touch in touches)
     {
         if (touch.phase == TouchPhase.Ended) {
             if (_draw!=null) {
                 _draw.RemoveFromContainerAnimated();
                 _draw=null;
             }
         } else if (touch.phase == TouchPhase.Began) {
             if (_draw==null) {
                 float c0=RXRandom.Float();
                 float c1=RXRandom.Float();
                 float c2=RXRandom.Float();
                 float c3=RXRandom.Float();
                 float c4=RXRandom.Float();
                 float c5=RXRandom.Float();
                 _draw = new FMotionStreakWithBorderSprite("Futile_White", // texture name
                     10+RXRandom.Int(20),  //Number of quads in the trail
                     x => 15.0f*(float)Math.Sin (1.0f*x*x*x*Math.PI),  // width of the band function, x represents the offset in the band and 0<= x <=1
                     x => new Color(c0,c1,c2,(float)Math.Sin (1.0f*x*Math.PI)),  //color of the band function, x represents the offset in the band and 0<= x <=1
                     x => 10f*(float)Math.Sin (1.0f*x*Math.PI),
                     x => new Color(c3,c4,c5,(float)Math.Sin (1.0f*x*Math.PI))
                     );
                 AddChild(_draw);
             }
             _draw.PushPosition(touch.position);
         } else if (touch.phase == TouchPhase.Moved) {
             if (_draw!=null) _draw.PushPosition(touch.position);
         }
     }
 }
开发者ID:tanis2000,项目名称:Futile,代码行数:32,代码来源:PageTestMotionStreak.cs

示例3: HandleMultiTouch

 public void HandleMultiTouch(FTouch[] touches)
 {
     foreach(FTouch touch in touches){
         if(touch.phase == TouchPhase.Ended){
         }
     }
 }
开发者ID:rhololkeolke,项目名称:Game-Design-Class,代码行数:7,代码来源:HowToPlayPage.cs

示例4: HandleMultiTouch

 public void HandleMultiTouch(FTouch[] touches)
 {
     if (touches.Length > 0){
         touchPos = touches[0].position;
     }
     if (touches.Length > 1){
         shoot();
     }
 }
开发者ID:ktn,项目名称:KevinEnemyPractice,代码行数:9,代码来源:InGamePage.cs

示例5: HandleMultiTouch

 public void HandleMultiTouch(FTouch[] touches)
 {
     foreach(FTouch touch in touches)
     {
         if (touch.phase == TouchPhase.Ended) {
             TestSpeechBubbles(touch.position);
         }
     }
 }
开发者ID:tanis2000,项目名称:Futile,代码行数:9,代码来源:PageTestSpeechBubbles.cs

示例6: HandleMultiTouch

 public void HandleMultiTouch(FTouch[] touches)
 {
     foreach(FTouch touch in touches)
     {
         if (touch.phase == TouchPhase.Ended) {
             //Click(touch.position);
         }
     }
 }
开发者ID:tanis2000,项目名称:Futile,代码行数:9,代码来源:PageTestHole.cs

示例7: HandleMultiTouch

 public void HandleMultiTouch(FTouch[] touches)
 {
     foreach(FTouch touch in touches)
     {
         if (touch.phase == TouchPhase.Ended) {
             ChangeSplitRatio(touch.position);
         } else if (touch.phase == TouchPhase.Moved) {
             ChangeSplitRatio(touch.position);
         }
     }
 }
开发者ID:tanis2000,项目名称:Futile,代码行数:11,代码来源:PageTestSplitSprite.cs

示例8: HandleSingleTouchBegan

 public bool HandleSingleTouchBegan(FTouch touch)
 {
     if (this.selectedActor != null && this.selectedActor.TurnState == ActorState.AwaitingCommand)
     {
         return false;
     }
     else
     {
         return true;
     }
 }
开发者ID:HaKDMoDz,项目名称:awayteam,代码行数:11,代码来源:MissionPage.cs

示例9: HandleSingleTouchMoved

    public void HandleSingleTouchMoved(FTouch touch)
    {
        rejector++;

        if(rejector > 0) // Nevermind this. I'm trying to figure out why touches cause lag on android
        {
            float xPos = mBombaNode.GlobalToLocal(touch.position).x;

            mPepper.setPosition(xPos);
            rejector = 0;
        }
    }
开发者ID:edbartley,项目名称:BombaFiesta-Unity3D-Futile,代码行数:12,代码来源:BombaMain.cs

示例10: HandleSingleTouchBegan

    public bool HandleSingleTouchBegan(FTouch touch)
    {
        foreach (FSprite sprite in compartmentSprites) {
            /*if (sprite.textureRect.Contains(sprite.GlobalToLocal(touch.position))) {
                if (sprite.color == Color.blue) sprite.color = Color.red;
                else sprite.color = Color.blue;
            }*/
            Debug.Log(sprite.textureRect);
            //Debug.Log(sprite.element.atlas.texture.GetPixel((int)touch.position.x, (int)touch.position.y));
        }

        return true;
    }
开发者ID:wtrebella,项目名称:FutilePrototyper,代码行数:13,代码来源:WTCompartments.cs

示例11: HandleSingleTouchBegan

    public virtual bool HandleSingleTouchBegan(FTouch touch)
    {
        Vector2 touchPos = base.GetLocalTouchPosition(touch);

        if (_hitRect.Contains(touchPos))
        {
            indicatorValue = Mathf.Abs((base.x - _hitRect.width / 2) - _movableIndicator.x) / _hitRect.width;
            _movableIndicator.x = Mathf.Clamp(LocalToGlobal(touchPos).x, (base.x - _hitRect.width / 2) + _movableIndicator.width / 2, (base.x + _hitRect.width / 2) - _movableIndicator.width / 2);
            return true;
        }

        return false;
    }
开发者ID:riktothepast,项目名称:LD30,代码行数:13,代码来源:RSlider.cs

示例12: HandleMultiTouch

    public void HandleMultiTouch(FTouch[] touches)
    {
        foreach(FTouch touch in touches)
        {
            {

                //we go reverse order so that if we remove a banana it doesn't matter
                //and also so that that we check from front to back
                terrain.Update((this.GetLocalTouchPosition(touch)));
            terrain.RemoveTiles();

            }
        }
    }
开发者ID:philipcass,项目名称:art_game,代码行数:14,代码来源:InGamePage.cs

示例13: HandleSingleTouchEnded

    public void HandleSingleTouchEnded(FTouch touch)
    {
        var gridVector = this.map.GlobalToGrid(touch.position);
        Debug.Log("Touch at: " + touch.position + ", map grid: " + gridVector);

        if (this.selectedActor != null)
        {
            var actorState = this.selectedActor.TurnState;
            if (actorState == ActorState.SelectingDestination)
            {
                if (this.pathfindResults != null && this.pathfindResults.VisitablePoints.Contains(gridVector))
                {
                    this.selectedActor.HasMovedThisTurn = true;
                    this.selectedActor.TurnState = ActorState.AwaitingCommand;
                    this.map.UpdateLocation(this.selectedActor, gridVector);

                    // Recompute the set of attackable points, since the actor has moved.
                    var tempEnum = MoveAndAttackHelper.GetAttackablePoints(this.map, gridVector, 1, 6);
                    this.localAttackablePoints = new HashSet<Vector2i>(tempEnum);
                    this.showButtonStrip(this.selectedActor);
                    this.clearHighlights();
                }
            }
            else if(actorState == ActorState.SelectingEnemy)
            {
                if (this.localAttackablePoints.Contains(gridVector))
                {
                    Debug.Log("Attacking point: " + gridVector);
                    Vector2 source = new Vector2(this.selectedActor.x, this.selectedActor.y);
                    Vector2 dest = this.map.GridToGlobal(gridVector);
                    this.ShootLaser(source, dest);
                }
            }
        }
        else if (this.map.TryGetActor(gridVector, out this.selectedActor))
        {
            var actorState = this.selectedActor.TurnState;
            if (actorState == ActorState.TurnStart)
            {
                this.selectedActor.TurnState = ActorState.AwaitingCommand;
                this.pathfindResults = MoveAndAttackHelper.Pathfind(this.map, this.selectedActor);
                var tempEnum = MoveAndAttackHelper.GetAttackablePoints(this.map, gridVector, 1, 6);
                this.localAttackablePoints = new HashSet<Vector2i>(tempEnum);
                this.showButtonStrip(this.selectedActor);
            }
        }
    }
开发者ID:HaKDMoDz,项目名称:awayteam,代码行数:47,代码来源:MissionPage.cs

示例14: HandleTouch

    public virtual void HandleTouch(FTouch touch)
    {
        Vector2 touchPos = this.GlobalToLocal(touch.position);

        Rect expandedRect = _hitRect.CloneWithExpansion(expansionAmount);

        if (expandedRect.Contains(touchPos))
        {
            if (!continuousTouch) {
                if (touch.phase != TouchPhase.Began) {
                    return;
                }
            }
            if (SignalPress != null) SignalPress();
            alpha = 1f;
        }
    }
开发者ID:riktothepast,项目名称:LD30,代码行数:17,代码来源:ButtonSprite.cs

示例15: HandleMultiTouch

    public void HandleMultiTouch(FTouch[] touches)
    {
        foreach(FTouch touch in touches) {
            if (touch.phase == TouchPhase.Began) {
                for (int i = thingies.Count - 1; i >= 0; i--) {
                    Thingy thingy = thingies[i];
                    FSprite sprite = thingy.GetChildAt(0) as FSprite;
                    Vector2 touchPos = sprite.GlobalToLocal(touch.position);
                    Rect rect = sprite.textureRect;

                    if (rect.Contains(touchPos)) {
                        HandleGotThingy(thingy);
                        break;
                    }
                }
            }
        }
    }
开发者ID:wtrebella,项目名称:Catch-Me,代码行数:18,代码来源:GamePage.cs


注:本文中的FTouch类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。