using UnityEngine;
using System.Collections;
public class Iscollected : MonoBehaviour {
public GameObject platform;
public float moveSpeed;
public Transform currentPoint;
public Transform points;
public int pointSelection;
// Use this for initialization
void Start () {
currentPoint = points [pointSelection];
}
// Update is called once per frame
void Update () {
}
void OnTriggerEnter2D(Collider2D other)
{
Debug.Log ("Im Triggered");
if (other.gameObject.layer == LayerMask.NameToLayer ("collectable"))
{
platform.transform.position = Vector3.MoveTowards (platform.transform.position, currentPoint.position, Time.deltaTime * moveSpeed);
}
}
}