This repository has been archived on 2025-04-11. You can view files and clone it, but cannot push or open issues or pull requests.
project-undercover/Project Undercover/Assets/Scripts/CharacterStateMachine/ActionScripts/SpyInteractAction.cs

31 lines
1.1 KiB
C#
Raw Normal View History

2017-10-03 04:15:13 -05:00
using UnityEngine;
using System;
[CreateAssetMenu(menuName = "CharacterStateMachine/Actions/SpyInteract")]
public class SpyInteractAction : Action
2017-10-03 04:15:13 -05:00
{
public override void StartAct(StateController controller)
{
2017-10-09 18:55:07 -05:00
controller.characterAnimator.SetTrigger(controller.SelectedInteraction.initiatorAnimationTrigger);
controller.characterAnimator.SetBool(CharacterAnimator.Params.Interacting, true);
controller.MoveForSelectedObjectInteraction();
2017-10-03 04:15:13 -05:00
}
public override void Act(StateController controller)
{
2017-10-08 18:37:19 -05:00
controller.FaceSelectedObject();
2017-10-03 04:15:13 -05:00
AnimatorStateInfo info = controller.animator.GetCurrentAnimatorStateInfo(0);
2017-10-09 18:55:07 -05:00
if (info.IsName(CharacterAnimator.GetParamName(controller.SelectedInteraction.initiatorAnimationTrigger)))
2017-10-05 13:53:29 -05:00
{
float progress = info.normalizedTime;
ProgressPanelController.ActivePanel.Progress = progress;
}
2017-10-03 04:15:13 -05:00
}
public override void EndAct(StateController controller)
{
2017-10-05 13:53:29 -05:00
// Debug.Log("Ending SpyInteract");
2017-10-03 04:15:13 -05:00
ProgressPanelController.ActivePanel.Hide();
controller.FinishInteraction();
2017-10-03 04:15:13 -05:00
}
}