mirror of
https://github.com/ConjureETS/PixelSphinx.git
synced 2026-03-24 02:20:58 +00:00
30 lines
584 B
C#
30 lines
584 B
C#
using UnityEngine;
|
|
using System.Collections;
|
|
|
|
public class Asteroid : MonoBehaviour
|
|
{
|
|
Vector3 center;
|
|
public float speed;
|
|
public float step;
|
|
|
|
// Use this for initialization
|
|
void Start()
|
|
{
|
|
speed = Random.Range(0.1F, 2F);
|
|
print(speed);
|
|
center = new Vector3(0, 0);
|
|
}
|
|
|
|
// Update is called once per frame
|
|
void Update () {
|
|
MoveObject(center);
|
|
|
|
}
|
|
|
|
void MoveObject(Vector3 center)
|
|
{
|
|
step = speed * Time.deltaTime;
|
|
this.transform.position = Vector3.MoveTowards(transform.position, center, step);
|
|
}
|
|
}
|