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
7467a90a
Commit
7467a90a
authored
7 years ago
by
16도재형
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
One small step for development, one giant leap for view (+ class name prefix deleted)
parent
0fe1b657
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
105 additions
and
4 deletions
+105
-4
MainScene.unity
Assets/Scenes/MainScene.unity
+2
-4
GameInfo.cs
Assets/Scripts/GameInfo.cs
+6
-0
GameInfo.cs.meta
Assets/Scripts/GameInfo.cs.meta
+13
-0
GameManager.cs
Assets/Scripts/GameManager.cs
+84
-0
GameManager.cs.meta
Assets/Scripts/GameManager.cs.meta
+0
-0
No files found.
Assets/Scenes/MainScene.unity
View file @
7467a90a
...
...
@@ -13533,8 +13533,8 @@ Camera:
m_GameObject: {fileID: 1006940696}
m_Enabled: 1
serializedVersion: 2
m_ClearFlags:
1
m_BackGroundColor: {r: 0.
19215687, g: 0.3019608, b: 0.4745098
, a: 0}
m_ClearFlags:
2
m_BackGroundColor: {r: 0.
30882353, g: 0.30882353, b: 0.30882353
, a: 0}
m_NormalizedViewPortRect:
serializedVersion: 2
x: 0
...
...
@@ -14237,8 +14237,6 @@ MonoBehaviour:
m_EditorClassIdentifier:
outerRadius: 1
innerRadius: 0
width: 80
height: 20
cellPrefab: {fileID: 1839775916168536, guid: 900341537233caf489d432cff5440dd3, type: 2}
--- !u!4 &1056054509
Transform:
...
...
This diff is collapsed.
Click to expand it.
Assets/Scripts/GameInfo.cs
0 → 100644
View file @
7467a90a
public
class
GameInfo
{
public
static
int
numOfPlayer
=
2
;
public
static
int
mapWidth
=
128
;
public
static
int
mapHeight
=
80
;
}
This diff is collapsed.
Click to expand it.
Assets/Scripts/GameInfo.cs.meta
0 → 100644
View file @
7467a90a
fileFormatVersion: 2
guid: f45b933381dfc084b952dec401c8cb52
timeCreated: 1518375411
licenseType: Free
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
This diff is collapsed.
Click to expand it.
Assets/Scripts/
CIV
GameManager.cs
→
Assets/Scripts/GameManager.cs
View file @
7467a90a
...
...
@@ -4,33 +4,56 @@ using UnityEngine;
using
CivModel
;
using
CivModel.Common
;
public
class
CIV
GameManager
:
MonoBehaviour
{
p
ublic
float
outerRadius
;
public
float
innerRadius
;
public
class
GameManager
:
MonoBehaviour
{
p
rivate
static
GameManager
_manager
=
null
;
public
static
GameManager
I
{
get
{
return
_manager
;
}
}
public
int
width
=
80
;
public
int
height
=
20
;
// Current game
private
CivModel
.
Game
_game
;
// Currently playing country
public
float
outerRadius
=
1f
;
// Outer&inner radius of hex tile.
public
float
innerRadius
;
// These variables can be deleted if there are no use.
public
GameObject
cellPrefab
;
private
GameObject
[,]
_cells
;
// Use this for initialization
void
Start
()
{
// Singleton
if
(
_manager
!=
null
)
{
Destroy
(
gameObject
);
return
;
}
else
{
_manager
=
this
;
}
// Use this when scene changing exists
// DontDestroyOnLoad(gameObject);
// Instantiate game instance
_game
=
new
CivModel
.
Game
(
GameInfo
.
mapWidth
,
GameInfo
.
mapHeight
,
GameInfo
.
numOfPlayer
,
new
CivModel
.
Common
.
GameSchemeFactory
());
// Map tiling
innerRadius
=
outerRadius
*
Mathf
.
Sqrt
(
3.0f
)
/
2
;
_cells
=
new
GameObject
[
width
,
h
eight
];
_cells
=
new
GameObject
[
GameInfo
.
mapWidth
,
GameInfo
.
mapH
eight
];
DrawMap
();
}
// Update is called once per frame
void
Update
()
{
RenderTile
(
_game
.
Terrain
);
}
void
DrawMap
()
//
Draw hexagonal tile map
void
DrawMap
()
//
Instantiate hex tiles
{
for
(
int
i
=
0
;
i
<
w
idth
;
i
++)
for
(
int
i
=
0
;
i
<
GameInfo
.
mapW
idth
;
i
++)
{
for
(
int
j
=
0
;
j
<
h
eight
;
j
++)
for
(
int
j
=
0
;
j
<
GameInfo
.
mapH
eight
;
j
++)
{
Vector3
pos
=
new
Vector3
(
2
*
i
*
innerRadius
,
-
0.05f
,
-
j
*
outerRadius
*
1.5f
);
if
(
j
%
2
!=
0
)
...
...
@@ -42,4 +65,20 @@ public class CIVGameManager : MonoBehaviour {
}
}
}
// Read game terrain and update hex tile resource
void
RenderTile
(
CivModel
.
Terrain
terrain
)
{
for
(
int
i
=
0
;
i
<
terrain
.
Width
;
i
++)
{
for
(
int
j
=
0
;
j
<
terrain
.
Height
;
j
++)
{
CivModel
.
Terrain
.
Point
point
=
terrain
.
GetPoint
(
i
,
j
);
// TODO: Make prefab component
// _cells[i, j].GetComponent<TilePrefab>().ChangeTile(point);
// _cells[i, j].GetComponent<TilePrefab>().BuildDistrict(point.TileBuilding);
// _cells[i, j].GetComponent<TilePrefab>().DrawUnit(point.Unit);
}
}
}
}
This diff is collapsed.
Click to expand it.
Assets/Scripts/
CIV
GameManager.cs.meta
→
Assets/Scripts/GameManager.cs.meta
View file @
7467a90a
File moved
This diff is collapsed.
Click to expand it.
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