我用C#编写了一个player class和SwipeDetector class,SwipeDetector class用来感应iPhone上的垂直触摸。我用的是unity3d,但是这个问题属于编程问题,而不单单是游戏开发方面的技巧问题。
在player class中,我想读取SwipeDetector中的数据,了解它可以感应哪些触摸活动,该怎么办呢?
player.cs:
if(SwipeDetetcor is up){
print("up");
}
这就是SwipeDetector class
using UnityEngine;
using System.Collections;
public class SwipeDetector : MonoBehaviour {
// Values to set:
public float comfortZone = 70.0f;
public float minSwipeDist = 14.0f;
public float maxSwipeTime = 0.5f;
private float startTime;
private Vector2 startPos;
private bool couldBeSwipe;
public enum SwipeDirection {
None,
Up,
Down
}
public SwipeDirection lastSwipe = SwipeDetector.SwipeDirection.None;
publ