Mini-Games-Game/Assets/Scripts/EnemyMovement.cs
Arlo Filley cdc25bd8b1 Feature: Moving "Enemy"
Added:
- Circular enemy movement pattern
2024-04-29 23:54:45 +01:00

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);
}
}