Skip to content

Commit

Permalink
Merge branch 'develop' into feature/rotation
Browse files Browse the repository at this point in the history
  • Loading branch information
lenalinke authored Oct 11, 2024
2 parents 0d69b47 + eaa5f51 commit be67e24
Show file tree
Hide file tree
Showing 34 changed files with 2,986 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1755,6 +1755,9 @@ PrefabInstance:
- targetCorrespondingSourceObject: {fileID: 919132149155446097, guid: 26f8cd740528f3b469c4f32fe28b8306, type: 3}
insertIndex: -1
addedObject: {fileID: 4269083640301180635}
- targetCorrespondingSourceObject: {fileID: 919132149155446097, guid: 26f8cd740528f3b469c4f32fe28b8306, type: 3}
insertIndex: -1
addedObject: {fileID: 2241099583876537163}
m_SourcePrefab: {fileID: 100100000, guid: 26f8cd740528f3b469c4f32fe28b8306, type: 3}
--- !u!1 &212402951927973884 stripped
GameObject:
Expand Down Expand Up @@ -1882,6 +1885,102 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: afa2f315da5127e47a996e328f4ffff3, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!82 &2241099583876537163
AudioSource:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 212402951927973884}
m_Enabled: 1
serializedVersion: 4
OutputAudioMixerGroup: {fileID: 0}
m_audioClip: {fileID: 0}
m_PlayOnAwake: 1
m_Volume: 1
m_Pitch: 1
Loop: 0
Mute: 0
Spatialize: 0
SpatializePostEffects: 0
Priority: 128
DopplerLevel: 1
MinDistance: 1
MaxDistance: 500
Pan2D: 0
rolloffMode: 0
BypassEffects: 0
BypassListenerEffects: 0
BypassReverbZones: 0
rolloffCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 1
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
panLevelCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
spreadCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
reverbZoneMixCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
--- !u!4 &447753056685965252 stripped
Transform:
m_CorrespondingSourceObject: {fileID: -8645416474800241303, guid: 26f8cd740528f3b469c4f32fe28b8306, type: 3}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1757,6 +1757,9 @@ PrefabInstance:
- targetCorrespondingSourceObject: {fileID: 919132149155446097, guid: 26f8cd740528f3b469c4f32fe28b8306, type: 3}
insertIndex: -1
addedObject: {fileID: 8327870396362132631}
- targetCorrespondingSourceObject: {fileID: 919132149155446097, guid: 26f8cd740528f3b469c4f32fe28b8306, type: 3}
insertIndex: -1
addedObject: {fileID: 8651058445503294158}
m_SourcePrefab: {fileID: 100100000, guid: 26f8cd740528f3b469c4f32fe28b8306, type: 3}
--- !u!1 &212402951927973884 stripped
GameObject:
Expand Down Expand Up @@ -1884,6 +1887,102 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: afa2f315da5127e47a996e328f4ffff3, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!82 &8651058445503294158
AudioSource:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 212402951927973884}
m_Enabled: 1
serializedVersion: 4
OutputAudioMixerGroup: {fileID: 0}
m_audioClip: {fileID: 0}
m_PlayOnAwake: 1
m_Volume: 1
m_Pitch: 1
Loop: 0
Mute: 0
Spatialize: 0
SpatializePostEffects: 0
Priority: 128
DopplerLevel: 1
MinDistance: 1
MaxDistance: 500
Pan2D: 0
rolloffMode: 0
BypassEffects: 0
BypassListenerEffects: 0
BypassReverbZones: 0
rolloffCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 1
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
panLevelCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
spreadCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
reverbZoneMixCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
--- !u!4 &700674713753034054 stripped
Transform:
m_CorrespondingSourceObject: {fileID: -8679921383154817045, guid: 26f8cd740528f3b469c4f32fe28b8306, type: 3}
Expand Down
9 changes: 9 additions & 0 deletions Assets/Virtual Agents Framework/Runtime/Scripts/BaseTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,15 @@ public void StopAsFailed()
StopExecution();
}

/// <summary>
/// Can be used to abort the task outside of its Update method
/// </summary>
public void StopAsAborted()
{
State = TaskState.Aborted;
StopExecution();
}

/// <summary>
/// Can be used to let the task succseed outside of its Update method
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace i5.VirtualAgents.AgentTasks
{
/// <summary>
/// Starts or stops adaptive gaze on the agent and marks the task as completet afterwards.
/// Starts or stops adaptive gaze on the agent and marks the task as completed afterwards.
/// </summary>
public class AgentAdaptiveGazeTask : AgentBaseTask, ISerializable
{
Expand Down Expand Up @@ -60,12 +60,12 @@ public override void StartExecution(Agent agent)

public void Serialize(SerializationDataContainer serializer)
{
//TODO: add shouldStartOrStop when bool types are supported
//serializer.AddSerializedData("Should Start Or Stop", shouldStartOrStop);
}

public void Deserialize(SerializationDataContainer serializer)
{
//TODO: add shouldStartOrStop when bool types are supported
//shouldStartOrStop = serializer.GetSerializedBool("Should Start Or Stop");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -140,5 +140,14 @@ public void Deserialize(SerializationDataContainer serializer)
playTime = serializer.GetSerializedFloat("Play Time");
}

/// <summary>
/// Aborts the animation task and sets its state to aborted
/// </summary>
public override void Abort()
{
StopExecution();
State = TaskState.Aborted;
}

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
using UnityEngine;

namespace i5.VirtualAgents.AgentTasks
{
public class AgentAudioTask : AgentBaseTask, ISerializable
{
/// <summary>
/// The audio to be played
/// </summary>
public AudioClip Audio;

/// <summary>
/// The audio source which plays the audio
/// </summary>
public AudioSource AgentAudioSource;

/// <summary>
/// Creates a new audio task
/// </summary>
/// <param name="audio">The audio to be played</param>
public AgentAudioTask(AudioClip audio, int priority = 0)
{
Audio = audio;
}

/// <summary>
/// Starts the audio task
/// </summary>
/// <param name="agent">The agent which should execute the movement task</param>
public override void StartExecution(Agent agent)
{
base.StartExecution(agent);
AgentAudioSource = agent.GetComponent<AudioSource>();
AgentAudioSource.clip = Audio;
AgentAudioSource.Play();
}

public override TaskState EvaluateTaskState()
{
if (AgentAudioSource.time < Audio.length)
{
return TaskState.Running;
}
else
{
return TaskState.Success;
}
}
/// <summary>
/// Finish the task
/// </summary>
public override void StopExecution()
{
base.StopExecution();
AgentAudioSource.Stop();
}

/// <summary>
/// Method to pause the audio
/// </summary>
public void PauseAudio()
{
AgentAudioSource.Pause();
}

/// <summary>
/// Method to continue the audio
/// </summary>
public void ContinueAudio()
{
AgentAudioSource.UnPause();
}
public void Serialize(SerializationDataContainer serializer)
{
serializer.AddSerializedData("Audio", Audio);
serializer.AddSerializedData("Agent Audio Source", AgentAudioSource);
}

public void Deserialize(SerializationDataContainer serializer)
{
Audio = serializer.GetSerializedAudioClip("Audio");
AgentAudioSource = serializer.GetSerializedAudioSource("Agent Audio Source");
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit be67e24

Please sign in to comment.