Hey guys,
I keep getting this error with my script, and I don’t know what is wrong with it. :S
Assets/Scripts/ThrowPad.cs(8,14): error CS0535: ThrowPad' does not implement interface member
UnityEngine.EventSystems.IDragHandler.OnDrag(UnityEngine.EventSystems.PointerEventData)’
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.EventSystems;
using System.Collections;
public class ThrowPad : MonoBehaviour, IPointerDownHandler, IDragHandler, IPointerUpHandler {
public float smoothing;
public float distanceMin;
public float zSpeed;
private Vector2 origin;
private Vector2 direction;
private Vector2 smoothDirection;
private bool touched;
private int pointerID;
private GameObject propje;
private Rigidbody rb;
private float startTime, diffTime;
void Start() {
propje = GameObject.Find ("papier prop");
rb = propje.GetComponent<Rigidbody> ();
}
void Awake () {
direction = Vector2.zero;
touched = false;
}
public void OnPointerDown (PointerEventData data) {
if (!touched) {
touched = true;
pointerID = data.pointerId;
origin = data.position;
startTime = Time.time;
}
}
public void onDrag (PointerEventData data) {
if (lengthReached(origin, data.position)) {
diffTime = Time.time - startTime;
direction = (origin - data.position).normalized;
Vector3 dir = new Vector3 (direction.x, direction.y, zSpeed);
rb.AddForce (dir * smoothing);
}
}
public void OnPointerUp (PointerEventData data) {
if (data.pointerId == pointerID) {
direction = Vector2.zero;
touched = false;
}
}
public bool lengthReached(Vector2 origin, Vector2 dragged) {
if (Vector2.Distance(origin, dragged) >= distanceMin) {
return true;
}
return false;
}
}
any help would be really appreciated because I need to get this wroking soon.
Thanks,