public TouchInputManager() { SetupPlatform(); if (instance != this) { instance = this; } //Sets default as iPhone control wrapper playerControl = new IphoneTouchWrapper(); Debug.Log("Touch Input Manager Instantiated"); }
public override bool Equals(object other) { // Null check if (other == null) { return(false); } // Casts the object as TouchInputWrapper then null tests TouchInputWrapper test = other as TouchInputWrapper; if ((System.Object)test == null) { return(false); } return(false); }
void TakeSample() { TouchData data; if (m_TouchData.Count < 20) { data = new TouchData(); } else { data = m_TouchData[m_TouchData.Count - 1]; m_TouchData.RemoveAt(m_TouchData.Count - 1); } data.m_Position = TouchInputWrapper.GetTouchPosition(m_TouchID); data.m_Time = Time.realtimeSinceStartup; m_TouchData.Insert(0, data); }
public void Update() { #if !UNITY_EDITOR if (Input.touchCount <= m_TouchID) { return; } #endif if (m_TouchDidBegin && m_NumberOfTouches != Input.touchCount) { //Reset m_LastPosition = TouchInputWrapper.GetTouchPosition(m_TouchID); } if (GetTouchBegan()) { m_TouchDidMove = false; m_TouchDidBegin = true; m_TouchBeganTime = Time.realtimeSinceStartup; m_LastPosition = TouchInputWrapper.GetTouchPosition(m_TouchID); } else if (GetTouchEnded()) { m_TouchDidMove = false; m_TouchDidBegin = false; } else if (GetTouchMoved()) { // Debug.Log("GetTouchMoved"); m_TouchDidMove = true; //sample data TakeSample(); m_LastPosition = TouchInputWrapper.GetTouchPosition(m_TouchID); } else if (GetTouchStationary()) { } m_NumberOfTouches = Input.touchCount; }
// Registers a new player touch controller public void RegisterPlayerTouch(TouchInputWrapper tiw) { playerControl = tiw; Debug.Log(tiw.GetType().ToString() + ": Registered"); }
// Clears the active player touch controller public void ClearPlayer() { playerControl = null; }
public Vector2 GetPosition() { return(TouchInputWrapper.GetTouchPosition(m_TouchID)); }