Rename enemy classes

This commit is contained in:
Denis-Cosmin Nutiu 2019-08-08 23:37:12 +03:00
parent 108bb21a41
commit 047ca6cc9c
5 changed files with 11 additions and 8 deletions

View file

@ -23,7 +23,7 @@ public abstract class EnemyBase : MonoBehaviour, IExplosable
protected void FixedUpdate()
{
if (gameStateManager.IsGamePaused || gameStateManager.IsPlayerMovementForbidden) {return;}
Rigidbody2d.MovePosition(Rigidbody2d.position + Direction * Speed * Time.deltaTime);
Rigidbody2d.MovePosition(Rigidbody2d.position + Speed * Time.deltaTime * Direction);
}
public void OnTriggerEnter2D(Collider2D other)

View file

@ -1,9 +1,8 @@
namespace Assets.Scripts.src.Enemy
namespace src.Enemy
{
public class EnemyThatChangeDirectionOnlyOnCollision : EnemyBase
public class BasicCollisionEnemy : EnemyBase
/* Enemy that will change direction only on collision. */
{
//Momentan lasam asa, o sa difere probabil la animatii and stats, nu stiu sigur
protected new void Start()
{
Speed = 4f;

View file

@ -1,9 +1,10 @@
using UnityEngine;
namespace Assets.Scripts.src.Enemy
namespace src.Enemy
{
public class EnemyThatRandomChangeDirection : EnemyBase
{
/* Enemy that will move randomly */
protected new void Start()
{
Speed = 4f;
@ -12,9 +13,12 @@ namespace Assets.Scripts.src.Enemy
protected new void FixedUpdate()
{
var pos = transform.position;
var x = pos.x;
var y = pos.y;
if (gameStateManager.IsGamePaused || gameStateManager.IsPlayerMovementForbidden) { return; }
if (transform.position.x == Mathf.Floor(transform.position.x) &&
transform.position.y == Mathf.Floor(transform.position.y))
if (x == Mathf.Floor(x) &&
y == Mathf.Floor(y))
{
if (RandomChange())
{