Commit c1450a7c authored by redsuncore's avatar redsuncore

CameraMoveFixed

CameraMoveFixed
Focus
parent 5ec15821
......@@ -1078,9 +1078,9 @@ RectTransform:
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 320, y: 4}
m_SizeDelta: {x: 320, y: 200}
m_AnchorMax: {x: 0.33, y: 0.4}
m_AnchoredPosition: {x: 0, y: 4}
m_SizeDelta: {x: 0, y: -4}
m_Pivot: {x: 1, y: 0}
--- !u!114 &665629349
MonoBehaviour:
......@@ -1626,12 +1626,12 @@ Prefab:
- target: {fileID: 224370154200431468, guid: e251050c3a94e2a47be7fa8a4796fbbd,
type: 2}
propertyPath: m_AnchoredPosition.x
value: 140
value: 0
objectReference: {fileID: 0}
- target: {fileID: 224370154200431468, guid: e251050c3a94e2a47be7fa8a4796fbbd,
type: 2}
propertyPath: m_AnchoredPosition.y
value: -20
value: 0
objectReference: {fileID: 0}
- target: {fileID: 224370154200431468, guid: e251050c3a94e2a47be7fa8a4796fbbd,
type: 2}
......@@ -1651,7 +1651,7 @@ Prefab:
- target: {fileID: 224370154200431468, guid: e251050c3a94e2a47be7fa8a4796fbbd,
type: 2}
propertyPath: m_AnchorMin.y
value: 1
value: 0
objectReference: {fileID: 0}
- target: {fileID: 224370154200431468, guid: e251050c3a94e2a47be7fa8a4796fbbd,
type: 2}
......@@ -1661,7 +1661,7 @@ Prefab:
- target: {fileID: 224370154200431468, guid: e251050c3a94e2a47be7fa8a4796fbbd,
type: 2}
propertyPath: m_AnchorMax.y
value: 1
value: 0
objectReference: {fileID: 0}
- target: {fileID: 224370154200431468, guid: e251050c3a94e2a47be7fa8a4796fbbd,
type: 2}
......@@ -1900,10 +1900,10 @@ RectTransform:
m_Father: {fileID: 2074330601}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 320, y: 204}
m_SizeDelta: {x: 320, y: 200}
m_AnchorMin: {x: 0, y: 0.4}
m_AnchorMax: {x: 0.33, y: 0.8}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 1, y: 0}
--- !u!114 &1115068182
MonoBehaviour:
......@@ -2684,7 +2684,7 @@ Prefab:
- target: {fileID: 224863861108230814, guid: 47ef1c05cbecfff42aec8f14c7958d12,
type: 2}
propertyPath: m_AnchoredPosition.y
value: -20
value: 0
objectReference: {fileID: 0}
- target: {fileID: 224863861108230814, guid: 47ef1c05cbecfff42aec8f14c7958d12,
type: 2}
......
......@@ -3,12 +3,15 @@ using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.EventSystems;
using CivPresenter;
using CivModel;
using CivModel.Common;
public class CIVGameManager : MonoBehaviour, IView {
private const float cameraSpeed = 4.0f;
public enum DistrictSprite { None, CityCenter }
public static Sprite[] DistrictSprites => districtSprites;
private static Sprite[] districtSprites;
......@@ -21,19 +24,33 @@ public class CIVGameManager : MonoBehaviour, IView {
public static Sprite[] TileSprites => tileSprites;
private static Sprite[] tileSprites;
public void MoveSight(int dx, int dy)
/*public void MoveSight(int dx, int dy)
{
mainCamera.transform.Translate(new Vector3(dx, dy, 0));
//버그 있음. 움직일 시 아래로 내려갈수록 지면에 가까워짐. (rotation 문제)
}
}*/
public void Refocus()
{
{
if (pointSelected.HasValue)
{
Focus(pointSelected);
}
}
public void Focus(Unit unit)
{
if(unit.PlacedPoint.HasValue)
{
Focus(unit.PlacedPoint.Value);
}
}
public void Focus(CivModel.Terrain.Point? pt)
{
if(pt.HasValue)
{
Focus(pt.Value.Position);
}
}
public void Focus(Position pos)
{
CameraChange(cells[pos.X, pos.Y].transform.position);
......@@ -60,6 +77,7 @@ public class CIVGameManager : MonoBehaviour, IView {
}
private GameObject cellSelected = null;
private CivModel.Terrain.Point? pointSelected;
private bool readyToClick = false;
public void CastRay()
......@@ -87,8 +105,7 @@ public class CIVGameManager : MonoBehaviour, IView {
public void SelectCell(GameObject go)
{
cellSelected = go;
CivModel.Terrain.Point point = FindCell(cellSelected);
pointSelected = FindCell(cellSelected);
}
public CivModel.Terrain.Point FindCell(GameObject go)
{
......@@ -199,23 +216,42 @@ public class CIVGameManager : MonoBehaviour, IView {
// Update is called once per frame
void Update() {
float delt = Time.deltaTime;
if (Input.GetMouseButtonDown(0))
{
CastRay();
Debug.Log("mouseDown");
if (EventSystem.current.IsPointerOverGameObject() == false)
{
CastRay();
if(cellSelected != null)
{
Focus(pointSelected);
}
}
}
if (Input.GetKeyDown(KeyCode.Escape))
mPresenter.CommandCancel();
if (Input.GetKey(KeyCode.UpArrow))
mPresenter.CommandArrowKey(Direction.Down);
if (Input.GetKey(KeyCode.DownArrow))
{
mPresenter.CommandArrowKey(Direction.Up);
mainCamera.transform.Translate(new Vector3(0, cameraSpeed * delt, 0));
}
if (Input.GetKey(KeyCode.DownArrow))
{
mPresenter.CommandArrowKey(Direction.Down);
mainCamera.transform.Translate(new Vector3(0, -cameraSpeed * delt, 0));
}
if (Input.GetKey(KeyCode.LeftArrow))
{
mPresenter.CommandArrowKey(Direction.Left);
mainCamera.transform.Translate(new Vector3(-cameraSpeed * delt, 0, 0));
}
if (Input.GetKey(KeyCode.RightArrow))
{
mPresenter.CommandArrowKey(Direction.Right);
mainCamera.transform.Translate(new Vector3(cameraSpeed * delt, 0, 0));
}
if (Input.GetKey(KeyCode.F))
mPresenter.CommandRefocus();
......
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