Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
civilization-iii
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
5
Issues
5
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
true-history-committee
civilization-iii
Commits
0d91b115
Commit
0d91b115
authored
Feb 17, 2018
by
16도재형
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Movable/Atackable tile really flickers!
parent
796b7017
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
58 additions
and
3 deletions
+58
-3
MainScene.unity
Assets/Scenes/MainScene.unity
+12
-1
GameManager.cs
Assets/Scripts/GameManager.cs
+1
-2
HexTile.cs
Assets/Scripts/HexTile.cs
+45
-0
No files found.
Assets/Scenes/MainScene.unity
View file @
0d91b115
...
@@ -18524,7 +18524,18 @@ MonoBehaviour:
...
@@ -18524,7 +18524,18 @@ MonoBehaviour:
m_TargetGraphic
:
{
fileID
:
1365235311
}
m_TargetGraphic
:
{
fileID
:
1365235311
}
m_OnClick
:
m_OnClick
:
m_PersistentCalls
:
m_PersistentCalls
:
m_Calls
:
[]
m_Calls
:
-
m_Target
:
{
fileID
:
1056054510
}
m_MethodName
:
EndTurnActive
m_Mode
:
1
m_Arguments
:
m_ObjectArgument
:
{
fileID
:
0
}
m_ObjectArgumentAssemblyTypeName
:
UnityEngine.Object, UnityEngine
m_IntArgument
:
0
m_FloatArgument
:
0
m_StringArgument
:
m_BoolArgument
:
0
m_CallState
:
2
m_TypeName
:
UnityEngine.UI.Button+ButtonClickedEvent, UnityEngine.UI, Version=1.0.0.0,
m_TypeName
:
UnityEngine.UI.Button+ButtonClickedEvent, UnityEngine.UI, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=null
Culture=neutral, PublicKeyToken=null
---
!u!114
&1365235311
---
!u!114
&1365235311
...
...
Assets/Scripts/GameManager.cs
View file @
0d91b115
...
@@ -65,7 +65,6 @@ public class GameManager : MonoBehaviour {
...
@@ -65,7 +65,6 @@ public class GameManager : MonoBehaviour {
// Instantiate game
// Instantiate game
_game
=
new
CivModel
.
Game
(
GameInfo
.
mapWidth
,
GameInfo
.
mapHeight
,
GameInfo
.
numOfPlayer
,
new
CivModel
.
Common
.
GameSchemeFactory
());
_game
=
new
CivModel
.
Game
(
GameInfo
.
mapWidth
,
GameInfo
.
mapHeight
,
GameInfo
.
numOfPlayer
,
new
CivModel
.
Common
.
GameSchemeFactory
());
_game
.
StartTurn
();
_game
.
StartTurn
();
Debug
.
Log
(
_game
.
PlayerNumberInTurn
);
// Map tiling
// Map tiling
innerRadius
=
outerRadius
*
Mathf
.
Sqrt
(
3.0f
)
/
2
;
innerRadius
=
outerRadius
*
Mathf
.
Sqrt
(
3.0f
)
/
2
;
...
@@ -182,7 +181,7 @@ public class GameManager : MonoBehaviour {
...
@@ -182,7 +181,7 @@ public class GameManager : MonoBehaviour {
}
}
int
idx
=
_standbyUnitIndex
+
1
;
int
idx
=
_standbyUnitIndex
+
1
;
Debug
.
Log
(
_standbyUnits
);
Debug
.
Log
(
_standbyUnits
.
Length
);
for
(;
idx
<
_standbyUnits
.
Length
;
++
idx
)
for
(;
idx
<
_standbyUnits
.
Length
;
++
idx
)
{
{
var
unit
=
_standbyUnits
[
idx
];
var
unit
=
_standbyUnits
[
idx
];
...
...
Assets/Scripts/HexTile.cs
View file @
0d91b115
...
@@ -12,6 +12,7 @@ public class HexTile : MonoBehaviour {
...
@@ -12,6 +12,7 @@ public class HexTile : MonoBehaviour {
Transform
units
;
Transform
units
;
public
bool
isFlickering
;
public
bool
isFlickering
;
private
IEnumerator
_coroutine
;
// Use this for initialization
// Use this for initialization
void
Start
()
{
void
Start
()
{
...
@@ -61,6 +62,10 @@ public class HexTile : MonoBehaviour {
...
@@ -61,6 +62,10 @@ public class HexTile : MonoBehaviour {
{
{
isFlickering
=
true
;
isFlickering
=
true
;
Debug
.
Log
(
gameObject
.
name
+
" is flickering with blue"
);
Debug
.
Log
(
gameObject
.
name
+
" is flickering with blue"
);
if
(
terrains
.
GetChild
((
int
)
point
.
Type
).
GetComponent
<
Renderer
>()
==
null
)
return
;
_coroutine
=
Flicker
(
Color
.
blue
);
StartCoroutine
(
_coroutine
);
}
}
// Blink with red color. This is used for attack.
// Blink with red color. This is used for attack.
...
@@ -68,11 +73,51 @@ public class HexTile : MonoBehaviour {
...
@@ -68,11 +73,51 @@ public class HexTile : MonoBehaviour {
{
{
isFlickering
=
true
;
isFlickering
=
true
;
Debug
.
Log
(
gameObject
.
name
+
" is flickering with red"
);
Debug
.
Log
(
gameObject
.
name
+
" is flickering with red"
);
if
(
terrains
.
GetChild
((
int
)
point
.
Type
).
GetComponent
<
Renderer
>()
==
null
)
return
;
_coroutine
=
Flicker
(
Color
.
red
);
StartCoroutine
(
_coroutine
);
}
}
public
void
StopFlickering
()
public
void
StopFlickering
()
{
{
isFlickering
=
false
;
isFlickering
=
false
;
Debug
.
Log
(
gameObject
.
name
+
" stopped flickering"
);
Debug
.
Log
(
gameObject
.
name
+
" stopped flickering"
);
if
(
terrains
.
GetChild
((
int
)
point
.
Type
).
GetComponent
<
Renderer
>()
==
null
)
return
;
StopCoroutine
(
_coroutine
);
Material
mat
=
terrains
.
GetChild
((
int
)
point
.
Type
).
GetComponent
<
Renderer
>().
material
;
mat
.
SetColor
(
"_Color"
,
Color
.
white
);
}
// Make tile flicker with color c. Don't need to read this method.
IEnumerator
Flicker
(
Color
c
)
{
Material
mat
=
terrains
.
GetChild
((
int
)
point
.
Type
).
GetComponent
<
Renderer
>().
material
;
Color
delta
=
Color
.
white
-
c
;
while
(
true
)
{
// From white to c
for
(
float
i
=
0
;
i
<=
1f
;
i
+=
1.5f
*
Time
.
deltaTime
)
{
mat
.
SetColor
(
"_Color"
,
Color
.
white
-
delta
*
(
1
-
Mathf
.
Cos
(
Mathf
.
PI
*
i
))
/
2
);
yield
return
null
;
}
mat
.
SetColor
(
"_Color"
,
c
);
// From c to white
for
(
float
i
=
0
;
i
<=
1f
;
i
+=
1.5f
*
Time
.
deltaTime
)
{
mat
.
SetColor
(
"_Color"
,
c
+
delta
*
(
1
-
Mathf
.
Cos
(
Mathf
.
PI
*
i
))
/
2
);
yield
return
null
;
}
mat
.
SetColor
(
"_Color"
,
Color
.
white
);
if
(!
isFlickering
)
{
break
;
}
yield
return
new
WaitForSeconds
(
0.2f
);
}
}
}
}
}
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