using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
/// <summary>
|
|
/// Logic block which deals with moving a character in a direction
|
|
/// </summary>
|
|
[CreateAssetMenu(menuName = "Major Project/Rotate Block")]
|
|
[System.Serializable]
|
|
public class Rotate : LogicBlock
|
|
{
|
|
#region Inspector Fields
|
|
[SerializeField]
|
|
[Header("Rotate Settings")]
|
|
[Tooltip("Direction to rotate in")]
|
|
protected Direction direction;
|
|
#endregion Inspector Fields
|
|
|
|
|
|
#region Class Functions
|
|
|
|
/// <summary>
|
|
/// Rotates the player in the direction specified by this block
|
|
/// </summary>
|
|
/// <param name="player">Player to rotate</param>
|
|
protected override void BlockLogic(Character player, float animationTime)
|
|
{
|
|
player.Rotate(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
|
|
}
|