Commit b8c7d64d authored by 18손재민's avatar 18손재민

총알 생성 및 현재 사용 가능한 총알 정보 저장 구현

parent fa1e1c3c
...@@ -69,6 +69,7 @@ MeshRenderer: ...@@ -69,6 +69,7 @@ MeshRenderer:
m_ProbeAnchor: {fileID: 0} m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0} m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1 m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0 m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0 m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0 m_ImportantGI: 0
...@@ -120,6 +121,7 @@ TrailRenderer: ...@@ -120,6 +121,7 @@ TrailRenderer:
m_ProbeAnchor: {fileID: 0} m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0} m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1 m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0 m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0 m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0 m_ImportantGI: 0
...@@ -209,8 +211,8 @@ Rigidbody: ...@@ -209,8 +211,8 @@ Rigidbody:
m_Mass: 1 m_Mass: 1
m_Drag: 0 m_Drag: 0
m_AngularDrag: 0.05 m_AngularDrag: 0.05
m_UseGravity: 1 m_UseGravity: 0
m_IsKinematic: 1 m_IsKinematic: 0
m_Interpolate: 0 m_Interpolate: 0
m_Constraints: 0 m_Constraints: 0
m_CollisionDetection: 0 m_CollisionDetection: 0
......
...@@ -69,6 +69,7 @@ MeshRenderer: ...@@ -69,6 +69,7 @@ MeshRenderer:
m_ProbeAnchor: {fileID: 0} m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0} m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1 m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0 m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0 m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0 m_ImportantGI: 0
...@@ -120,6 +121,7 @@ TrailRenderer: ...@@ -120,6 +121,7 @@ TrailRenderer:
m_ProbeAnchor: {fileID: 0} m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0} m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1 m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0 m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0 m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0 m_ImportantGI: 0
...@@ -209,8 +211,8 @@ Rigidbody: ...@@ -209,8 +211,8 @@ Rigidbody:
m_Mass: 1 m_Mass: 1
m_Drag: 0 m_Drag: 0
m_AngularDrag: 0.05 m_AngularDrag: 0.05
m_UseGravity: 1 m_UseGravity: 0
m_IsKinematic: 1 m_IsKinematic: 0
m_Interpolate: 0 m_Interpolate: 0
m_Constraints: 0 m_Constraints: 0
m_CollisionDetection: 0 m_CollisionDetection: 0
......
...@@ -13,6 +13,8 @@ GameObject: ...@@ -13,6 +13,8 @@ GameObject:
- component: {fileID: 9013146449102202151} - component: {fileID: 9013146449102202151}
- component: {fileID: 7091668226477965095} - component: {fileID: 7091668226477965095}
- component: {fileID: 1468768842466997388} - component: {fileID: 1468768842466997388}
- component: {fileID: 2621242702935536648}
- component: {fileID: -7647737824225647995}
m_Layer: 0 m_Layer: 0
m_Name: TruthBullet m_Name: TruthBullet
m_TagString: Untagged m_TagString: Untagged
...@@ -67,6 +69,7 @@ MeshRenderer: ...@@ -67,6 +69,7 @@ MeshRenderer:
m_ProbeAnchor: {fileID: 0} m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0} m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1 m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0 m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0 m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0 m_ImportantGI: 0
...@@ -118,6 +121,7 @@ TrailRenderer: ...@@ -118,6 +121,7 @@ TrailRenderer:
m_ProbeAnchor: {fileID: 0} m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0} m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1 m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0 m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0 m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0 m_ImportantGI: 0
...@@ -196,3 +200,31 @@ TrailRenderer: ...@@ -196,3 +200,31 @@ TrailRenderer:
m_MinVertexDistance: 0.1 m_MinVertexDistance: 0.1
m_Autodestruct: 0 m_Autodestruct: 0
m_Emitting: 1 m_Emitting: 1
--- !u!54 &2621242702935536648
Rigidbody:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7554112578236620015}
serializedVersion: 2
m_Mass: 1
m_Drag: 0
m_AngularDrag: 0.05
m_UseGravity: 0
m_IsKinematic: 0
m_Interpolate: 0
m_Constraints: 0
m_CollisionDetection: 0
--- !u!114 &-7647737824225647995
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7554112578236620015}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: e5f8ba3dd55623f42b27096d5298af36, type: 3}
m_Name:
m_EditorClassIdentifier:
...@@ -58,3 +58,9 @@ MonoBehaviour: ...@@ -58,3 +58,9 @@ MonoBehaviour:
surface: {fileID: 0} surface: {fileID: 0}
stage: stage:
- {fileID: 2496973653136699540, guid: dbb2e09c19fe5ad49b11a6b95e5ac9e8, type: 3} - {fileID: 2496973653136699540, guid: dbb2e09c19fe5ad49b11a6b95e5ac9e8, type: 3}
truthBullet: {fileID: 7554112578236620015, guid: bfe2c93abf5421b4a9b142f60d689533,
type: 3}
fakeBullet: {fileID: 5866539243986221368, guid: a1830defb592fe841ab1732fd18f73a1,
type: 3}
mirrorBullet: {fileID: 3200095709359611570, guid: bb70103aa487bc346a6df423335477a2,
type: 3}
This diff is collapsed.
...@@ -645,6 +645,11 @@ PrefabInstance: ...@@ -645,6 +645,11 @@ PrefabInstance:
propertyPath: m_LocalEulerAnglesHint.z propertyPath: m_LocalEulerAnglesHint.z
value: 0 value: 0
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 1444571407667829093, guid: 0b18400fb62a12d4e9cb5fbb8ecbb53f,
type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: [] m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 0b18400fb62a12d4e9cb5fbb8ecbb53f, type: 3} m_SourcePrefab: {fileID: 100100000, guid: 0b18400fb62a12d4e9cb5fbb8ecbb53f, type: 3}
--- !u!1001 &5089720519379341084 --- !u!1001 &5089720519379341084
...@@ -728,11 +733,6 @@ PrefabInstance: ...@@ -728,11 +733,6 @@ PrefabInstance:
propertyPath: m_Name propertyPath: m_Name
value: MapManager value: MapManager
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 6014610519130626400, guid: 11285456de5f1854d947bea83275646f,
type: 3}
propertyPath: m_IsActive
value: 1
objectReference: {fileID: 0}
- target: {fileID: 6014610519130626206, guid: 11285456de5f1854d947bea83275646f, - target: {fileID: 6014610519130626206, guid: 11285456de5f1854d947bea83275646f,
type: 3} type: 3}
propertyPath: m_LocalPosition.x propertyPath: m_LocalPosition.x
...@@ -793,18 +793,6 @@ PrefabInstance: ...@@ -793,18 +793,6 @@ PrefabInstance:
propertyPath: surface propertyPath: surface
value: value:
objectReference: {fileID: 2102809461} objectReference: {fileID: 2102809461}
- target: {fileID: 3268100033343711389, guid: 11285456de5f1854d947bea83275646f,
type: 3}
propertyPath: player
value:
objectReference: {fileID: 494213313239918027, guid: 449b2ca4d925da541bb45c84b63aab98,
type: 3}
- target: {fileID: 3268100033343711389, guid: 11285456de5f1854d947bea83275646f,
type: 3}
propertyPath: stage.Array.data[0]
value:
objectReference: {fileID: 2496973653136699540, guid: dbb2e09c19fe5ad49b11a6b95e5ac9e8,
type: 3}
m_RemovedComponents: [] m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 11285456de5f1854d947bea83275646f, type: 3} m_SourcePrefab: {fileID: 100100000, guid: 11285456de5f1854d947bea83275646f, type: 3}
--- !u!1001 &7277015660625800392 --- !u!1001 &7277015660625800392
......
...@@ -14,6 +14,6 @@ public abstract class Bullet : MonoBehaviour ...@@ -14,6 +14,6 @@ public abstract class Bullet : MonoBehaviour
public void Init(Vector3 velocity) public void Init(Vector3 velocity)
{ {
rb.velocity = velocity; GetComponent<Rigidbody>().velocity = velocity;
} }
} }
...@@ -6,6 +6,8 @@ using System.Linq; ...@@ -6,6 +6,8 @@ using System.Linq;
public class GameManager : SingletonBehaviour<GameManager> public class GameManager : SingletonBehaviour<GameManager>
{ {
public Material mirrorMaterial; public Material mirrorMaterial;
/* /*
private List<IPlayerInteractor> playerInteractors; private List<IPlayerInteractor> playerInteractors;
......
...@@ -16,6 +16,8 @@ public class MapManager : SingletonBehaviour<MapManager> ...@@ -16,6 +16,8 @@ public class MapManager : SingletonBehaviour<MapManager>
public Map currentMap; public Map currentMap;
public NavMeshSurface surface; public NavMeshSurface surface;
public Map[] stage; public Map[] stage;
public GameObject truthBullet, fakeBullet, mirrorBullet;
public BulletFactory bulletFactory;
public void LoadMap(Map _newMap) public void LoadMap(Map _newMap)
{ {
...@@ -36,6 +38,7 @@ public class MapManager : SingletonBehaviour<MapManager> ...@@ -36,6 +38,7 @@ public class MapManager : SingletonBehaviour<MapManager>
private void Awake() private void Awake()
{ {
players = new List<GameObject>(); players = new List<GameObject>();
bulletFactory = new BulletFactory(truthBullet, fakeBullet, mirrorBullet);
} }
// Start is called before the first frame update // Start is called before the first frame update
......
...@@ -98,6 +98,11 @@ public class Player : MonoBehaviour ...@@ -98,6 +98,11 @@ public class Player : MonoBehaviour
} }
} }
public void Shoot(BulletCode bulletCode)
{
Bullet newBullet = MapManager.inst.bulletFactory.MakeBullet(bulletCode);
newBullet.Init(transform.forward);
}
// Start is called before the first frame update // Start is called before the first frame update
void Start() void Start()
......
...@@ -7,9 +7,9 @@ using UnityEngine.AI; ...@@ -7,9 +7,9 @@ using UnityEngine.AI;
public class PlayerController : SingletonBehaviour<PlayerController> public class PlayerController : SingletonBehaviour<PlayerController>
{ {
public Player currentPlayer; public Player currentPlayer;
public bool isPlayerMoving; public bool isPlayerMoving, isPlayerShooting, isZooming;
public bool isPlayerShooting; private List<BulletCode> bulletList = new List<BulletCode>();
public bool isZooming; private int bulletCount = 0;
private Vector2Int prePos; private Vector2Int prePos;
public Vector2Int MapPos public Vector2Int MapPos
{ {
...@@ -24,10 +24,30 @@ public class PlayerController : SingletonBehaviour<PlayerController> ...@@ -24,10 +24,30 @@ public class PlayerController : SingletonBehaviour<PlayerController>
public event Action<Vector2Int> OnPlayerMove; public event Action<Vector2Int> OnPlayerMove;
public string GetCurrentBullet()
{
return bulletList.Count > 0 ? bulletList[bulletCount].ToString() : null;
}
// Start is called before the first frame update // Start is called before the first frame update
void Start() void Start()
{ {
prePos = MapPos; prePos = MapPos;
bulletList.Add(BulletCode.True);
bulletList.Add(BulletCode.True);
bulletList.Add(BulletCode.True);
bulletList.Add(BulletCode.True);
bulletList.Add(BulletCode.True);
bulletList.Add(BulletCode.False);
bulletList.Add(BulletCode.False);
bulletList.Add(BulletCode.False);
bulletList.Add(BulletCode.False);
bulletList.Add(BulletCode.False);
bulletList.Add(BulletCode.Mirror);
bulletList.Add(BulletCode.Mirror);
bulletList.Add(BulletCode.Mirror);
bulletList.Add(BulletCode.Mirror);
bulletList.Add(BulletCode.Mirror);
} }
// Update is called once per frame // Update is called once per frame
...@@ -71,6 +91,14 @@ public class PlayerController : SingletonBehaviour<PlayerController> ...@@ -71,6 +91,14 @@ public class PlayerController : SingletonBehaviour<PlayerController>
currentPlayer.ResetCurrentPlayer(); currentPlayer.ResetCurrentPlayer();
} }
} }
else if (isPlayerShooting)
{
if (bulletList.Count > 0)
{
currentPlayer.Shoot(bulletList[bulletCount]);
bulletList.RemoveAt(bulletCount);
}
}
} }
else if (Input.GetMouseButtonDown(1) && isPlayerShooting) else if (Input.GetMouseButtonDown(1) && isPlayerShooting)
{ {
...@@ -87,10 +115,6 @@ public class PlayerController : SingletonBehaviour<PlayerController> ...@@ -87,10 +115,6 @@ public class PlayerController : SingletonBehaviour<PlayerController>
{ {
Quaternion destinationRotation = Quaternion.Euler(new Vector3(transform.eulerAngles.x, Camera.main.transform.eulerAngles.y, currentPlayer.transform.eulerAngles.z)); 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); 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);
} }
} }
} }
...@@ -6,8 +6,9 @@ using UnityEngine.UI; ...@@ -6,8 +6,9 @@ using UnityEngine.UI;
public class TestTools : MonoBehaviour public class TestTools : MonoBehaviour
{ {
public InputField floorXInput, floorYInput; public InputField floorXInput, floorYInput;
public InputField wallXInput, wallYInput; public InputField wallXInput, wallYInput;
public InputField objectXInput, objectYInput;
public Text currentBullet;
public void AddFloor() public void AddFloor()
{ {
...@@ -25,13 +26,21 @@ public class TestTools : MonoBehaviour ...@@ -25,13 +26,21 @@ public class TestTools : MonoBehaviour
{ {
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 AddCase()
{
MapManager.inst.currentMap.CreateObject(new Vector2Int(int.Parse(objectXInput.text), int.Parse(objectYInput.text)), ObjType.Briefcase);
}
public void AddTurret() public void AddTurret()
{ {
MapManager.inst.currentMap.CreateObject(new Vector2Int(int.Parse(floorXInput.text), int.Parse(floorYInput.text)), ObjType.Camera); MapManager.inst.currentMap.CreateObject(new Vector2Int(int.Parse(objectXInput.text), int.Parse(objectYInput.text)), ObjType.Camera);
} }
public void RemoveTurret() public void AddMannequin()
{ {
MapManager.inst.currentMap.RemoveObject(new Vector2Int(int.Parse(floorXInput.text), int.Parse(floorYInput.text))); MapManager.inst.currentMap.CreateObject(new Vector2Int(int.Parse(objectXInput.text), int.Parse(objectYInput.text)), ObjType.Mannequin);
}
public void RemoveObject()
{
MapManager.inst.currentMap.RemoveObject(new Vector2Int(int.Parse(objectXInput.text), int.Parse(objectYInput.text)));
} }
public void SaveMap() public void SaveMap()
...@@ -52,6 +61,6 @@ public class TestTools : MonoBehaviour ...@@ -52,6 +61,6 @@ public class TestTools : MonoBehaviour
// Update is called once per frame // Update is called once per frame
void Update() void Update()
{ {
currentBullet.text = "Current Bullet : " + PlayerController.inst.GetCurrentBullet();
} }
} }
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