Subversion Repository Public Repository

Nextrek

Diff Revisions 116 vs 117 for /3DSpace/Assets/Custum/Scripts/BigEnemyFly.cs

Diff revisions: vs.
  @@ -3,17 +3,17 @@
3 3
4 4 public class BigEnemyFly : MonoBehaviour
5 5 {
6 - private float speed = 100;
7 - private Transform target;
6 + private float speed = 25;
7 +
8 8 void Awake()
9 9 {
10 - target = GameManager.Instance.spaceShip;
11 10 }
11 +
12 12 void Update()
13 13 {
14 - if(target)
14 + if(GameManager.Instance.spaceShip)
15 15 {
16 - Vector3 dir = target.position-transform.position;
16 + Vector3 dir = transform.position-GameManager.Instance.spaceShip.position;
17 17 dir.Normalize();
18 18 transform.Translate(dir*Time.deltaTime*speed);
19 19 }