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
f2b91f41
Commit
f2b91f41
authored
Feb 16, 2019
by
18류지석
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
생명석 조각을 먹어서 채우는 것이 아닌 생명석 회복 구현(아이템 효과) 식탐 애드온 효과 구현, 활에 애드온 적용 안되던 버그 수정, 아이템풀 일부 수정
parent
2f7f0143
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
86 additions
and
22 deletions
+86
-22
AttackProperty.cs
Assets/Scripts/Characters/AttackProperty.cs
+5
-0
PlayerAttack.cs
Assets/Scripts/Characters/PlayerAttack.cs
+1
-1
Gluttony.cs
Assets/Scripts/Item/Addons/Gluttony.cs
+4
-2
InventoryManager.cs
Assets/Scripts/Item/InventoryManager.cs
+8
-3
Bow.cs
Assets/Scripts/Item/Items/Bow.cs
+4
-2
LifeStoneManager.cs
...Scripts/UI/In-game UI/LifeStoneScript/LifeStoneManager.cs
+55
-3
LifeUnitInFrame.cs
.../Scripts/UI/In-game UI/LifeStoneScript/LifeUnitInFrame.cs
+9
-11
No files found.
Assets/Scripts/Characters/AttackProperty.cs
View file @
f2b91f41
...
...
@@ -19,6 +19,11 @@ public class AttackProperty : MonoBehaviour{
inventoryManager
=
InventoryManager
.
Instance
;
}
public
void
Init
(
string
combo
)
{
attackCombo
=
combo
;
}
private
void
OnTriggerEnter2D
(
Collider2D
collision
)
{
...
...
Assets/Scripts/Characters/PlayerAttack.cs
View file @
f2b91f41
...
...
@@ -54,7 +54,7 @@ public class PlayerAttack : MonoBehaviour {
if
(
playerController
.
playerState
==
PlayerState
.
GoingUp
||
playerController
.
playerState
==
PlayerState
.
GoingDown
)
playerController
.
airAttack
=
false
;
comboArray
+=
(
char
)(
'A'
+
i
);
attackProperty
.
attackCombo
=
comboArray
;
attackProperty
.
Init
(
comboArray
)
;
CheckCombo
();
SetComboText
();
break
;
...
...
Assets/Scripts/Item/Addons/Gluttony.cs
View file @
f2b91f41
...
...
@@ -7,6 +7,7 @@ using UnityEngine;
/// </summary>
public
class
Gluttony
:
Addon
{
LifeStoneManager
lifeStoneManager
;
public
override
void
Declare
()
{
id
=
17
;
name
=
"식탐"
;
...
...
@@ -15,12 +16,13 @@ public class Gluttony : Addon
sprite
=
Resources
.
Load
<
Sprite
>(
"Sprites/Addons/parchment piece"
);
;
highlight
=
Resources
.
Load
<
Sprite
>(
"Sprites/Addons/parchment piece"
);
;
sizeInventory
=
new
Vector2
(
80
,
80
);
lifeStoneManager
=
GameObject
.
Find
(
"LifeStoneUI"
).
GetComponent
<
LifeStoneManager
>();
}
public
override
void
OtherEffect
(
PlayerAttackInfo
attackInfo
,
Enemy
enemyInfo
,
string
combo
)
{
if
(
attackInfo
.
damage
>
enemyInfo
.
currHealth
)
if
(
attackInfo
.
damage
>
=
enemyInfo
.
currHealth
)
{
//생명석 2개 회복
lifeStoneManager
.
FillLifeStone
(
1
,
LifeStoneType
.
Normal
);
}
}
}
\ No newline at end of file
Assets/Scripts/Item/InventoryManager.cs
View file @
f2b91f41
...
...
@@ -24,6 +24,7 @@ public class InventoryManager : Singleton<InventoryManager> {
SetPool
();
ItemInstantiate
(
"Dagger"
,
player
.
transform
.
position
,
0f
);
AddonInstantiate
(
"ParchmentPiece"
,
player
.
transform
.
position
,
0f
);
AddonInstantiate
(
"Gluttony"
,
player
.
transform
.
position
,
0f
);
ItemInstantiate
(
"Bow"
,
player
.
transform
.
position
,
0f
);
StartCoroutine
(
TestCoroutine
());
...
...
@@ -57,13 +58,17 @@ public class InventoryManager : Singleton<InventoryManager> {
addonPool
[
0
].
Add
(
"ParchmentPiece"
);
addonPool
[
0
].
Add
(
"KnightsStirrup"
);
addonPool
[
0
].
Add
(
"ApprenticesMark"
);
addonPool
[
1
].
Add
(
"
GlowingHerb
"
);
addonPool
[
1
].
Add
(
"
BlacksmithsBrooch
"
);
addonPool
[
1
].
Add
(
"CoollyPride"
);
addonPool
[
1
].
Add
(
"GlowingHerb"
);
addonPool
[
1
].
Add
(
"Gluttony"
);
addonPool
[
1
].
Add
(
"SmallLens"
);
//addonPool[2].Add("");
addonPool
[
2
].
Add
(
"JanusCoin"
);
addonPool
[
2
].
Add
(
"DesignofRagur"
);
addonPool
[
2
].
Add
(
"Sandbag"
);
//addonPool[3].Add("");
...
...
Assets/Scripts/Item/Items/Bow.cs
View file @
f2b91f41
...
...
@@ -36,7 +36,8 @@ public class Bow : Item {
yield
return
new
WaitForSeconds
(
0.3f
);
GameObject
tmpObj
=
Object
.
Instantiate
(
arrow
,
player
.
transform
.
position
,
Quaternion
.
identity
);
tmpObj
.
transform
.
localScale
=
new
Vector3
(
Mathf
.
Sign
(
player
.
transform
.
localScale
.
x
),
1
,
1
);
tmpObj
.
GetComponent
<
Rigidbody2D
>().
velocity
=
new
Vector2
(-
10f
*
Mathf
.
Sign
(
player
.
transform
.
localScale
.
x
),
0f
);
tmpObj
.
GetComponent
<
Rigidbody2D
>().
velocity
=
new
Vector2
(-
15f
*
Mathf
.
Sign
(
player
.
transform
.
localScale
.
x
),
0f
);
tmpObj
.
GetComponent
<
AttackProperty
>().
Init
(
combo
[
0
]);
}
protected
override
void
PlaySkill2
()
{
...
...
@@ -46,6 +47,7 @@ public class Bow : Item {
{
yield
return
new
WaitForSeconds
(
0.3f
);
GameObject
tmpObj
=
Object
.
Instantiate
(
arrow
,
player
.
transform
.
position
,
Quaternion
.
Euler
(
0
,
0
,
-
90f
));
tmpObj
.
GetComponent
<
Rigidbody2D
>().
velocity
=
new
Vector2
(
0f
,
10f
);
tmpObj
.
GetComponent
<
Rigidbody2D
>().
velocity
=
new
Vector2
(
0f
,
15f
);
tmpObj
.
GetComponent
<
AttackProperty
>().
Init
(
combo
[
1
]);
}
}
Assets/Scripts/UI/In-game UI/LifeStoneScript/LifeStoneManager.cs
View file @
f2b91f41
using
System.Collections
;
using
System.Collections.Generic
;
using
UnityEngine
;
[
RequireComponent
(
typeof
(
RectTransform
))]
public
class
LifeStoneManager
:
MonoBehaviour
{
/// <summary>
/// Location of lifeStoneFrame on Canvas
...
...
@@ -67,14 +66,13 @@ public class LifeStoneManager : MonoBehaviour {
lifeStoneArray
=
new
int
[
50
,
3
];
lifeStoneUnit
=
new
GameObject
[
50
,
3
];
for
(
int
i
=
0
;
i
<
50
;
i
++)
for
(
int
j
=
0
;
j
<
3
;
j
++)
lifeStoneArray
[
i
,
j
]
=
0
;
//StartCoroutine("TestEnumerator");
PushLifeStone
(
CreateLifeStoneInfo
(
new
Vector2Int
(
3
,
6
),
0
,
0
));
StartCoroutine
(
"TestEnumerator"
);
}
IEnumerator
TestEnumerator
()
{
yield
return
null
;
}
/// <summary>
...
...
@@ -118,6 +116,8 @@ public class LifeStoneManager : MonoBehaviour {
StartCoroutine
(
PopoutCoroutine
(
obj
));
}
/// <summary>
/// Instantiate Dropped LifeStone
/// </summary>
...
...
@@ -334,6 +334,7 @@ public class LifeStoneManager : MonoBehaviour {
new
Vector2Int
(
xtmp
,
ytmp
),
new
Vector2Int
(
xtmp
,
lifeStoneRowNum
+
pj
),
new
Vector2
(
frameBorder
*
lifeStoneSize
,
frameBorder
*
lifeStoneSize
),
true
,
vibration
);
vibration
=
0
;
}
...
...
@@ -512,6 +513,57 @@ public class LifeStoneManager : MonoBehaviour {
}
}
public
void
FillLifeStone
(
int
num
,
LifeStoneType
type
)
{
List
<
Vector2Int
>
fillCand
;
List
<
KeyValuePair
<
Vector2Int
,
LifeStoneType
>>
fillArray
=
new
List
<
KeyValuePair
<
Vector2Int
,
LifeStoneType
>>();
Vector2Int
selectedPos
;
for
(
int
n
=
0
;
n
<
num
;
n
++)
{
fillCand
=
new
List
<
Vector2Int
>();
for
(
int
j
=
0
;
j
<
lifeStoneRowNum
;
j
++)
for
(
int
i
=
0
;
i
<
3
;
i
++)
if
(
lifeStoneArray
[
j
,
i
]
==
0
&&
((
i
-
1
>=
0
&&
lifeStoneArray
[
j
,
i
-
1
]
>
0
)
||
(
i
+
1
<
3
&&
lifeStoneArray
[
j
,
i
+
1
]
>
0
)
||
(
j
-
1
>=
0
&&
lifeStoneArray
[
j
-
1
,
i
]
>
0
)
||
(
j
+
1
<
lifeStoneRowNum
&&
lifeStoneArray
[
j
+
1
,
i
]
>
0
)
))
fillCand
.
Add
(
new
Vector2Int
(
i
,
j
));
if
(
fillCand
.
Count
==
0
)
break
;
selectedPos
=
fillCand
[
Random
.
Range
(
0
,
fillCand
.
Count
)];
fillArray
.
Add
(
new
KeyValuePair
<
Vector2Int
,
LifeStoneType
>(
selectedPos
,
type
));
lifeStoneArray
[
selectedPos
.
y
,
selectedPos
.
x
]
=
(
int
)
type
;
lifeStoneUnit
[
selectedPos
.
y
,
selectedPos
.
x
]
=
Instantiate
(
lifeUnitPrefab
,
stoneSuper
.
transform
);
lifeStoneUnit
[
selectedPos
.
y
,
selectedPos
.
x
].
SetActive
(
false
);
}
StartCoroutine
(
FillInPhase
(
fillArray
));
}
IEnumerator
FillInPhase
(
List
<
KeyValuePair
<
Vector2Int
,
LifeStoneType
>>
fillArray
)
{
for
(
int
i
=
0
;
i
<
fillArray
.
Count
;
i
++)
{
lifeStoneUnit
[
fillArray
[
i
].
Key
.
y
,
fillArray
[
i
].
Key
.
x
].
SetActive
(
true
);
lifeStoneUnit
[
fillArray
[
i
].
Key
.
y
,
fillArray
[
i
].
Key
.
x
].
GetComponent
<
LifeUnitInFrame
>().
Init
(
(
int
)
fillArray
[
i
].
Value
,
lifeStoneSize
,
new
Vector2Int
(
fillArray
[
i
].
Key
.
x
,
fillArray
[
i
].
Key
.
y
),
new
Vector2Int
(
fillArray
[
i
].
Key
.
x
,
fillArray
[
i
].
Key
.
y
),
new
Vector2
(
frameBorder
*
lifeStoneSize
,
frameBorder
*
lifeStoneSize
),
false
,
0
);
yield
return
new
WaitForSeconds
(
0.1f
);
}
}
/// <summary>
/// lifestoneframe vibration
/// </summary>
...
...
Assets/Scripts/UI/In-game UI/LifeStoneScript/LifeUnitInFrame.cs
View file @
f2b91f41
...
...
@@ -11,11 +11,9 @@ public class LifeUnitInFrame : MonoBehaviour {
Vector2
zeroPos
;
float
size
;
float
v
,
accel
;
bool
isFall
;
float
vibration
;
void
Start
()
{
}
/// <summary>
/// Create LifeStoneUnit from above. Starts to fall
/// </summary>
...
...
@@ -24,10 +22,10 @@ public class LifeUnitInFrame : MonoBehaviour {
/// <param name="_pos"> destination point in lifestoneFrame</param>
/// <param name="_startPos"> starting point above the lifestoneFrame</param>
/// <param name="_zeroPos"> base position of (0,0) lifestoneFrame</param>
public
void
Init
(
int
_type
,
float
_size
,
Vector2Int
_pos
,
Vector2Int
_startPos
,
Vector2
_zeroPos
,
float
_vibration
)
public
void
Init
(
int
_type
,
float
_size
,
Vector2Int
_pos
,
Vector2Int
_startPos
,
Vector2
_zeroPos
,
bool
_isFall
,
float
_vibration
)
{
animator
=
GetComponent
<
Animator
>();
size
=
_size
;
type
=
_type
;
pos
=
_pos
;
startPos
=
_startPos
;
zeroPos
=
_zeroPos
;
vibration
=
_vibration
;
size
=
_size
;
type
=
_type
;
pos
=
_pos
;
startPos
=
_startPos
;
zeroPos
=
_zeroPos
;
isFall
=
_isFall
;
vibration
=
_vibration
;
GetComponent
<
RectTransform
>().
sizeDelta
=
new
Vector2
(
size
,
size
);
transform
.
localPosition
=
new
Vector2
(
zeroPos
.
x
+
startPos
.
x
*
size
,
zeroPos
.
y
+
startPos
.
y
*
size
);
v
=
0
;
...
...
@@ -72,18 +70,18 @@ public class LifeUnitInFrame : MonoBehaviour {
}
IEnumerator
FallEnumerator
()
{
while
(
true
)
while
(
isFall
)
{
float
vtmp
=
transform
.
localPosition
.
y
-
v
;
if
(
vtmp
<=
zeroPos
.
y
+
pos
.
y
*
size
)
{
transform
.
localPosition
=
new
Vector2
(
transform
.
localPosition
.
x
,
zeroPos
.
y
+
pos
.
y
*
size
);
break
;
}
transform
.
localPosition
=
new
Vector2
(
transform
.
localPosition
.
x
,
vtmp
);
v
+=
accel
;
yield
return
null
;
}
transform
.
localPosition
=
new
Vector2
(
transform
.
localPosition
.
x
,
zeroPos
.
y
+
pos
.
y
*
size
);
if
(
vibration
!=
0
)
StartCoroutine
(
GameObject
.
Find
(
"LifeStoneUI"
).
GetComponent
<
LifeStoneManager
>().
VibrateEnumerator
(
vibration
));
}
...
...
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