Commit 5ec15821 authored by redsuncore's avatar redsuncore

Select implemented

+Select
parent 8a6590af
fileFormatVersion: 2 fileFormatVersion: 2
guid: 51a4ccfc53e3bd3489fedcd4adb9e458 guid: 51a4ccfc53e3bd3489fedcd4adb9e458
timeCreated: 1515865496 timeCreated: 1516476806
licenseType: Free licenseType: Free
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
......
fileFormatVersion: 2 fileFormatVersion: 2
guid: f6fc0c038e7ce6640910e93606bc6076 guid: f6fc0c038e7ce6640910e93606bc6076
timeCreated: 1515865496 timeCreated: 1516476806
licenseType: Free licenseType: Free
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
......
...@@ -21,6 +21,8 @@ GameObject: ...@@ -21,6 +21,8 @@ GameObject:
- component: {fileID: 4258910550557926} - component: {fileID: 4258910550557926}
- component: {fileID: 212688715293979812} - component: {fileID: 212688715293979812}
- component: {fileID: 114714595063536236} - component: {fileID: 114714595063536236}
- component: {fileID: 60133830685356258}
- component: {fileID: 50065323111616670}
m_Layer: 0 m_Layer: 0
m_Name: HexCell m_Name: HexCell
m_TagString: Untagged m_TagString: Untagged
...@@ -101,6 +103,114 @@ Transform: ...@@ -101,6 +103,114 @@ Transform:
m_Father: {fileID: 4258910550557926} m_Father: {fileID: 4258910550557926}
m_RootOrder: 1 m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!50 &50065323111616670
Rigidbody2D:
serializedVersion: 4
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1334406944157384}
m_BodyType: 2
m_Simulated: 1
m_UseFullKinematicContacts: 0
m_UseAutoMass: 0
m_Mass: 1
m_LinearDrag: 0
m_AngularDrag: 0.05
m_GravityScale: 1
m_Material: {fileID: 0}
m_Interpolate: 0
m_SleepingMode: 1
m_CollisionDetection: 0
m_Constraints: 0
--- !u!60 &60133830685356258
PolygonCollider2D:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1334406944157384}
m_Enabled: 1
m_Density: 1
m_Material: {fileID: 0}
m_IsTrigger: 0
m_UsedByEffector: 0
m_UsedByComposite: 0
m_Offset: {x: 0, y: 0}
m_SpriteTilingProperty:
border: {x: 0, y: 0, z: 0, w: 0}
pivot: {x: 0.5, y: 0.5}
oldSize: {x: 6.28, y: 7.26}
newSize: {x: 6.28, y: 7.26}
adaptiveTilingThreshold: 0.5
drawMode: 0
adaptiveTiling: 0
m_AutoTiling: 0
m_Points:
m_Paths:
- - {x: 0.75, y: -3.22}
- {x: 0.94, y: -3.11}
- {x: 1.7199999, y: -2.6599998}
- {x: 2.05, y: -2.47}
- {x: 2.83, y: -2.02}
- {x: 2.8799999, y: -1.99}
- {x: 3.09, y: -1.87}
- {x: 3.1399999, y: -1.8299999}
- {x: 3.1399999, y: 1.8399999}
- {x: 2.5, y: 2.21}
- {x: 1.9799999, y: 2.51}
- {x: 1.79, y: 2.62}
- {x: 1.65, y: 2.7}
- {x: 1.53, y: 2.77}
- {x: 1.39, y: 2.85}
- {x: 1.27, y: 2.9199998}
- {x: 1.13, y: 3}
- {x: 1.01, y: 3.07}
- {x: 0.82, y: 3.1799998}
- {x: 0.68, y: 3.26}
- {x: 0.56, y: 3.33}
- {x: 0.42, y: 3.4099998}
- {x: 0.29999998, y: 3.48}
- {x: 0.16, y: 3.56}
- {x: 0.04, y: 3.6299999}
- {x: -0.03, y: 3.6299999}
- {x: -0.48999998, y: 3.37}
- {x: -0.94, y: 3.11}
- {x: -1.3399999, y: 2.8799999}
- {x: -1.39, y: 2.85}
- {x: -1.53, y: 2.77}
- {x: -1.65, y: 2.7}
- {x: -1.8399999, y: 2.59}
- {x: -2.05, y: 2.47}
- {x: -2.1, y: 2.44}
- {x: -2.5, y: 2.21}
- {x: -3.02, y: 1.91}
- {x: -3.1399999, y: 1.8299999}
- {x: -3.1399999, y: -1.8399999}
- {x: -3, y: -1.92}
- {x: -2.83, y: -2.01}
- {x: -2.81, y: -2.03}
- {x: -2.69, y: -2.1}
- {x: -2.55, y: -2.18}
- {x: -2.4299998, y: -2.25}
- {x: -2.29, y: -2.33}
- {x: -2.1, y: -2.44}
- {x: -1.9799999, y: -2.51}
- {x: -1.8399999, y: -2.59}
- {x: -1.7199999, y: -2.6599998}
- {x: -1.5799999, y: -2.74}
- {x: -1.41, y: -2.83}
- {x: -1.3399999, y: -2.8799999}
- {x: -1.13, y: -3}
- {x: -1.01, y: -3.07}
- {x: -0.87, y: -3.1499999}
- {x: -0.7, y: -3.24}
- {x: -0.63, y: -3.29}
- {x: -0.42, y: -3.4099998}
- {x: -0.29999998, y: -3.48}
- {x: -0.03, y: -3.6299999}
- {x: 0.03, y: -3.6299999}
- {x: 0.11, y: -3.59}
- {x: 0.22999999, y: -3.52}
--- !u!114 &114714595063536236 --- !u!114 &114714595063536236
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 1 m_ObjectHideFlags: 1
......
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1001 &100100000
Prefab:
m_ObjectHideFlags: 1
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications: []
m_RemovedComponents: []
m_ParentPrefab: {fileID: 0}
m_RootGameObject: {fileID: 1822978508138956}
m_IsPrefabParent: 1
--- !u!1 &1575448438702658
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 5
m_Component:
- component: {fileID: 4646372671659368}
- component: {fileID: 212861489560582692}
m_Layer: 0
m_Name: Unit
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!1 &1822978508138956
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 5
m_Component:
- component: {fileID: 4946224255592324}
- component: {fileID: 212601748841997076}
- component: {fileID: 114237160470975442}
m_Layer: 0
m_Name: HexCell_NoCollider
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!1 &1988075641418796
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 5
m_Component:
- component: {fileID: 4883635777608150}
- component: {fileID: 212362065927215016}
m_Layer: 0
m_Name: District
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &4646372671659368
Transform:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1575448438702658}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: -1}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 4946224255592324}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!4 &4883635777608150
Transform:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1988075641418796}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: -1}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 4946224255592324}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!4 &4946224255592324
Transform:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1822978508138956}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -0.36824954, y: -4.391864, z: 7.4621744}
m_LocalScale: {x: 0.5, y: 0.5, z: 0.5}
m_Children:
- {fileID: 4883635777608150}
- {fileID: 4646372671659368}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &114237160470975442
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1822978508138956}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 398af1a0f5161e6458c6a2262e5bc087, type: 3}
m_Name:
m_EditorClassIdentifier:
TileSprite: {fileID: 21300000, guid: f1a6ff1ba8790ef42b092ba2cf7c2093, type: 3}
--- !u!212 &212362065927215016
SpriteRenderer:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1988075641418796}
m_Enabled: 1
m_CastShadows: 0
m_ReceiveShadows: 0
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_Materials:
- {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 0
m_SelectedEditorRenderState: 0
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_Sprite: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 0
m_FlipY: 0
m_DrawMode: 0
m_Size: {x: 1, y: 1}
m_AdaptiveModeThreshold: 0.5
m_SpriteTileMode: 0
m_WasSpriteAssigned: 0
m_MaskInteraction: 0
--- !u!212 &212601748841997076
SpriteRenderer:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1822978508138956}
m_Enabled: 1
m_CastShadows: 0
m_ReceiveShadows: 0
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_Materials:
- {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 0
m_SelectedEditorRenderState: 0
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_Sprite: {fileID: 21300000, guid: f1a6ff1ba8790ef42b092ba2cf7c2093, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 0
m_FlipY: 0
m_DrawMode: 0
m_Size: {x: 6.28, y: 7.26}
m_AdaptiveModeThreshold: 0.5
m_SpriteTileMode: 0
m_WasSpriteAssigned: 1
m_MaskInteraction: 0
--- !u!212 &212861489560582692
SpriteRenderer:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1575448438702658}
m_Enabled: 1
m_CastShadows: 0
m_ReceiveShadows: 0
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_Materials:
- {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 0
m_SelectedEditorRenderState: 0
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_Sprite: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 0
m_FlipY: 0
m_DrawMode: 0
m_Size: {x: 1, y: 1}
m_AdaptiveModeThreshold: 0.5
m_SpriteTileMode: 0
m_WasSpriteAssigned: 0
m_MaskInteraction: 0
fileFormatVersion: 2
guid: 02c4298592eef7c44b0075915f88d319
timeCreated: 1516432095
licenseType: Free
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 100100000
userData:
assetBundleName:
assetBundleVariant:
This diff is collapsed.
fileFormatVersion: 2
guid: e251050c3a94e2a47be7fa8a4796fbbd
timeCreated: 1516266705
licenseType: Free
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 100100000
userData:
assetBundleName:
assetBundleVariant:
This diff is collapsed.
fileFormatVersion: 2
guid: 77c6f854b20c9f34ea22469c907e11bc
timeCreated: 1516266566
licenseType: Free
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 0
userData:
assetBundleName:
assetBundleVariant:
This diff is collapsed.
fileFormatVersion: 2
guid: 47ef1c05cbecfff42aec8f14c7958d12
timeCreated: 1516266622
licenseType: Free
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 100100000
userData:
assetBundleName:
assetBundleVariant:
This diff is collapsed.
fileFormatVersion: 2
guid: ef8d1e641fc76d24b94738577f2368e0
timeCreated: 1516266566
licenseType: Free
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 0
userData:
assetBundleName:
assetBundleVariant:
This diff is collapsed.
fileFormatVersion: 2
guid: e394e96ab532eb94286b6d78b5076e19
timeCreated: 1516432971
licenseType: Free
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 100100000
userData:
assetBundleName:
assetBundleVariant:
This diff is collapsed.
fileFormatVersion: 2 fileFormatVersion: 2
guid: d7e3c737fe30c8942a77d3b76aa7036b guid: d7e3c737fe30c8942a77d3b76aa7036b
timeCreated: 1515573259 timeCreated: 1516431980
licenseType: Free licenseType: Free
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
......
...@@ -5,6 +5,7 @@ using UnityEngine; ...@@ -5,6 +5,7 @@ using UnityEngine;
using UnityEngine.UI; using UnityEngine.UI;
using CivPresenter; using CivPresenter;
using CivModel; using CivModel;
using CivModel.Common;
public class CIVGameManager : MonoBehaviour, IView { public class CIVGameManager : MonoBehaviour, IView {
...@@ -23,6 +24,7 @@ public class CIVGameManager : MonoBehaviour, IView { ...@@ -23,6 +24,7 @@ public class CIVGameManager : MonoBehaviour, IView {
public void MoveSight(int dx, int dy) public void MoveSight(int dx, int dy)
{ {
mainCamera.transform.Translate(new Vector3(dx, dy, 0)); mainCamera.transform.Translate(new Vector3(dx, dy, 0));
//버그 있음. 움직일 시 아래로 내려갈수록 지면에 가까워짐. (rotation 문제)
} }
public void Refocus() public void Refocus()
...@@ -41,7 +43,7 @@ public class CIVGameManager : MonoBehaviour, IView { ...@@ -41,7 +43,7 @@ public class CIVGameManager : MonoBehaviour, IView {
public void Shutdown() public void Shutdown()
{ {
Application.Quit(); Application.Quit();
} }
public void Render(CivModel.Terrain map) public void Render(CivModel.Terrain map)
{ {
...@@ -58,15 +60,59 @@ public class CIVGameManager : MonoBehaviour, IView { ...@@ -58,15 +60,59 @@ public class CIVGameManager : MonoBehaviour, IView {
} }
private GameObject cellSelected = null; private GameObject cellSelected = null;
private bool readyToClick = false;
public void CastRay()
{
cellSelected = null;
Vector2 pos = mainCamera.ScreenToWorldPoint(new Vector3(Input.mousePosition.x,Input.mousePosition.y,20f));
/* 현재 버그 존재 : camera가 orthographic이 아닌 perspective일 경우 정확한 거리값을 Vector3 값의 세 번째 자리에 넣어야 함.
Camera가 Rotate 되어 있을 경우 계산이 필요한지 다른 방식으로 변경할지는 추후 고려*/
RaycastHit2D hit = Physics2D.Raycast(pos, Vector2.zero, 0f);
if (hit.collider != null)
{
Debug.Log(hit.collider.name + "Castray");
SelectCell(hit.collider.gameObject);
readyToClick = false;
}
else
Debug.Log("notselected");
}
public void SelectCell(GameObject go) public void SelectCell(GameObject go)
{ {
cellSelected = go; cellSelected = go;
} CivModel.Terrain.Point point = FindCell(cellSelected);
}
public CivModel.Terrain.Point FindCell(GameObject go)
{
if (go == null)
{
Debug.Log("no Gameobject");
throw new ArgumentNullException();
}
for (int i = 0; i < Width; i++)
{
for (int j = 0; j < Height; j++)
{
if (cells[i, j] == go)
{
return mPresenter.Game.Terrain.GetPoint(i, j);
}
}
}
throw new ArgumentNullException();
}
public void Skill() public void Skill()
{ {
mPresenter.CommandSpecialAct(0); if(mPresenter.SelectedActor.GetType() == typeof(Pioneer))
mPresenter.SelectedActor.SpecialActs[0].Act(mPresenter.SelectedActor.PlacedPoint);
} }
private void CameraChange(Vector3 vec) private void CameraChange(Vector3 vec)
...@@ -104,8 +150,8 @@ public class CIVGameManager : MonoBehaviour, IView { ...@@ -104,8 +150,8 @@ public class CIVGameManager : MonoBehaviour, IView {
if (gameManager == null) if (gameManager == null)
{ {
gameManager = this.gameObject; gameManager = this.gameObject;
Width = 100; Width = 10;
Height = 100; Height = 10;
mPresenter = new Presenter(this); mPresenter = new Presenter(this);
//gameMapModel = mPresenter.Game.Terrain; //gameMapModel = mPresenter.Game.Terrain;
//players = mPresenter.Game.Players; //players = mPresenter.Game.Players;
...@@ -136,7 +182,7 @@ public class CIVGameManager : MonoBehaviour, IView { ...@@ -136,7 +182,7 @@ public class CIVGameManager : MonoBehaviour, IView {
cells = new GameObject[Width, Height]; cells = new GameObject[Width, Height];
DrawMap(); DrawMap();
Focus(new Position { X = 50, Y = 50 }); //testcase Focus(new Position { X = 5, Y = 5 }); //testcase
} }
else else
{ {
...@@ -153,6 +199,11 @@ public class CIVGameManager : MonoBehaviour, IView { ...@@ -153,6 +199,11 @@ public class CIVGameManager : MonoBehaviour, IView {
// Update is called once per frame // Update is called once per frame
void Update() { void Update() {
if (Input.GetMouseButtonDown(0))
{
CastRay();
Debug.Log("mouseDown");
}
if (Input.GetKeyDown(KeyCode.Escape)) if (Input.GetKeyDown(KeyCode.Escape))
mPresenter.CommandCancel(); mPresenter.CommandCancel();
if (Input.GetKey(KeyCode.UpArrow)) if (Input.GetKey(KeyCode.UpArrow))
......
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class ManagementUIController : MonoBehaviour {
private Canvas managemantUI;
private Canvas cameraUI;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
}
fileFormatVersion: 2
guid: 41e4a5fcff86ff74a95f898f5beff68e
timeCreated: 1516266823
licenseType: Free
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment