blob: 8e4ce1b383d6d78dfd284678c87478b3c412f70f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
using UnityEngine;
namespace MontanaJohns.Actors
{
[RequireComponent(typeof(Rigidbody2D))]
public class Enemy : Actor
{
GameObject player;
protected override void Awake()
{
base.Awake();
player = GameObject.FindGameObjectWithTag("Player");
}
// Update is called once per frame
void Update()
{
if (player.transform.position.x < transform.position.x) Move(-stats.speedMultiplier * 0.5f);
else Move(stats.speedMultiplier * 0.5f);
}
}
}
|