Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
ColdShot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
15박보승
ColdShot
Commits
71e26126
Commit
71e26126
authored
Jan 17, 2020
by
15박보승
Committed by
18류지석
Jan 17, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Dialogue System WIP
parent
8cfc3dea
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
116 additions
and
0 deletions
+116
-0
Dialogue.cs
Assets/Dialogue.cs
+33
-0
Dialogue.cs.meta
Assets/Dialogue.cs.meta
+11
-0
DialogueSystem.cs
Assets/DialogueSystem.cs
+61
-0
DialogueSystem.cs.meta
Assets/DialogueSystem.cs.meta
+11
-0
No files found.
Assets/Dialogue.cs
0 → 100644
View file @
71e26126
using
System.Collections
;
using
System.Collections.Generic
;
using
UnityEngine
;
using
BS
;
public
class
DialogueScene
:
ScriptableObject
{
[
SerializeField
]
private
List
<
Dialogue
>
dialogues
;
private
int
dialogueIndex
=
0
;
public
bool
IsEnd
{
get
{
return
dialogueIndex
>=
dialogues
.
Count
;
}
}
public
bool
IsStart
{
get
{
return
dialogueIndex
==
0
;
}
}
public
Dialogue
GetNextDialogue
()
{
return
dialogues
[
dialogueIndex
++];
}
public
Dialogue
GetPrevDialogue
()
{
return
dialogues
[
dialogueIndex
--];
}
}
[
System
.
Serializable
]
public
struct
Dialogue
{
public
string
characterName
;
public
string
dialogue
;
public
int
imageIndex
;
}
\ No newline at end of file
Assets/Dialogue.cs.meta
0 → 100644
View file @
71e26126
fileFormatVersion: 2
guid: dae6c022c564874489089cfdac8364b2
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
Assets/DialogueSystem.cs
0 → 100644
View file @
71e26126
using
System.Collections
;
using
System.Collections.Generic
;
using
UnityEngine
;
using
UnityEngine.UI
;
public
enum
TypingType
{
LETTER
,
// One letter typing time == dialogueTypingSpeed
SENTENCE
}
public
class
DialogueSystem
:
MonoBehaviour
{
public
float
dialogueTypingSpeed
=
0.1f
;
public
TypingType
typingType
=
TypingType
.
LETTER
;
public
Text
dialogueText
;
public
Text
nameText
;
public
Button
nextDialogueButton
;
public
Button
prevDialogueButton
;
public
List
<
Image
>
characterImages
=
new
List
<
Image
>();
private
DialogueScene
dialogueScene
;
public
void
LoadDialogueScene
(
DialogueScene
dialogueScene
)
{
this
.
dialogueScene
=
dialogueScene
;
}
public
void
NextDialogue
()
{
Dialogue
dialogue
=
dialogueScene
.
GetNextDialogue
();
nameText
.
text
=
dialogue
.
characterName
;
StartCoroutine
(
TypingDialogue
(
dialogue
.
dialogue
));
}
public
void
PrevDialogue
()
{
Dialogue
dialogue
=
dialogueScene
.
GetPrevDialogue
();
nameText
.
text
=
dialogue
.
characterName
;
StartCoroutine
(
TypingDialogue
(
dialogue
.
dialogue
));
}
public
IEnumerator
TypingDialogue
(
string
dialogue
)
{
float
typingTime
=
dialogueTypingSpeed
;
if
(
typingType
==
TypingType
.
SENTENCE
)
{
typingTime
/=
dialogue
.
Length
;
}
for
(
int
i
=
0
;
i
<
dialogue
.
Length
;
i
++)
{
dialogueText
.
text
+=
dialogue
[
i
];
yield
return
new
WaitForSeconds
(
dialogueTypingSpeed
);
}
}
}
\ No newline at end of file
Assets/DialogueSystem.cs.meta
0 → 100644
View file @
71e26126
fileFormatVersion: 2
guid: 984475bd0b628284684fe89439e89898
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment