25 lines
518 B
C#
25 lines
518 B
C#
|
using System;
|
||
|
using System.Collections;
|
||
|
using System.Collections.Generic;
|
||
|
using UnityEditor;
|
||
|
using UnityEngine;
|
||
|
|
||
|
public class EnemyMovement : MonoBehaviour
|
||
|
{
|
||
|
[Header("Speed")]
|
||
|
public float speed = 2;
|
||
|
public float range = 4;
|
||
|
|
||
|
public Transform enemy;
|
||
|
|
||
|
void Start()
|
||
|
{
|
||
|
}
|
||
|
|
||
|
// Update is called once per frame
|
||
|
void Update()
|
||
|
{
|
||
|
enemy.position = new Vector3(Convert.ToSingle(Math.Cos(Time.time * speed)) * range, 0, Convert.ToSingle(Math.Sin(Time.time * speed)) * range);
|
||
|
}
|
||
|
}
|