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

@ -60,7 +60,7 @@
<Compile Include="Assets\Scripts\AbstractShooter.cs" /> <Compile Include="Assets\Scripts\AbstractShooter.cs" />
<Compile Include="Assets\Scripts\BasicShooter.cs" /> <Compile Include="Assets\Scripts\BasicShooter.cs" />
<Compile Include="Assets\Scripts\Bullet.cs" /> <Compile Include="Assets\Scripts\Bullet.cs" />
<Compile Include="Assets\Scripts\EnnemyCharacter.cs" /> <Compile Include="Assets\Scripts\EnemyCharacter.cs" />
<Compile Include="Assets\Scripts\InputManager.cs" /> <Compile Include="Assets\Scripts\InputManager.cs" />
<Compile Include="Assets\Scripts\Mover.cs" /> <Compile Include="Assets\Scripts\Mover.cs" />
<Compile Include="Assets\Scripts\PlayerCharacter.cs" /> <Compile Include="Assets\Scripts\PlayerCharacter.cs" />

View file

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

View file

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

View file

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

View file

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