Rename enemy classes
This commit is contained in:
parent
108bb21a41
commit
047ca6cc9c
5 changed files with 11 additions and 8 deletions
|
@ -23,7 +23,7 @@ public abstract class EnemyBase : MonoBehaviour, IExplosable
|
||||||
protected void FixedUpdate()
|
protected void FixedUpdate()
|
||||||
{
|
{
|
||||||
if (gameStateManager.IsGamePaused || gameStateManager.IsPlayerMovementForbidden) {return;}
|
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)
|
public void OnTriggerEnter2D(Collider2D other)
|
||||||
|
|
|
@ -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()
|
protected new void Start()
|
||||||
{
|
{
|
||||||
Speed = 4f;
|
Speed = 4f;
|
|
@ -1,9 +1,10 @@
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace Assets.Scripts.src.Enemy
|
namespace src.Enemy
|
||||||
{
|
{
|
||||||
public class EnemyThatRandomChangeDirection : EnemyBase
|
public class EnemyThatRandomChangeDirection : EnemyBase
|
||||||
{
|
{
|
||||||
|
/* Enemy that will move randomly */
|
||||||
protected new void Start()
|
protected new void Start()
|
||||||
{
|
{
|
||||||
Speed = 4f;
|
Speed = 4f;
|
||||||
|
@ -12,9 +13,12 @@ namespace Assets.Scripts.src.Enemy
|
||||||
|
|
||||||
protected new void FixedUpdate()
|
protected new void FixedUpdate()
|
||||||
{
|
{
|
||||||
|
var pos = transform.position;
|
||||||
|
var x = pos.x;
|
||||||
|
var y = pos.y;
|
||||||
if (gameStateManager.IsGamePaused || gameStateManager.IsPlayerMovementForbidden) { return; }
|
if (gameStateManager.IsGamePaused || gameStateManager.IsPlayerMovementForbidden) { return; }
|
||||||
if (transform.position.x == Mathf.Floor(transform.position.x) &&
|
if (x == Mathf.Floor(x) &&
|
||||||
transform.position.y == Mathf.Floor(transform.position.y))
|
y == Mathf.Floor(y))
|
||||||
{
|
{
|
||||||
if (RandomChange())
|
if (RandomChange())
|
||||||
{
|
{
|
Loading…
Reference in a new issue