Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
tetra-tower
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Oenos
tetra-tower
Commits
1569e03d
Commit
1569e03d
authored
Jan 23, 2019
by
abpo11
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
콤보 시스템 만듬
parent
f67cf105
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
234 additions
and
7 deletions
+234
-7
PlayScene.unity
Assets/Scenes/PlayScene.unity
+17
-0
AttackCombo.cs
Assets/Scripts/Characters/AttackCombo.cs
+32
-0
AttackCombo.cs.meta
Assets/Scripts/Characters/AttackCombo.cs.meta
+11
-0
PlayerAttack.cs
Assets/Scripts/Characters/PlayerAttack.cs
+139
-0
PlayerAttack.cs.meta
Assets/Scripts/Characters/PlayerAttack.cs.meta
+11
-0
Enumerators.cs
Assets/Scripts/Enumerators.cs
+2
-1
InputManager.asset
ProjectSettings/InputManager.asset
+22
-6
No files found.
Assets/Scenes/PlayScene.unity
View file @
1569e03d
...
...
@@ -265,6 +265,23 @@ GameObject:
m_CorrespondingSourceObject
:
{
fileID
:
1623439448163086
,
guid
:
3d077a5f727dd1e4780e9265ed26e036
,
type
:
2
}
m_PrefabInternal
:
{
fileID
:
1618052740
}
---
!u!114
&489222434
MonoBehaviour
:
m_ObjectHideFlags
:
0
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInternal
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
489222433
}
m_Enabled
:
1
m_EditorHideFlags
:
0
m_Script
:
{
fileID
:
11500000
,
guid
:
4ab58a64164eb984d8683df370ddce96
,
type
:
3
}
m_Name
:
m_EditorClassIdentifier
:
state
:
0
attackA
:
0
attackB
:
0
attackC
:
0
comboArray
:
StartTime
:
0
---
!u!1001
&677608594
Prefab
:
m_ObjectHideFlags
:
0
...
...
Assets/Scripts/Characters/AttackCombo.cs
0 → 100644
View file @
1569e03d
public
class
AttackCombo
{
float
time
;
//시전시간 1.5초
string
name
;
//화염발사!
string
combo
;
//"ABCACBAC"
public
AttackCombo
(
string
name
,
string
combo
,
float
time
)
{
this
.
time
=
time
;
this
.
name
=
name
;
this
.
combo
=
combo
;
}
public
override
string
ToString
()
{
return
name
;
}
public
override
bool
Equals
(
object
obj
)
{
return
combo
.
Equals
(
obj
);
}
public
override
int
GetHashCode
()
{
return
base
.
GetHashCode
();
}
public
float
getTime
()
{
return
time
;
}
}
\ No newline at end of file
Assets/Scripts/Characters/AttackCombo.cs.meta
0 → 100644
View file @
1569e03d
fileFormatVersion: 2
guid: edea51a314af27047a14dcdc911cf7ab
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
Assets/Scripts/Characters/PlayerAttack.cs
0 → 100644
View file @
1569e03d
using
System.Collections
;
using
System.Collections.Generic
;
using
UnityEngine
;
public
class
PlayerAttack
:
MonoBehaviour
{
public
ComboState
state
;
public
float
attackA
,
attackB
,
attackC
;
public
float
cancel
;
public
string
comboArray
;
public
float
StartTime
;
public
bool
keyCoolDown
=
true
;
public
AttackCombo
[]
AttackArr
=
{
new
AttackCombo
(
"화염발사"
,
"ABC"
,
1.5f
),
new
AttackCombo
(
"공격A"
,
"A"
,
0.5f
),
new
AttackCombo
(
"공격B"
,
"B"
,
0.5f
),
new
AttackCombo
(
"공격C"
,
"C"
,
0.5f
),
new
AttackCombo
(
"콩"
,
"AC"
,
1f
),
new
AttackCombo
(
"콩콩콩"
,
"ACB"
,
2f
),
};
public
Queue
comboQueue
=
new
Queue
();
// Use this for initialization
void
Start
()
{
StartTime
=
Time
.
time
;
state
=
ComboState
.
Idle
;
}
// Update is called once per frame
void
Update
()
{
attackA
=
Input
.
GetAxisRaw
(
"Fire1"
);
attackB
=
Input
.
GetAxisRaw
(
"Fire2"
);
attackC
=
Input
.
GetAxisRaw
(
"Fire3"
);
cancel
=
Input
.
GetAxisRaw
(
"stop"
);
if
(
attackA
+
attackB
+
attackC
==
0
)
{
keyCoolDown
=
true
;
}
if
(
state
==
ComboState
.
Idle
)
{
if
(
attackA
+
attackB
+
attackC
>
0
&&
keyCoolDown
)
{
state
=
ComboState
.
Attack
;
StartTime
=
Time
.
time
;
ComboCheck
();
}
}
else
if
(
state
==
ComboState
.
Attack
)
{
ComboCheck
();
//공격중일때
if
(
Time
.
time
>
StartTime
)
{
state
=
ComboState
.
Combo
;
}
}
else
if
(
state
==
ComboState
.
Combo
)
{
ComboCheck
();
if
(
comboQueue
.
Count
>
0
)
//콤보가 남아있다면
{
AttackCombo
cur
=
(
AttackCombo
)
comboQueue
.
Dequeue
();
print
(
cur
);
state
=
ComboState
.
Attack
;
StartTime
=
Time
.
time
+
cur
.
getTime
();
}
else
if
(
Time
.
time
>
StartTime
+
1f
||
cancel
==
1
)
{
//현재 시간이 마지막 콤보 끝나는 시점보다 1초 지났다면
state
=
ComboState
.
Idle
;
comboArray
=
""
;
}
}
if
(
attackA
+
attackB
+
attackC
>
0
)
{
keyCoolDown
=
false
;
}
}
void
ComboCheck
()
{
//들어갈 콤보가 있는지 확인함
if
(
attackA
+
attackB
+
attackC
>
0
&&
keyCoolDown
)
{
if
(
attackA
==
1
)
{
comboArray
+=
"A"
;
}
else
if
(
attackB
==
1
)
{
comboArray
+=
"B"
;
}
else
if
(
attackC
==
1
)
{
comboArray
+=
"C"
;
}
bool
success
=
false
;
foreach
(
AttackCombo
com
in
AttackArr
)
{
if
(
com
.
Equals
(
comboArray
))
{
comboQueue
.
Enqueue
(
com
);
success
=
true
;
}
}
if
(
success
==
false
)
//콤보 실행에 실패했다면
{
string
temp
=
comboArray
[
comboArray
.
Length
-
1
]+
""
;
foreach
(
AttackCombo
com2
in
AttackArr
)
//기본 글자 콤보 실행
{
if
(
com2
.
Equals
(
temp
))
{
comboQueue
.
Enqueue
(
com2
);
}
}
}
}
}
}
Assets/Scripts/Characters/PlayerAttack.cs.meta
0 → 100644
View file @
1569e03d
fileFormatVersion: 2
guid: 4ab58a64164eb984d8683df370ddce96
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
Assets/Scripts/Enumerators.cs
View file @
1569e03d
...
...
@@ -30,12 +30,13 @@ public enum ItemType
}
public
enum
PlayerState
{
Idle
,
Walk
,
Run
,
GoingUp
,
GoingDown
,
Rope
}
public
enum
ComboState
{
Idle
,
Combo
,
Attack
}
/// <summary>
/// Enum for game's state.
/// </summary>
public
enum
GameState
{
MainMenu
,
Ingame
,
Tetris
,
Pause
,
Inventory
,
GameOver
}
/// <summary>
/// Enum for room types.
/// </summary>
...
...
ProjectSettings/InputManager.asset
View file @
1569e03d
...
...
@@ -42,9 +42,9 @@ InputManager:
descriptiveName
:
descriptiveNegativeName
:
negativeButton
:
positiveButton
:
left ctrl
positiveButton
:
z
altNegativeButton
:
altPositiveButton
:
mouse
0
altPositiveButton
:
gravity
:
1000
dead
:
0.001
sensitivity
:
1000
...
...
@@ -58,9 +58,9 @@ InputManager:
descriptiveName
:
descriptiveNegativeName
:
negativeButton
:
positiveButton
:
left alt
positiveButton
:
x
altNegativeButton
:
altPositiveButton
:
mouse
1
altPositiveButton
:
gravity
:
1000
dead
:
0.001
sensitivity
:
1000
...
...
@@ -74,9 +74,25 @@ InputManager:
descriptiveName
:
descriptiveNegativeName
:
negativeButton
:
positiveButton
:
left shift
positiveButton
:
c
altNegativeButton
:
altPositiveButton
:
mouse
2
altPositiveButton
:
gravity
:
1000
dead
:
0.001
sensitivity
:
1000
snap
:
0
invert
:
0
type
:
0
axis
:
0
joyNum
:
0
-
serializedVersion
:
3
m_Name
:
stop
descriptiveName
:
descriptiveNegativeName
:
negativeButton
:
positiveButton
:
v
altNegativeButton
:
altPositiveButton
:
gravity
:
1000
dead
:
0.001
sensitivity
:
1000
...
...
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