using System.Collections;
using System.Collections.Generic;
using UnityEngine;
///
/// Logic block which deals with jumping a character in a direction
///
[CreateAssetMenu(menuName = "Major Project/Jump Block")]
[System.Serializable]
public class Jump : LogicBlock
{
[SerializeField]
[Tooltip("Direction to Jump")]
protected Direction direction = Direction.Forward;
#region Class Functions
///
/// Implementation of BlockLogic, moves the player forward
///
/// Player to move
protected override void BlockLogic(Character player, float animationTime)
{
player.Jump(direction, animationTime);
}
public override void CopyToken(BlockToken token)
{
base.CopyToken(token);
direction = ((DirectionToken)token).direction;
}
public override BlockToken ToToken(BlockToken token = null)
{
if (token == null)
token = new DirectionToken(this);
DirectionToken retVal = (DirectionToken)base.ToToken(token);
retVal.direction = direction;
return retVal;
}
#endregion Class Functions
}