Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class DroneController : MonoBehaviour {
- bool moving;
- public float speed;
- // Use this for initialization
- //GameObject obj;
- GameObject ast;
- void Start () {
- moving = false;
- speed = 50f;
- }
- // Update is called once per frame
- void Update () {
- if (moving) {
- Debug.Log ("Moving;");
- Debug.Log (ast.transform.position);
- float step = speed * Time.deltaTime;
- transform.position = Vector2.MoveTowards (transform.position, ast.transform.position, step);
- }
- }
- void harvest(GameObject obj) {
- Debug.Log ("Message Recieved");
- ast = obj as GameObject;
- moving = true;
- Debug.Log (ast.transform.position);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement