Commit 8cd2bcde authored by Mikko Lainio's avatar Mikko Lainio 🇺🇦
Browse files

Merge branch 'narrative_stuff' of git.bitbybyte.fi:game-jam/fgj-19 into mikko

parents 764fd506 d8c90eaa
......@@ -28,7 +28,7 @@ AnimationClip:
outWeight: {x: 0, y: 0, z: 0}
- serializedVersion: 3
time: 0.33333334
value: {x: -5.229, y: 0, z: 16.95}
value: {x: -22.395, y: 0, z: 0}
inSlope: {x: -0.40000492, y: 0, z: -5.451427}
outSlope: {x: -0.40000492, y: 0, z: -5.451427}
tangentMode: 0
......@@ -244,7 +244,7 @@ AnimationClip:
outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334}
- serializedVersion: 3
time: 0.8333333
value: {x: -5.229, y: 0, z: 16.95}
value: {x: -22.395, y: 0, z: 0}
inSlope: {x: -0.40000492, y: 0, z: -5.451427}
outSlope: {x: -0.40000492, y: 0, z: -5.451427}
tangentMode: 0
......@@ -279,7 +279,7 @@ AnimationClip:
outWeight: {x: 0, y: 0, z: 0}
- serializedVersion: 3
time: 0.33333334
value: {x: -0.5, y: 1.08, z: -0}
value: {x: 0, y: 1.08, z: -0.05}
inSlope: {x: 0, y: 0, z: 0}
outSlope: {x: 0, y: 0, z: 0}
tangentMode: 0
......@@ -288,7 +288,7 @@ AnimationClip:
outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334}
- serializedVersion: 3
time: 0.8333333
value: {x: -0.5, y: 1.08, z: -0}
value: {x: 0, y: 1.08, z: -0.05}
inSlope: {x: 0, y: 0, z: 0}
outSlope: {x: 0, y: 0, z: 0}
tangentMode: 0
......@@ -368,7 +368,7 @@ AnimationClip:
outWeight: 0
- serializedVersion: 3
time: 0.33333334
value: -0.5
value: 0
inSlope: 0
outSlope: 0
tangentMode: 136
......@@ -377,7 +377,7 @@ AnimationClip:
outWeight: 0.33333334
- serializedVersion: 3
time: 0.8333333
value: -0.5
value: 0
inSlope: 0
outSlope: 0
tangentMode: 136
......@@ -460,7 +460,7 @@ AnimationClip:
outWeight: 0
- serializedVersion: 3
time: 0.33333334
value: -0
value: -0.05
inSlope: 0
outSlope: 0
tangentMode: 136
......@@ -469,7 +469,7 @@ AnimationClip:
outWeight: 0.33333334
- serializedVersion: 3
time: 0.8333333
value: -0
value: -0.05
inSlope: 0
outSlope: 0
tangentMode: 136
......@@ -506,7 +506,7 @@ AnimationClip:
outWeight: 0
- serializedVersion: 3
time: 0.33333334
value: -5.229
value: -22.395
inSlope: -0.40000492
outSlope: -0.40000492
tangentMode: 136
......@@ -722,7 +722,7 @@ AnimationClip:
outWeight: 0.33333334
- serializedVersion: 3
time: 0.8333333
value: -5.229
value: -22.395
inSlope: -0.40000492
outSlope: -0.40000492
tangentMode: 136
......@@ -1012,7 +1012,7 @@ AnimationClip:
outWeight: 0
- serializedVersion: 3
time: 0.33333334
value: 16.95
value: 0
inSlope: -5.451427
outSlope: -5.451427
tangentMode: 136
......@@ -1228,7 +1228,7 @@ AnimationClip:
outWeight: 0.33333334
- serializedVersion: 3
time: 0.8333333
value: 16.95
value: 0
inSlope: -5.451427
outSlope: -5.451427
tangentMode: 136
......
......@@ -13,6 +13,7 @@ MonoBehaviour:
m_Name: AgentDataTest
m_EditorClassIdentifier:
name_: testagent
startDestination_: 2
roomOrder_: e8030000d0070000b80b0000e8030000
finalDestination_: 1
minMaxWaitTimes_: {x: 1, y: 5}
......
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 54d551ea7dcffa84f8c9346ef4d12461, type: 3}
m_Name: Goth_Man
m_EditorClassIdentifier:
name_: Goth
roomOrder_:
finalDestination_: 0
minMaxWaitTimes_: {x: 1, y: 5}
narrativeData_: {fileID: 0}
startingSatisfaction_: 10
startingHorror_: 0
horrorThreshold_: 100
satisfactionThreshold_: 100
likes_:
dislikes_:
fears_:
fileFormatVersion: 2
guid: 9a15921731febc848bd93188ed6b4c93
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 54d551ea7dcffa84f8c9346ef4d12461, type: 3}
m_Name: Mr_Boring
m_EditorClassIdentifier:
name_: Mr Boring
startDestination_: 2
roomOrder_: e9030000d0070000a00f000088130000b80b0000ea030000a10f0000ba0b0000d1070000e8030000
finalDestination_: 1
minMaxWaitTimes_: {x: 1, y: 5}
narrativeData_: {fileID: 11400000, guid: ad1eef3a922ee9e488b71c28ac627dd1, type: 2}
startingSatisfaction_: 10
startingHorror_: 0
horrorThreshold_: 40
satisfactionThreshold_: 100
likes_: b80b0000a00f000088130000401f000028230000
dislikes_: e8030000d007000070170000581b0000
fears_: e8030000d0070000
fileFormatVersion: 2
guid: 0287d80168d280f44a09822e943a4bdd
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:
......@@ -43,7 +43,11 @@ MonoBehaviour:
- trigger_: 1000
comments_:
- Yikes! That's scary!
specificStartComments_: []
specificStartComments_:
- comments_: Comment 1
- comments_: Comment 2
- comments_: Comment 3
- comments_: Comment 4
endSatisfactionFailComment_: Failed satisfaction
endSatisfactionSucceedComment_: Satisfaction succeeded
endHorrorFailComment_: End in horror
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 041eab080a9e2184c9dc9625061262cf, type: 3}
m_Name: Narrative_MrBoring
m_EditorClassIdentifier:
name_: MrBoringNarrative
randomRoomEnterComments_:
- targetRoom_: 1001
comments_:
- Is this a good place to bird-watch from?
- What wood is this? Mahogany?
- No worms in the wood, right? Ha ha.
- targetRoom_: 2000
comments_:
- Oh my.
- How many rooms is this again?
- That carpet will get dirty.
- targetRoom_: 4000
comments_:
- How nice.
- Very spacious.
- Might need some redecoration.
- Beautiful windows.
- targetRoom_: 5000
comments_:
- This can fit the whole clan.
- Imagine having Christmas dinner here.
- The Jones's will be so jealous.
- The furniture IS included, right?
- targetRoom_: 3000
comments_:
- My wife will love this.
- Very big. Yes.
- Was this recently renovated?
- Lovely.
- targetRoom_: 1002
comments_:
- 'Does the sun set or rise here? '
- Is this cold in the autumn?
- Maybe we could put a TV out here...
- Oh! Is that..the forest?
- targetRoom_: 4001
comments_:
- How many living rooms did you say?
- So fancy.
- Is this wallpaper? No...of course not.
- targetRoom_: 3002
comments_:
- Wow.
- So much space.
- I can keep my stamp collection here.
- Very nice.
- What's that smell..?
randomRoomExitComments_: []
randomTriggerComments_:
- trigger_: 1000
comments_:
- What on Earth?!
- Who did that?!
- Is this a prank?!
- Aaah!
- trigger_: 2000
comments_:
- Why is it so dark?
- Turn on the light!
- Ow! I stubbed my toe.
- trigger_: 6000
comments_:
- Hmmmmmmmm.
- '...ew. '
- Ugh. So dirty.
- trigger_: 7000
comments_:
- Huh?!
- Yikes!
- Boy howdy!
- trigger_: 3000
comments_:
- So nice and bright.
- I love the light in here!
- Lovely.
- trigger_: 4000
comments_:
- Oh, that's...green.
- I have hay fever.
- trigger_: 8000
comments_:
- Is this vintage?
- This must be from the 1800s!
- How much is this worth?
- My wife will love this.
- trigger_: 9000
comments_:
- Ooh, shiny!
- How modern!
- Recently renovated?
- trigger_: 5000
comments_:
- Very neat.
- This sparks joy in me.
- Everything in its place.
specificStartComments_:
- comments_: I'm so happy to be here.
- comments_: Me and my wife have been looking for ages for a good house.
- comments_: But the price makes me afraid the inside...
- comments_: '...might not be as nice as the outside!'
- comments_: All we want is a tidy, bright and quiet house!
- comments_: Not much to ask for.
endSatisfactionFailComment_: Thank you, but...I understand why the house is so cheap
now!
endSatisfactionSucceedComment_: This house is -perfect- for us! We'll sign the papers
tomorrow!
endHorrorFailComment_: THIS IS NOT WHAT I SIGNED UP FOR!!!!
fileFormatVersion: 2
guid: ad1eef3a922ee9e488b71c28ac627dd1
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:
This diff is collapsed.
......@@ -9,10 +9,10 @@ GameObject:
serializedVersion: 6
m_Component:
- component: {fileID: 2865136356149113059}
- component: {fileID: 330183763225704209}
- component: {fileID: 2865136356149113056}
- component: {fileID: 2865136356149113057}
- component: {fileID: 2865136356149113070}
- component: {fileID: 330183763225704209}
- component: {fileID: 3134045385634265904}
m_Layer: 0
m_Name: Waypoint
......@@ -35,6 +35,20 @@ Transform:
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &330183763225704209
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2865136356149113060}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4881ccc52f03a0743a2a88c1c6ae4b81, type: 3}
m_Name:
m_EditorClassIdentifier:
room_: 0
trigger_: {fileID: 3134045385634265904}
--- !u!33 &2865136356149113056
MeshFilter:
m_ObjectHideFlags: 0
......@@ -91,22 +105,8 @@ SphereCollider:
m_IsTrigger: 1
m_Enabled: 1
serializedVersion: 2
m_Radius: 3
m_Radius: 1
m_Center: {x: 0, y: 0, z: 0}
--- !u!114 &330183763225704209
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2865136356149113060}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4881ccc52f03a0743a2a88c1c6ae4b81, type: 3}
m_Name:
m_EditorClassIdentifier:
data_: {fileID: 0}
trigger_: {fileID: 3134045385634265904}
--- !u!114 &3134045385634265904
MonoBehaviour:
m_ObjectHideFlags: 0
......@@ -135,3 +135,4 @@ MonoBehaviour:
m_Calls: []
m_TypeName: ItemTriggered, Assembly-CSharp, Version=0.0.0.0, Culture=neutral,
PublicKeyToken=null
wp_: {fileID: 0}
......@@ -37,6 +37,7 @@ public class Agent : MonoBehaviour
public onAgentSatisfactionChanged satisfactionChangedEvent_;
private Coroutine talkRoutine;
// Start is called before the first frame update
void Start()
{
......@@ -53,7 +54,8 @@ public class Agent : MonoBehaviour
speechBubble_.GetComponentInChildren<TMP_Text>();
}
speechBubble_.gameObject.SetActive(false);
if (animator_ == null){
if (animator_ == null)
{
animator_ = GetComponentInChildren<Animator>();
}
// Adds listeners to all the enter/exit events...
......@@ -132,14 +134,14 @@ public class Agent : MonoBehaviour
{
if (agent == this)
{
AgentSay(data_.narrativeData_.GetRandomComment(GetEnterRoomComments(wp.data_.room_)));
AgentSay(data_.narrativeData_.GetRandomComment(GetEnterRoomComments(wp.room_)));
};
}
void AgentWPExit(Waypoint wp, Agent agent)
{
if (agent == this)
{
AgentSay(data_.narrativeData_.GetRandomComment(GetExitRoomComments(wp.data_.room_)));
AgentSay(data_.narrativeData_.GetRandomComment(GetExitRoomComments(wp.room_)));
};
}
public void AgentSay(string text, bool pauseWhileSaying = false, bool forceSay = false)
......@@ -152,7 +154,8 @@ public class Agent : MonoBehaviour
//StopCoroutine(talkRoutine);
return;
}
else if (forceSay && talkRoutine != null){
else if (forceSay && talkRoutine != null)
{
StopCoroutine(talkRoutine);
}
talkRoutine = this.StartCoroutine(FadeSpeechBubbleInOut(time, text, pauseWhileSaying));
......@@ -161,6 +164,20 @@ public class Agent : MonoBehaviour
public void AgentStart()
{
StartCoroutine(AgentStartTalk());
}
IEnumerator AgentStartTalk()
{
// Just talk through all starting comments, after reaching first wp
Vector3 targetLoc = GameManager.instance.GetRoomWaypoints(data_.startDestination_)[0].transform.position;
SetTarget(targetLoc);
yield return new WaitUntil(() => Vector3.Distance(transform.position, targetLoc) < 1f);
foreach (StartComment comm in data_.narrativeData_.specificStartComments_)
{
yield return new WaitUntil(() => talkRoutine == null);
AgentSay(comm.comments_, true, true);
}
StartWalk(this);
}
......@@ -171,12 +188,12 @@ public class Agent : MonoBehaviour
power = +power;
AgentSatisfactionChange(power, trigger);
}
else if (data_.dislikes_.Contains(trigger))
if (data_.dislikes_.Contains(trigger))
{
power = -power;
AgentSatisfactionChange(power, trigger);
}
else if (data_.fears_.Contains(trigger))
if (data_.fears_.Contains(trigger))
{
AgentHorrorChange(power, trigger);
}
......@@ -274,7 +291,7 @@ public class Agent : MonoBehaviour
Stop(false);
}
public void StartWalk(Agent agent)
void StartWalk(Agent agent)
{
agent.StartCoroutine(Walk(agent));
}
......@@ -285,7 +302,7 @@ public class Agent : MonoBehaviour
{
List<Waypoint> wayPoints = new List<Waypoint>();
wayPoints = GameManager.instance.GetRoomWaypoints(data_.roomOrder_[i]);
foreach (Waypoint wp in wayPoints)
{
Vector3 targetLoc = wp.transform.position;
......@@ -302,18 +319,19 @@ public class Agent : MonoBehaviour
agentEndWalk_ = true;
break;
}
if (currentSatisfaction_ >= data_.satisfactionThreshold_)
{
agent.AgentSay(data_.narrativeData_.endSatisfactionSucceedComment_, true, true);
agentEndWalk_ = true;
break;
}
Debug.Log("Finished room " + data_.roomOrder_[i]);
}
// Extra check for satisfaction failed
// Check if satisfaction is enough to win.
if (!agentEndWalk_)
{
agent.AgentSay(data_.narrativeData_.endSatisfactionFailComment_, true, true);
if (currentSatisfaction_ >= data_.satisfactionThreshold_)
{
agent.AgentSay(data_.narrativeData_.endSatisfactionSucceedComment_, true, true);
}
else
{
agent.AgentSay(data_.narrativeData_.endSatisfactionFailComment_, true, true);
};
agentEndWalk_ = true;
}
// We set the agent to walk to its final destination, and give the appropriate comment
......@@ -331,4 +349,4 @@ public class Agent : MonoBehaviour
animator_.SetFloat("speed", agent_.velocity.magnitude);
}
}
}
\ No newline at end of file
......@@ -20,6 +20,8 @@ public enum AgentTriggers
public class AgentData : ScriptableObjectBase
{
// First wp to go to
public Room startDestination_;
// The order in which they will go through the rooms
public Room[] roomOrder_;
// The final spot they will walk to after finishing
......@@ -38,5 +40,5 @@ public class AgentData : ScriptableObjectBase
public List<AgentTriggers> dislikes_ = new List<AgentTriggers> { };
public List<AgentTriggers> fears_ = new List<AgentTriggers> { };
}
......@@ -32,13 +32,13 @@ public class GameManager : MonoBehaviour
// Create a dictionary with all the waypoints mapped to a certain room
foreach (Waypoint wp in allWaypoints)
{
if (!waypoints.ContainsKey(wp.data_.room_))
if (!waypoints.ContainsKey(wp.room_))
{
waypoints.Add(wp.data_.room_, new List<Waypoint> { wp });
waypoints.Add(wp.room_, new List<Waypoint> { wp });
}
else
{
waypoints[wp.data_.room_].Add(wp);
waypoints[wp.room_].Add(wp);
}
}
}
......
......@@ -25,8 +25,7 @@ public class TriggerComment
[System.Serializable]
public class StartComment
{ // Will say all of these during start in the order of priority. Same priority will talk at the same time. Not yet functional.
public int priority = 0;
public string dialogue_;
public string comments_;
}
[CreateAssetMenu(fileName = "Data", menuName = "Narrative Data", order = 1)]
......
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
public enum Room
{
NONE = 0000,
OFFSCREEN = 0001,
STARTPOINT = 0002,
DRIVEWAY = 1000,
PORCH = 1001,
BACK_PORCH = 1002,
PATIO = 1003,
ENTRY_HALL = 2000,
ROTUNDA = 2001,
KITCHEN = 3000,
UTILITY_ROOM = 3001,
GARAGE = 3002,
LIVING_ROOM_1 = 4000,
LIVING_ROOM_2 = 4001,
LIVING_ROOM_3 = 4002,
DINING_ROOM = 5000,
STUDY_1 = 6000,
MASTER_BEDROOM = 7000,
BEDROOM_1 = 8000,
BATHROOM_1 = 9000
BATHROOM_1 = 9000,