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/Interfaces/Interaction.cs
2017-10-10 12:43:11 -05:00

52 lines
1.5 KiB
C#

using UnityEngine;
[CreateAssetMenu(menuName = "CharacterStateMachine/Interaction")]
public class Interaction : ScriptableObject
{
// Animation performed by the character
[Tooltip("Descriptions follow the prompt \"Press 'E' to ...\"")]
public string interactionDescription;
[Tooltip("Descriptions follow the prompt \"Press 'E' to ...\"")]
public string receiverDescription;
public CharacterAnimator.Params initiatorAnimationTrigger, objectAnimationTrigger;
public InteractionResult result;
public float initialRotation;
public float objectInitialRotation;
public float interactionDistance = 1.0f;
public enum InteractionResult
{
Nothing, SpyMissionComplete
}
public int GetHash()
{
return interactionDescription.Length + (int)initiatorAnimationTrigger + (int)objectAnimationTrigger;
}
public bool CompareHash(int hash)
{
return hash == GetHash();
}
public void ExecuteResult(StateController controller)
{
switch(result)
{
case InteractionResult.Nothing:
break;
case InteractionResult.SpyMissionComplete:
SpyMissionComplete(controller);
break;
default:
Debug.LogError("Invalid result selected for execution");
break;
}
}
//--------------------------------- Result functions ---------------------------------
void SpyMissionComplete(StateController controller)
{
Debug.Log("Completed mission");
}
}