Commit 30e0829e authored by 18손재민's avatar 18손재민

슈팅 애니메이션 연결, 플레이어 몸은 이제 카메라 방향을 향함

parent 255c8a17
fileFormatVersion: 2
guid: 50bbbb7b70a6ab94da946d4123f25e75
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
...@@ -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}
...@@ -1362,7 +1361,7 @@ Animator: ...@@ -1362,7 +1361,7 @@ Animator:
m_Controller: {fileID: 9100000, guid: eaf238dc35bc3074fa2fffcbcbbe58df, type: 2} m_Controller: {fileID: 9100000, guid: eaf238dc35bc3074fa2fffcbcbbe58df, type: 2}
m_CullingMode: 1 m_CullingMode: 1
m_UpdateMode: 0 m_UpdateMode: 0
m_ApplyRootMotion: 0 m_ApplyRootMotion: 1
m_LinearVelocityBlending: 0 m_LinearVelocityBlending: 0
m_WarningMessage: m_WarningMessage:
m_HasTransformHierarchy: 1 m_HasTransformHierarchy: 1
...@@ -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: 494213313239917623}
--- !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:
...@@ -1585,6 +1585,7 @@ SkinnedMeshRenderer: ...@@ -1585,6 +1585,7 @@ SkinnedMeshRenderer:
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
...@@ -2281,7 +2282,7 @@ Transform: ...@@ -2281,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:
...@@ -2310,6 +2311,7 @@ SkinnedMeshRenderer: ...@@ -2310,6 +2311,7 @@ SkinnedMeshRenderer:
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
...@@ -2476,7 +2478,8 @@ Transform: ...@@ -2476,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}
...@@ -38,7 +38,7 @@ RenderSettings: ...@@ -38,7 +38,7 @@ RenderSettings:
m_ReflectionIntensity: 1 m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0} m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 170076734} m_Sun: {fileID: 170076734}
m_IndirectSpecularColor: {r: 0.44657826, g: 0.49641263, b: 0.57481676, a: 1} m_IndirectSpecularColor: {r: 0.44657898, g: 0.4964133, b: 0.5748178, a: 1}
m_UseRadianceAmbientProbe: 0 m_UseRadianceAmbientProbe: 0
--- !u!157 &3 --- !u!157 &3
LightmapSettings: LightmapSettings:
...@@ -54,7 +54,7 @@ LightmapSettings: ...@@ -54,7 +54,7 @@ LightmapSettings:
m_EnableBakedLightmaps: 1 m_EnableBakedLightmaps: 1
m_EnableRealtimeLightmaps: 0 m_EnableRealtimeLightmaps: 0
m_LightmapEditorSettings: m_LightmapEditorSettings:
serializedVersion: 10 serializedVersion: 12
m_Resolution: 2 m_Resolution: 2
m_BakeResolution: 10 m_BakeResolution: 10
m_AtlasSize: 512 m_AtlasSize: 512
...@@ -62,6 +62,7 @@ LightmapSettings: ...@@ -62,6 +62,7 @@ LightmapSettings:
m_AOMaxDistance: 1 m_AOMaxDistance: 1
m_CompAOExponent: 1 m_CompAOExponent: 1
m_CompAOExponentDirect: 0 m_CompAOExponentDirect: 0
m_ExtractAmbientOcclusion: 0
m_Padding: 2 m_Padding: 2
m_LightmapParameters: {fileID: 0} m_LightmapParameters: {fileID: 0}
m_LightmapsBakeMode: 1 m_LightmapsBakeMode: 1
...@@ -76,10 +77,16 @@ LightmapSettings: ...@@ -76,10 +77,16 @@ LightmapSettings:
m_PVRDirectSampleCount: 32 m_PVRDirectSampleCount: 32
m_PVRSampleCount: 256 m_PVRSampleCount: 256
m_PVRBounces: 2 m_PVRBounces: 2
m_PVREnvironmentSampleCount: 256
m_PVREnvironmentReferencePointCount: 2048
m_PVRFilteringMode: 2
m_PVRDenoiserTypeDirect: 0
m_PVRDenoiserTypeIndirect: 0
m_PVRDenoiserTypeAO: 0
m_PVRFilterTypeDirect: 0 m_PVRFilterTypeDirect: 0
m_PVRFilterTypeIndirect: 0 m_PVRFilterTypeIndirect: 0
m_PVRFilterTypeAO: 0 m_PVRFilterTypeAO: 0
m_PVRFilteringMode: 1 m_PVREnvironmentMIS: 0
m_PVRCulling: 1 m_PVRCulling: 1
m_PVRFilteringGaussRadiusDirect: 1 m_PVRFilteringGaussRadiusDirect: 1
m_PVRFilteringGaussRadiusIndirect: 5 m_PVRFilteringGaussRadiusIndirect: 5
...@@ -87,7 +94,8 @@ LightmapSettings: ...@@ -87,7 +94,8 @@ LightmapSettings:
m_PVRFilteringAtrousPositionSigmaDirect: 0.5 m_PVRFilteringAtrousPositionSigmaDirect: 0.5
m_PVRFilteringAtrousPositionSigmaIndirect: 2 m_PVRFilteringAtrousPositionSigmaIndirect: 2
m_PVRFilteringAtrousPositionSigmaAO: 1 m_PVRFilteringAtrousPositionSigmaAO: 1
m_ShowResolutionOverlay: 1 m_ExportTrainingData: 0
m_TrainingDataDestination: TrainingData
m_LightingDataAsset: {fileID: 0} m_LightingDataAsset: {fileID: 0}
m_UseShadowmask: 1 m_UseShadowmask: 1
--- !u!196 &4 --- !u!196 &4
...@@ -137,12 +145,13 @@ Light: ...@@ -137,12 +145,13 @@ Light:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 170076733} m_GameObject: {fileID: 170076733}
m_Enabled: 1 m_Enabled: 1
serializedVersion: 8 serializedVersion: 9
m_Type: 1 m_Type: 1
m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1} m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1}
m_Intensity: 1 m_Intensity: 1
m_Range: 10 m_Range: 10
m_SpotAngle: 30 m_SpotAngle: 30
m_InnerSpotAngle: 21.80208
m_CookieSize: 10 m_CookieSize: 10
m_Shadows: m_Shadows:
m_Type: 2 m_Type: 2
...@@ -152,6 +161,24 @@ Light: ...@@ -152,6 +161,24 @@ Light:
m_Bias: 0.05 m_Bias: 0.05
m_NormalBias: 0.4 m_NormalBias: 0.4
m_NearPlane: 0.2 m_NearPlane: 0.2
m_CullingMatrixOverride:
e00: 1
e01: 0
e02: 0
e03: 0
e10: 0
e11: 1
e12: 0
e13: 0
e20: 0
e21: 0
e22: 1
e23: 0
e30: 0
e31: 0
e32: 0
e33: 1
m_UseCullingMatrixOverride: 0
m_Cookie: {fileID: 0} m_Cookie: {fileID: 0}
m_DrawHalo: 0 m_DrawHalo: 0
m_Flare: {fileID: 0} m_Flare: {fileID: 0}
...@@ -159,12 +186,15 @@ Light: ...@@ -159,12 +186,15 @@ Light:
m_CullingMask: m_CullingMask:
serializedVersion: 2 serializedVersion: 2
m_Bits: 4294967295 m_Bits: 4294967295
m_RenderingLayerMask: 1
m_Lightmapping: 1 m_Lightmapping: 1
m_LightShadowCasterMode: 0 m_LightShadowCasterMode: 0
m_AreaSize: {x: 1, y: 1} m_AreaSize: {x: 1, y: 1}
m_BounceIntensity: 1 m_BounceIntensity: 1
m_ColorTemperature: 6570 m_ColorTemperature: 6570
m_UseColorTemperature: 0 m_UseColorTemperature: 0
m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0}
m_UseBoundingSphereOverride: 0
m_ShadowRadius: 0 m_ShadowRadius: 0
m_ShadowAngle: 0 m_ShadowAngle: 0
--- !u!4 &170076735 --- !u!4 &170076735
...@@ -220,9 +250,10 @@ Camera: ...@@ -220,9 +250,10 @@ Camera:
m_ClearFlags: 1 m_ClearFlags: 1
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
m_projectionMatrixMode: 1 m_projectionMatrixMode: 1
m_GateFitMode: 2
m_FOVAxisMode: 0
m_SensorSize: {x: 36, y: 24} m_SensorSize: {x: 36, y: 24}
m_LensShift: {x: 0, y: 0} m_LensShift: {x: 0, y: 0}
m_GateFitMode: 2
m_FocalLength: 50 m_FocalLength: 50
m_NormalizedViewPortRect: m_NormalizedViewPortRect:
serializedVersion: 2 serializedVersion: 2
...@@ -230,7 +261,7 @@ Camera: ...@@ -230,7 +261,7 @@ Camera:
y: 0 y: 0
width: 1 width: 1
height: 1 height: 1
near clip plane: 0.3 near clip plane: 0.01
far clip plane: 1000 far clip plane: 1000
field of view: 40 field of view: 40
orthographic: 0 orthographic: 0
...@@ -660,6 +691,11 @@ PrefabInstance: ...@@ -660,6 +691,11 @@ PrefabInstance:
m_Modification: m_Modification:
m_TransformParent: {fileID: 0} m_TransformParent: {fileID: 0}
m_Modifications: m_Modifications:
- target: {fileID: 7277015661519863741, guid: 20dee07e28273f049a9093ae4453912f,
type: 3}
propertyPath: m_NavMeshData
value:
objectReference: {fileID: 0}
- target: {fileID: 7277015661519863740, guid: 20dee07e28273f049a9093ae4453912f, - target: {fileID: 7277015661519863740, guid: 20dee07e28273f049a9093ae4453912f,
type: 3} type: 3}
propertyPath: m_Name propertyPath: m_Name
...@@ -670,11 +706,6 @@ PrefabInstance: ...@@ -670,11 +706,6 @@ PrefabInstance:
propertyPath: m_IsActive propertyPath: m_IsActive
value: 1 value: 1
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 7277015661519863741, guid: 20dee07e28273f049a9093ae4453912f,
type: 3}
propertyPath: m_NavMeshData
value:
objectReference: {fileID: 0}
- target: {fileID: 7277015661519863742, guid: 20dee07e28273f049a9093ae4453912f, - target: {fileID: 7277015661519863742, guid: 20dee07e28273f049a9093ae4453912f,
type: 3} type: 3}
propertyPath: m_LocalPosition.x propertyPath: m_LocalPosition.x
......
...@@ -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;
......
...@@ -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,6 +75,11 @@ public class Player : MonoBehaviour ...@@ -67,6 +75,11 @@ 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;
...@@ -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,37 +40,54 @@ public class PlayerController : SingletonBehaviour<PlayerController> ...@@ -40,37 +40,54 @@ 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))
{ {
Ray mouseRay = Camera.main.ScreenPointToRay(Input.mousePosition); //Move the current player.
RaycastHit hit; if(!isPlayerMoving && !isPlayerShooting)
if (Physics.Raycast(mouseRay, out hit) && hit.collider.gameObject.tag.Equals("Player"))
{ {
if (currentPlayer != null) Ray mouseRay = Camera.main.ScreenPointToRay(Input.mousePosition);
currentPlayer.ResetCurrentPlayer(); RaycastHit hit;
currentPlayer = hit.transform.gameObject.GetComponent<Player>(); if (Physics.Raycast(mouseRay, out hit) && hit.collider.gameObject.tag.Equals("Player"))
StartCoroutine(currentPlayer.SetCurrentPlayer()); {
StartCoroutine(currentPlayer.CountPlayerClick(Time.time)); if (currentPlayer != null)
Debug.Log(hit.collider.gameObject.tag); currentPlayer.ResetCurrentPlayer();
} currentPlayer = hit.transform.gameObject.GetComponent<Player>();
else if (Physics.Raycast(mouseRay, out hit) && hit.collider.gameObject.tag.Equals("floor")) StartCoroutine(currentPlayer.SetCurrentPlayer());
{ StartCoroutine(currentPlayer.CountPlayerClick(Time.time));
if (currentPlayer != null) Debug.Log(hit.collider.gameObject.tag);
currentPlayer.MovePlayer(hit.collider.gameObject.transform.position); }
Debug.Log(hit.collider.gameObject.tag); else if (Physics.Raycast(mouseRay, out hit) && hit.collider.gameObject.tag.Equals("floor"))
} {
else if (hit.collider == null) if (currentPlayer != null)
{ currentPlayer.MovePlayer(hit.collider.gameObject.transform.position);
if (currentPlayer != null) Debug.Log(hit.collider.gameObject.tag);
currentPlayer.ResetCurrentPlayer(); }
else if (hit.collider == null)
{
if (currentPlayer != null)
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());
} }
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);
currentPlayer.shootingArm.transform.LookAt(Camera.main.transform.position + new Vector3(1, 0, 0));
}
} }
} }
void LateUpdate()
{
if (currentPlayer != null && currentPlayer.GetComponent<NavMeshAgent>().velocity.magnitude > 0)
transform.rotation = Quaternion.LookRotation(currentPlayer.GetComponent<NavMeshAgent>().velocity.normalized);
}
} }
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