blob: 0e0cb81606c39aa886944b39ba381ee33844e24d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
using UnityEngine;
using System.Collections;
public class EnemyMovementScript : MonoBehaviour {
public float radius = 10f;
public float speed = 1f;
Vector3 offset;
void Start ()
{
offset = transform.position;
}
void Update ()
{
transform.position = new Vector3(
(radius * Mathf.Cos(Time.time * speed)) + offset.x,
(radius * Mathf.Sin(Time.time * speed)) + offset.y,
offset.z);
}
}
|