Commit d97d7165 authored by Adam Štěpánek's avatar Adam Štěpánek
Browse files

Let enemies fly by

parent 2600e368
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -53,7 +53,7 @@ MonoBehaviour:
  m_EditorClassIdentifier: 
  Player: {fileID: 0}
  StartHealth: 100
  Speed: 3
  Speed: 4
  ScoreKeeper: {fileID: 0}
--- !u!54 &467878737505383393
Rigidbody:
@@ -98,10 +98,10 @@ MonoBehaviour:
  m_EditorClassIdentifier: 
  Bounds:
    serializedVersion: 2
    x: -25
    y: -25
    width: 50
    height: 50
    x: -20
    y: -10
    width: 40
    height: 40
--- !u!114 &4126692984388648405
MonoBehaviour:
  m_ObjectHideFlags: 0
+1 −1
Original line number Diff line number Diff line
@@ -53,7 +53,7 @@ MonoBehaviour:
  m_EditorClassIdentifier: 
  Player: {fileID: 0}
  StartHealth: 200
  Speed: 1
  Speed: 2
  ScoreKeeper: {fileID: 0}
--- !u!54 &5639505320926117067
Rigidbody:
+1 −1
Original line number Diff line number Diff line
@@ -42,7 +42,7 @@ public class DumbEnemy : MonoBehaviour, IKillable
    public void FixedUpdate()
    {
        var direction = EndCondition.IsGameOver ? Vector3.back : Player.transform.position - transform.position;
        rigidbody.velocity = (rigidbody.velocity + direction).normalized * Speed;
        rigidbody.velocity = (Vector3.back * 2 + direction.normalized).normalized * Speed;
        rigidbody.rotation = originalRotation * Quaternion.FromToRotation(Vector3.back, rigidbody.velocity);
    }
}