﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class MovePlayer : BaseMoveStrategy
{
    [SerializeField]
    private float jetPackForce;

    public override void Move()
    {
        // Get the rigid body component attached to this game object
        Rigidbody2D rigidBody = GetComponent<Rigidbody2D>();

        // Apply the force to the rigid body in the y-direction
        rigidBody.AddForce(new Vector2(0, jetPackForce));

        // Get the current velocity of the player from its rigid body component
        Vector2 velocity = rigidBody.velocity;

        // Update the velocity on the x-axis to the value of speed
        velocity.x = speed;

        // Update the veocity of the rigid body to the new values
        rigidBody.velocity = velocity;
    }
}
