Commit 63bc07c4 authored by 18손재민's avatar 18손재민

Merge branch 'map' into model

# Conflicts:
#	Assets/Scenes/SampleScene.unity
#	Assets/Scripts/Interactors/Mannequin.cs
parents a2180f0f 169ed9bf
fileFormatVersion: 2
guid: 50bbbb7b70a6ab94da946d4123f25e75
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
...@@ -66,19 +66,19 @@ AnimatorController: ...@@ -66,19 +66,19 @@ AnimatorController:
m_DefaultFloat: 0 m_DefaultFloat: 0
m_DefaultInt: 0 m_DefaultInt: 0
m_DefaultBool: 0 m_DefaultBool: 0
m_Controller: {fileID: 0} m_Controller: {fileID: 9100000}
- m_Name: shoot - m_Name: shoot
m_Type: 9 m_Type: 9
m_DefaultFloat: 0 m_DefaultFloat: 0
m_DefaultInt: 0 m_DefaultInt: 0
m_DefaultBool: 0 m_DefaultBool: 0
m_Controller: {fileID: 0} m_Controller: {fileID: 9100000}
- m_Name: isShooting - m_Name: isShooting
m_Type: 4 m_Type: 4
m_DefaultFloat: 0 m_DefaultFloat: 0
m_DefaultInt: 0 m_DefaultInt: 0
m_DefaultBool: 0 m_DefaultBool: 0
m_Controller: {fileID: 0} m_Controller: {fileID: 9100000}
m_AnimatorLayers: m_AnimatorLayers:
- serializedVersion: 5 - serializedVersion: 5
m_Name: Base Layer m_Name: Base Layer
......
...@@ -48,9 +48,13 @@ MonoBehaviour: ...@@ -48,9 +48,13 @@ MonoBehaviour:
normalWall: {fileID: 2953616027608884528, guid: a4dcd71ec9f819f4e88c7b5ac24f4b0d, normalWall: {fileID: 2953616027608884528, guid: a4dcd71ec9f819f4e88c7b5ac24f4b0d,
type: 3} type: 3}
mirror: {fileID: 17874052963739924, guid: 90282f1c82fff7545962b5ca66f1a102, type: 3} mirror: {fileID: 17874052963739924, guid: 90282f1c82fff7545962b5ca66f1a102, type: 3}
objects:
- {fileID: 2534561534465535505, guid: 0b323beb318071144aef94132be66541, type: 3}
- {fileID: 6001025753464815805, guid: df6f1d8b9377ec346af4255abe290fbb, type: 3}
- {fileID: 33432975985984805, guid: ec20e06c4a993924791d02d7a4c9375c, type: 3}
players: [] players: []
player: {fileID: 8862060874303168220, guid: 6ba287375b5ad4b458a7b7b99c6d6a08, type: 3} player: {fileID: 494213313239918027, guid: 449b2ca4d925da541bb45c84b63aab98, type: 3}
currentMap: {fileID: 0} currentMap: {fileID: 0}
surface: {fileID: 0} surface: {fileID: 0}
stage: stage:
- {fileID: 7116745361094357555, guid: 32ff564f49869bf40a53d07394eb081b, type: 3} - {fileID: 2496973653136699540, guid: dbb2e09c19fe5ad49b11a6b95e5ac9e8, type: 3}
...@@ -611,9 +611,9 @@ Transform: ...@@ -611,9 +611,9 @@ Transform:
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 494213313239917623} m_GameObject: {fileID: 494213313239917623}
m_LocalRotation: {x: -0.6340379, y: -0.28484753, z: 0.24146551, w: 0.67716485} m_LocalRotation: {x: -0.6340379, y: -0.28484744, z: 0.24146542, w: 0.6771649}
m_LocalPosition: {x: 0.000005839104, y: 0.0015373584, z: -0.0000003303768} m_LocalPosition: {x: 0, y: 0.0015373576, z: 0}
m_LocalScale: {x: 0.9999998, y: 0.99999994, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: m_Children:
- {fileID: 494213313239497169} - {fileID: 494213313239497169}
m_Father: {fileID: 494213313239497109} m_Father: {fileID: 494213313239497109}
...@@ -1343,7 +1343,6 @@ Transform: ...@@ -1343,7 +1343,6 @@ Transform:
m_LocalScale: {x: 0.45, y: 0.45, z: 0.45} m_LocalScale: {x: 0.45, y: 0.45, z: 0.45}
m_Children: m_Children:
- {fileID: 494213313239497099} - {fileID: 494213313239497099}
- {fileID: 494213313239497139}
- {fileID: 494213313239497179} - {fileID: 494213313239497179}
- {fileID: 7259129854443835404} - {fileID: 7259129854443835404}
m_Father: {fileID: 0} m_Father: {fileID: 0}
...@@ -1433,6 +1432,7 @@ MonoBehaviour: ...@@ -1433,6 +1432,7 @@ MonoBehaviour:
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
head: {fileID: 3233955354714130270} head: {fileID: 3233955354714130270}
shootingArm: {fileID: 0}
--- !u!1 &494213313239918029 --- !u!1 &494213313239918029
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
...@@ -1552,11 +1552,11 @@ Transform: ...@@ -1552,11 +1552,11 @@ Transform:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 494213313239918035} m_GameObject: {fileID: 494213313239918035}
m_LocalRotation: {x: -0.7071068, y: 2.9343448e-11, z: 3.9904864e-11, w: 0.7071067} m_LocalRotation: {x: -0.7071068, y: 2.9343448e-11, z: 3.9904864e-11, w: 0.7071067}
m_LocalPosition: {x: -4.6566122e-11, y: 0.000000027216437, z: 0.0000000020648396} m_LocalPosition: {x: 0, y: -1.723, z: 0}
m_LocalScale: {x: 100, y: 100, z: 100} m_LocalScale: {x: 100, y: 100, z: 100}
m_Children: [] m_Children: []
m_Father: {fileID: 494213313239497131} m_Father: {fileID: 7259129854443835404}
m_RootOrder: 1 m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!137 &494213313228417203 --- !u!137 &494213313228417203
SkinnedMeshRenderer: SkinnedMeshRenderer:
...@@ -2282,7 +2282,7 @@ Transform: ...@@ -2282,7 +2282,7 @@ Transform:
m_LocalScale: {x: 100, y: 100, z: 100} m_LocalScale: {x: 100, y: 100, z: 100}
m_Children: [] m_Children: []
m_Father: {fileID: 494213313239497131} m_Father: {fileID: 494213313239497131}
m_RootOrder: 2 m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!137 &494213313228417201 --- !u!137 &494213313228417201
SkinnedMeshRenderer: SkinnedMeshRenderer:
...@@ -2478,7 +2478,8 @@ Transform: ...@@ -2478,7 +2478,8 @@ Transform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 1.723, z: 0} m_LocalPosition: {x: 0, y: 1.723, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: [] m_Children:
- {fileID: 494213313239497139}
m_Father: {fileID: 494213313239497131} m_Father: {fileID: 494213313239497131}
m_RootOrder: 3 m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
...@@ -26,7 +26,7 @@ Transform: ...@@ -26,7 +26,7 @@ Transform:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6001025753464815801} m_GameObject: {fileID: 6001025753464815801}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalPosition: {x: 0, y: 0.3, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: [] m_Children: []
m_Father: {fileID: 6001025753464593565} m_Father: {fileID: 6001025753464593565}
...@@ -170,7 +170,7 @@ Transform: ...@@ -170,7 +170,7 @@ Transform:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6001025753464815807} m_GameObject: {fileID: 6001025753464815807}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalPosition: {x: 0, y: 0.3, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: [] m_Children: []
m_Father: {fileID: 6001025753464593565} m_Father: {fileID: 6001025753464593565}
......
...@@ -8,13 +8,14 @@ public class CameraController : MonoBehaviour ...@@ -8,13 +8,14 @@ public class CameraController : MonoBehaviour
public float dragSpeed; public float dragSpeed;
Vector3 previousPos; Vector3 previousPos;
Vector3 previousAngle; Vector3 previousAngle;
float shootingFov = 60f; float shootingFov = 40f;
float mapFov = 40f; float mapFov = 20f;
float rotationX = 0; float rotationX = 0;
float rotationY = 0; float rotationY = 0;
float sensitivity = 30; float sensitivity = 30;
Vector3 centerPos = new Vector3(0, 0, 0); Vector3 centerPos = new Vector3(0, 0, 0);
/// <summary> /// <summary>
/// Move camera. /// Move camera.
/// </summary> /// </summary>
...@@ -76,6 +77,9 @@ public class CameraController : MonoBehaviour ...@@ -76,6 +77,9 @@ public class CameraController : MonoBehaviour
rotationX = transform.eulerAngles.y; rotationX = transform.eulerAngles.y;
rotationY = transform.eulerAngles.x; rotationY = transform.eulerAngles.x;
PlayerController.inst.isZooming = false; PlayerController.inst.isZooming = false;
PlayerController.inst.currentPlayer.GetComponent<Animator>().SetBool("isShooting", true);
PlayerController.inst.currentPlayer.GetComponent<Player>().head.SetActive(false);
} }
/// <summary> /// <summary>
/// Zoom out from player. /// Zoom out from player.
...@@ -87,17 +91,15 @@ public class CameraController : MonoBehaviour ...@@ -87,17 +91,15 @@ public class CameraController : MonoBehaviour
Vector3 posDiff = (previousPos - transform.position) / 40; Vector3 posDiff = (previousPos - transform.position) / 40;
float fovDiff = (mapFov - shootingFov) / 40f; float fovDiff = (mapFov - shootingFov) / 40f;
PlayerController.inst.isZooming = true; PlayerController.inst.isZooming = true;
PlayerController.inst.currentPlayer.GetComponent<Animator>().SetBool("isShooting", false);
PlayerController.inst.currentPlayer.GetComponent<Player>().head.SetActive(true);
Vector3 tempAngle = new Vector3(transform.eulerAngles.x > 180 ? transform.eulerAngles.x - 360 : transform.eulerAngles.x, Vector3 tempAngle = new Vector3(transform.eulerAngles.x > 180 ? transform.eulerAngles.x - 360 : transform.eulerAngles.x,
transform.eulerAngles.y > 180 ? transform.eulerAngles.y - 360 : transform.eulerAngles.y, transform.eulerAngles.y > 180 ? transform.eulerAngles.y - 360 : transform.eulerAngles.y,
transform.eulerAngles.z > 180 ? transform.eulerAngles.z - 360 : transform.eulerAngles.z); transform.eulerAngles.z > 180 ? transform.eulerAngles.z - 360 : transform.eulerAngles.z);
Vector3 angleDiff = (previousAngle - tempAngle) / 40; Vector3 angleDiff = (previousAngle - tempAngle) / 40;
angleDiff = new Vector3(angleDiff.x > 180 ? 360 - angleDiff.x : angleDiff.x, angleDiff = new Vector3(angleDiff.x > 180 ? 360 - angleDiff.x : angleDiff.x,
angleDiff.y > 180 ? 360 - angleDiff.y : angleDiff.y, angleDiff.y > 180 ? 360 - angleDiff.y : angleDiff.y,
angleDiff.z > 180 ? 360 - angleDiff.z : angleDiff.z); angleDiff.z > 180 ? 360 - angleDiff.z : angleDiff.z);
Debug.Log(previousAngle + "previousAngle");
Debug.Log(tempAngle + "tempAngle");
Debug.Log(angleDiff + "angleDiff");
for (int i = 0; i < 40; i++) for (int i = 0; i < 40; i++)
{ {
yield return null; yield return null;
......
...@@ -45,12 +45,7 @@ public class Mannequin : MonoBehaviour, IObject, IBulletInteractor ...@@ -45,12 +45,7 @@ public class Mannequin : MonoBehaviour, IObject, IBulletInteractor
} }
} }
public void Init(Floor floor) public void Init(bool isWhite)
{
this.floor = floor;
}
public void SetColor(bool isWhite)
{ {
Color = isWhite ? Color.white : Color.black; Color = isWhite ? Color.white : Color.black;
} }
......
...@@ -22,11 +22,6 @@ public class Map : MonoBehaviour ...@@ -22,11 +22,6 @@ public class Map : MonoBehaviour
/// <returns></returns> /// <returns></returns>
public Floor GetFloorAtPos(Vector2Int pos) public Floor GetFloorAtPos(Vector2Int pos)
{ {
if ((pos.x >= 0 ? (pos.x > maxMapSize / 2) : (pos.x < -maxMapSize / 2)) || (pos.y >= 0 ? (pos.y > maxMapSize / 2) : (pos.y < -maxMapSize / 2)))
{
Debug.Log("Input size exceeds map's max size.");
return null;
}
return floorGrid.ContainsKey(pos) ? floorGrid[pos] : null; return floorGrid.ContainsKey(pos) ? floorGrid[pos] : null;
} }
/// <summary> /// <summary>
...@@ -39,6 +34,15 @@ public class Map : MonoBehaviour ...@@ -39,6 +34,15 @@ public class Map : MonoBehaviour
return wallGrid.ContainsKey(pos) ? wallGrid[pos] : null; return wallGrid.ContainsKey(pos) ? wallGrid[pos] : null;
} }
/// <summary> /// <summary>
/// Get object at position.
/// </summary>
/// <param name="pos">Position of object.</param>
/// <returns></returns>
public IObject GetObjectAtPos(Vector2Int pos)
{
return objectGrid.ContainsKey(pos) ? objectGrid[pos] : null;
}
/// <summary>
/// Create floor at position. /// Create floor at position.
/// </summary> /// </summary>
/// <param name="pos">Position of floor.</param> /// <param name="pos">Position of floor.</param>
...@@ -97,7 +101,7 @@ public class Map : MonoBehaviour ...@@ -97,7 +101,7 @@ public class Map : MonoBehaviour
/// Create wall at position. /// Create wall at position.
/// </summary> /// </summary>
/// <param name="pos">Position of wall.</param> /// <param name="pos">Position of wall.</param>
/// <param name="wallType">Type of walls.</param> /// <param name="wallType">Type of wall.</param>
public void CreateWall(Vector2 pos, WallType wallType) public void CreateWall(Vector2 pos, WallType wallType)
{ {
if (((int)pos.x >= 0 ? ((int)pos.x > maxMapSize / 2) : ((int)pos.x < -maxMapSize / 2)) || ((int)pos.y >= 0 ? ((int)pos.y > maxMapSize / 2) : ((int)pos.y < -maxMapSize / 2))) if (((int)pos.x >= 0 ? ((int)pos.x > maxMapSize / 2) : ((int)pos.x < -maxMapSize / 2)) || ((int)pos.y >= 0 ? ((int)pos.y > maxMapSize / 2) : ((int)pos.y < -maxMapSize / 2)))
...@@ -158,6 +162,54 @@ public class Map : MonoBehaviour ...@@ -158,6 +162,54 @@ public class Map : MonoBehaviour
else else
Debug.Log("Wall doesn't exists between : " + pos); Debug.Log("Wall doesn't exists between : " + pos);
} }
/// <summary>
/// Create object at position.
/// </summary>
/// <param name="pos">Position of object.</param>
/// <param name="objType">Type of object.</param>
public void CreateObject(Vector2Int pos, ObjType objType)
{
if ((pos.x >= 0 ? (pos.x > maxMapSize / 2) : (pos.x < -maxMapSize / 2)) || (pos.y >= 0 ? (pos.y > maxMapSize / 2) : (pos.y < -maxMapSize / 2)))
{
Debug.Log("Input size exceeds map's max size.");
return;
}
if (!objectGrid.ContainsKey(pos))
{
objectGrid.Add(pos, Instantiate(MapManager.inst.objects[(int)objType - 1], new Vector3(pos.x, 0, pos.y), Quaternion.identity, objects.transform).GetComponent<IObject>());
switch (objType)
{
case ObjType.Briefcase:
objectGrid[pos].GetObject().GetComponent<Briefcase>().Init(GetFloorAtPos(pos));
return;
case ObjType.Camera:
objectGrid[pos].GetObject().GetComponent<CameraTurret>().Init(GetFloorAtPos(pos));
return;
//Need to make mannequin init
/*case ObjType.Mannequin:
objectGrid[pos].GetObject().GetComponent<Mannequin>().Init(GetFloorAtPos(pos));
return;*/
}
StartCoroutine(MapManager.inst.Rebaker());
}
else
Debug.Log("Object already exists at : (" + pos.x + ", " + pos.y + ")");
}
/// <summary>
/// Remove Object at position.
/// </summary>
/// <param name="pos">Position of object.</param>
public void RemoveObject(Vector2Int pos)
{
if (objectGrid.ContainsKey(pos))
{
Destroy(objectGrid[pos].GetObject());
objectGrid.Remove(pos);
StartCoroutine(MapManager.inst.Rebaker());
}
else
Debug.Log("Object doesn't exists between : " + pos);
}
private void LoadObjects() private void LoadObjects()
{ {
...@@ -185,6 +237,7 @@ public class Map : MonoBehaviour ...@@ -185,6 +237,7 @@ public class Map : MonoBehaviour
{ {
floorGrid = new Dictionary<Vector2Int, Floor>(); floorGrid = new Dictionary<Vector2Int, Floor>();
wallGrid = new Dictionary<Vector2, Wall>(); wallGrid = new Dictionary<Vector2, Wall>();
objectGrid = new Dictionary<Vector2Int, IObject>();
startFloors = new List<Floor>(); startFloors = new List<Floor>();
} }
...@@ -196,7 +249,7 @@ public class Map : MonoBehaviour ...@@ -196,7 +249,7 @@ public class Map : MonoBehaviour
// Start is called before the first frame update // Start is called before the first frame update
void Start() void Start()
{ {
Debug.Log((-0.5 * 10) % 10);
} }
// Update is called once per frame // Update is called once per frame
......
...@@ -10,6 +10,7 @@ public class MapManager : SingletonBehaviour<MapManager> ...@@ -10,6 +10,7 @@ public class MapManager : SingletonBehaviour<MapManager>
public Floor floor; public Floor floor;
public NormalWall normalWall; public NormalWall normalWall;
public Mirror mirror; public Mirror mirror;
public GameObject[] objects;
public List<GameObject> players; public List<GameObject> players;
public GameObject player; public GameObject player;
public Map currentMap; public Map currentMap;
......
...@@ -12,9 +12,13 @@ public class Player : MonoBehaviour ...@@ -12,9 +12,13 @@ public class Player : MonoBehaviour
Coroutine playerArrivalCheck; Coroutine playerArrivalCheck;
public GameObject head; public GameObject head;
public GameObject shootingArm;
Animator anim; Animator anim;
NavMeshAgent agent;
/// <summary>
/// Set this player as the current player.
/// </summary>
/// <returns></returns>
public IEnumerator SetCurrentPlayer() public IEnumerator SetCurrentPlayer()
{ {
GetComponent<NavMeshObstacle>().enabled = false; GetComponent<NavMeshObstacle>().enabled = false;
...@@ -22,6 +26,10 @@ public class Player : MonoBehaviour ...@@ -22,6 +26,10 @@ public class Player : MonoBehaviour
GetComponent<NavMeshAgent>().enabled = true; GetComponent<NavMeshAgent>().enabled = true;
StartCoroutine(MapManager.inst.Rebaker()); StartCoroutine(MapManager.inst.Rebaker());
} }
/// <summary>
/// Reset this player from the current player.
/// </summary>
/// <returns></returns>
public void ResetCurrentPlayer() public void ResetCurrentPlayer()
{ {
GetComponent<NavMeshAgent>().enabled = false; GetComponent<NavMeshAgent>().enabled = false;
...@@ -67,11 +75,16 @@ public class Player : MonoBehaviour ...@@ -67,11 +75,16 @@ public class Player : MonoBehaviour
anim.SetBool("isWalking", false); anim.SetBool("isWalking", false);
PlayerController.inst.isPlayerMoving = false; PlayerController.inst.isPlayerMoving = false;
} }
/// <summary>
/// Count 2 second to make player in shooting mode.
/// </summary>
/// <param name="startTime">Start time of the timer.</param>
/// <returns></returns>
public IEnumerator CountPlayerClick(float startTime) public IEnumerator CountPlayerClick(float startTime)
{ {
float time = Time.time; float time = Time.time;
float endTime = startTime + 2; float endTime = startTime + 2;
while(time <= endTime) while (time <= endTime)
{ {
yield return null; yield return null;
time = Time.time; time = Time.time;
...@@ -84,11 +97,12 @@ public class Player : MonoBehaviour ...@@ -84,11 +97,12 @@ public class Player : MonoBehaviour
StartCoroutine(Camera.main.GetComponent<CameraController>().ZoomInAtPlayer(this)); StartCoroutine(Camera.main.GetComponent<CameraController>().ZoomInAtPlayer(this));
} }
} }
// Start is called before the first frame update // Start is called before the first frame update
void Start() void Start()
{ {
anim = GetComponent<Animator>(); anim = GetComponent<Animator>();
agent = GetComponent<NavMeshAgent>();
} }
// Update is called once per frame // Update is called once per frame
...@@ -96,10 +110,4 @@ public class Player : MonoBehaviour ...@@ -96,10 +110,4 @@ public class Player : MonoBehaviour
{ {
} }
private void LateUpdate()
{
if(agent.isActiveAndEnabled && agent.velocity.magnitude > 0)
transform.rotation = Quaternion.LookRotation(agent.velocity.normalized);
}
} }
...@@ -40,9 +40,13 @@ public class PlayerController : SingletonBehaviour<PlayerController> ...@@ -40,9 +40,13 @@ public class PlayerController : SingletonBehaviour<PlayerController>
prePos = MapPos; prePos = MapPos;
} }
//Control player only if camera is not zooming in to or out from the current player
if (!isZooming) if (!isZooming)
{ {
if (Input.GetMouseButtonDown(0) && !isPlayerMoving && !isPlayerShooting) if (Input.GetMouseButtonDown(0))
{
//Move the current player.
if(!isPlayerMoving && !isPlayerShooting)
{ {
Ray mouseRay = Camera.main.ScreenPointToRay(Input.mousePosition); Ray mouseRay = Camera.main.ScreenPointToRay(Input.mousePosition);
RaycastHit hit; RaycastHit hit;
...@@ -67,10 +71,26 @@ public class PlayerController : SingletonBehaviour<PlayerController> ...@@ -67,10 +71,26 @@ public class PlayerController : SingletonBehaviour<PlayerController>
currentPlayer.ResetCurrentPlayer(); currentPlayer.ResetCurrentPlayer();
} }
} }
}
else if (Input.GetMouseButtonDown(1) && isPlayerShooting) else if (Input.GetMouseButtonDown(1) && isPlayerShooting)
{ {
StartCoroutine(Camera.main.GetComponent<CameraController>().ZoomOutFromPlayer()); StartCoroutine(Camera.main.GetComponent<CameraController>().ZoomOutFromPlayer());
} }
} }
} }
void LateUpdate()
{
if (currentPlayer != null && currentPlayer.GetComponent<NavMeshAgent>().velocity.magnitude > 0)
transform.rotation = Quaternion.LookRotation(currentPlayer.GetComponent<NavMeshAgent>().velocity.normalized);
if (isPlayerShooting)
{
Quaternion destinationRotation = Quaternion.Euler(new Vector3(transform.eulerAngles.x, Camera.main.transform.eulerAngles.y, currentPlayer.transform.eulerAngles.z));
currentPlayer.transform.rotation = Quaternion.Lerp(currentPlayer.transform.rotation, destinationRotation, Time.deltaTime * 10);
Debug.Log(currentPlayer.shootingArm.transform.position);
Debug.Log(currentPlayer.shootingArm.transform.eulerAngles);
Debug.Log(Camera.main.transform.position);
Debug.Log(Camera.main.transform.eulerAngles);
}
}
} }
...@@ -9,7 +9,7 @@ public class TestTools : MonoBehaviour ...@@ -9,7 +9,7 @@ public class TestTools : MonoBehaviour
public InputField wallXInput, wallYInput; public InputField wallXInput, wallYInput;
/*public void AddFloor() public void AddFloor()
{ {
MapManager.inst.currentMap.CreateFloor(new Vector2Int(int.Parse(floorXInput.text), int.Parse(floorYInput.text))); MapManager.inst.currentMap.CreateFloor(new Vector2Int(int.Parse(floorXInput.text), int.Parse(floorYInput.text)));
} }
...@@ -19,12 +19,20 @@ public class TestTools : MonoBehaviour ...@@ -19,12 +19,20 @@ public class TestTools : MonoBehaviour
} }
public void AddWall() public void AddWall()
{ {
MapManager.inst.currentMap.CreateWall(new Vector2(float.Parse(wallXInput.text), float.Parse(wallYInput.text))); MapManager.inst.currentMap.CreateWall(new Vector2(float.Parse(wallXInput.text), float.Parse(wallYInput.text)), WallType.Normal);
} }
public void RemoveWall() public void RemoveWall()
{ {
MapManager.inst.currentMap.RemoveWall(new Vector2(float.Parse(wallXInput.text), float.Parse(wallYInput.text))); MapManager.inst.currentMap.RemoveWall(new Vector2(float.Parse(wallXInput.text), float.Parse(wallYInput.text)));
} }
public void AddTurret()
{
MapManager.inst.currentMap.CreateObject(new Vector2Int(int.Parse(floorXInput.text), int.Parse(floorYInput.text)), ObjType.Camera);
}
public void RemoveTurret()
{
MapManager.inst.currentMap.RemoveObject(new Vector2Int(int.Parse(floorXInput.text), int.Parse(floorYInput.text)));
}
public void SaveMap() public void SaveMap()
{ {
...@@ -33,7 +41,7 @@ public class TestTools : MonoBehaviour ...@@ -33,7 +41,7 @@ public class TestTools : MonoBehaviour
public void LoadMap() public void LoadMap()
{ {
MapManager.inst.LoadMap(MapManager.inst.stage[1]); MapManager.inst.LoadMap(MapManager.inst.stage[1]);
}*/ }
// Start is called before the first frame update // Start is called before the first frame update
void Start() void Start()
......
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