本文整理汇总了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
}
}
}
}
}
示例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);
}
}
}
示例3: HandleMultiTouch
public void HandleMultiTouch(FTouch[] touches)
{
foreach(FTouch touch in touches){
if(touch.phase == TouchPhase.Ended){
}
}
}
示例4: HandleMultiTouch
public void HandleMultiTouch(FTouch[] touches)
{
if (touches.Length > 0){
touchPos = touches[0].position;
}
if (touches.Length > 1){
shoot();
}
}
示例5: HandleMultiTouch
public void HandleMultiTouch(FTouch[] touches)
{
foreach(FTouch touch in touches)
{
if (touch.phase == TouchPhase.Ended) {
TestSpeechBubbles(touch.position);
}
}
}
示例6: HandleMultiTouch
public void HandleMultiTouch(FTouch[] touches)
{
foreach(FTouch touch in touches)
{
if (touch.phase == TouchPhase.Ended) {
//Click(touch.position);
}
}
}
示例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);
}
}
}
示例8: HandleSingleTouchBegan
public bool HandleSingleTouchBegan(FTouch touch)
{
if (this.selectedActor != null && this.selectedActor.TurnState == ActorState.AwaitingCommand)
{
return false;
}
else
{
return true;
}
}
示例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;
}
}
示例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;
}
示例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;
}
示例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();
}
}
}
示例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);
}
}
}
示例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;
}
}
示例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;
}
}
}
}
}