@ -22,12 +22,16 @@ public abstract class LogicBlock : ScriptableObject
[SerializeField]
[Header("Base Settings")]
[Tooltip("Wait until this block is resolved before moving to next")]
public bool WaitUntilFinished = false ;
protected bool _ WaitUntilFinished = false ;
[SerializeField]
[Tooltip("Amount of times to run this Block before moving to next")]
protected int RepeatAmount = 1 ;
[SerializeField]
[Tooltip("Speed this block will be played back at. (Default = 1)")]
protected float SpeedMultiplier = 1 ;
#endregion Inspector Fields
#region ReadOnly Variables
@ -35,6 +39,8 @@ public abstract class LogicBlock : ScriptableObject
[HideInInspector]
public bool hasBeenRemoved = false ;
public virtual bool WaitUntilFinished { get { return _WaitUntilFinished ; } }
#endregion
#region private variables
@ -52,10 +58,11 @@ public abstract class LogicBlock : ScriptableObject
/// </summary>
/// <param name="player">Player which will be affected by the block</param>
/// <returns>returns true if block is finished</returns>
public virtual bool Run ( Character player , float animationTime )
public virtual bool Run ( Character player , float animationSpeed , out float TotalAnimation Time )
{
RepeatCount + + ;
BlockLogic ( player , animationTime ) ;
TotalAnimationTime = animationSpeed / SpeedMultiplier ;
BlockLogic ( player , TotalAnimationTime ) ;
if ( GlobalVariables . playerMoves = = true ) {
player . DisplayBlock ( this ) ;
@ -106,7 +113,6 @@ public abstract class LogicBlock : ScriptableObject
return ( RepeatCount = = RepeatAmount ) ;
}
#region Serialisation Functions
/// <summary>
/// Copies data from BlockToken to this Block
@ -116,9 +122,10 @@ public abstract class LogicBlock : ScriptableObject
{
Color = token . Color ;
_DisplayName = token . _DisplayName ;
WaitUntilFinished = token . WaitUntilFinished ;
_ WaitUntilFinished = token . WaitUntilFinished ;
RepeatAmount = token . RepeatAmount ;
name = token . ObjectName ;
SpeedMultiplier = token . SpeedMultiplier ;
}
/// <summary>
@ -135,6 +142,7 @@ public abstract class LogicBlock : ScriptableObject
token . WaitUntilFinished = WaitUntilFinished ;
token . RepeatAmount = RepeatAmount ;
token . ObjectName = name ;
token . SpeedMultiplier = SpeedMultiplier ;
return token ;
}
@ -187,6 +195,8 @@ public class BlockToken
public int RepeatAmount ;
public float SpeedMultiplier ;
public BlockToken ( LogicBlock block )
{
blockType = block . GetType ( ) ;