Fixed typo in Enemy

Fixed NRE in Mover
This commit is contained in:
trotFunky 2019-09-19 10:53:03 +02:00
parent 3f260fc79d
commit 505715a368
5 changed files with 8 additions and 7 deletions

View file

@ -2,7 +2,7 @@
using System.Collections.Generic;
using UnityEngine;
public class EnnemyCharacter : MonoBehaviour
public class EnemyCharacter : MonoBehaviour
{
// Start is called before the first frame update
void Start()

View file

@ -1,10 +1,10 @@
fileFormatVersion: 2
guid: 42afd9ea63e8b291086605e45d3d151f
guid: 0c9b3f253372ab4a6be34655fcf054b1
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: -3
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:

View file

@ -30,7 +30,10 @@ public class Mover : MonoBehaviour
void Update()
{
_maxSpeed = _character.MaxSpeed;
if (_character != null)
{
_maxSpeed = _character.MaxSpeed;
}
Vector2 currentPosition = _transform.position;
_transform.position = currentPosition + _maxSpeed * Time.deltaTime * _direction;
}

View file

@ -7,8 +7,6 @@ public class PlayerCharacter : AbstractCharacter
public override void Move(Vector2 movementDirection)
{
// TODO : Implement limits
Debug.Log("Direction:");
Debug.Log(movementDirection);
_mover.Direction = movementDirection;
}