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