학생들 에셋 추가
This commit is contained in:
8
Assets/FemaleRunnerAnimset/Scripts.meta
Normal file
8
Assets/FemaleRunnerAnimset/Scripts.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 35d57b8d60cbe784aa5237275613cb94
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
71
Assets/FemaleRunnerAnimset/Scripts/CameraFollowWalk.cs
Normal file
71
Assets/FemaleRunnerAnimset/Scripts/CameraFollowWalk.cs
Normal file
@@ -0,0 +1,71 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class CameraFollowWalk : CameraWalk
|
||||
{
|
||||
private Quaternion _initialRotation;
|
||||
private Transform _parent;
|
||||
private Vector3 initialLocalPosition;
|
||||
|
||||
[Header("카메라가 캐릭터 따라 회전하기")]
|
||||
public bool isRotate = false;
|
||||
protected override void Start()
|
||||
{
|
||||
base.Start();
|
||||
|
||||
_initialRotation = transform.rotation;
|
||||
_parent = transform.parent;
|
||||
initialLocalPosition = transform.position - _parent.position;
|
||||
}
|
||||
protected virtual void LateUpdate()
|
||||
{
|
||||
if (!isRotate)
|
||||
{
|
||||
transform.rotation = _initialRotation;
|
||||
transform.position = _parent.position + initialLocalPosition;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
protected override void myCameraWalk()
|
||||
{
|
||||
// WASD로 카메라 이동
|
||||
float horizontal = Input.GetAxis("Horizontal") * moveSpeed * Time.deltaTime;
|
||||
float vertical = Input.GetAxis("Vertical") * moveSpeed * Time.deltaTime;
|
||||
Vector3 prePos = transform.position;
|
||||
transform.Translate(horizontal, 0, vertical, Space.Self);
|
||||
initialLocalPosition += transform.position - prePos;
|
||||
//
|
||||
if (Input.GetKey(KeyCode.Q))
|
||||
{
|
||||
prePos = transform.position;
|
||||
transform.Translate(0, -moveSpeed * Time.deltaTime, 0, Space.Self);
|
||||
initialLocalPosition += transform.position - prePos;
|
||||
}
|
||||
if (Input.GetKey(KeyCode.E))
|
||||
{
|
||||
prePos = transform.position;
|
||||
transform.Translate(0, moveSpeed * Time.deltaTime, 0, Space.Self);
|
||||
initialLocalPosition += transform.position - prePos;
|
||||
}
|
||||
// 마우스 휠로 확대/축소
|
||||
float fov = GetComponent<Camera>().fieldOfView;
|
||||
fov -= Input.GetAxis("Mouse ScrollWheel") * zoomSpeed;
|
||||
fov = Mathf.Clamp(fov, minFov, maxFov);
|
||||
GetComponent<Camera>().fieldOfView = fov;
|
||||
|
||||
// 오른쪽 마우스로 마우스 커서 표시/숨기기
|
||||
VisibleMouse();
|
||||
|
||||
//
|
||||
if (!isCursorVisible)
|
||||
{
|
||||
float mouseX = Input.GetAxis("Mouse X") * rotateSpeed * Time.deltaTime;
|
||||
float mouseY = Input.GetAxis("Mouse Y") * rotateSpeed * Time.deltaTime;
|
||||
|
||||
transform.eulerAngles = new Vector3(transform.eulerAngles.x - mouseY, transform.eulerAngles.y + mouseX, 0);
|
||||
_initialRotation = transform.rotation;
|
||||
}
|
||||
}
|
||||
}
|
||||
18
Assets/FemaleRunnerAnimset/Scripts/CameraFollowWalk.cs.meta
Normal file
18
Assets/FemaleRunnerAnimset/Scripts/CameraFollowWalk.cs.meta
Normal file
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 506d39bbe736c0448a4f31478b8751bb
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 301499
|
||||
packageName: Female Runner Animset - FreeWalk&Jog
|
||||
packageVersion: 1.1.2
|
||||
assetPath: Assets/FemaleRunnerAnimset/Scripts/CameraFollowWalk.cs
|
||||
uploadId: 896938
|
||||
69
Assets/FemaleRunnerAnimset/Scripts/CameraWalk.cs
Normal file
69
Assets/FemaleRunnerAnimset/Scripts/CameraWalk.cs
Normal file
@@ -0,0 +1,69 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class CameraWalk : MonoBehaviour
|
||||
{
|
||||
[Header("카메라 이동속도")]
|
||||
public float moveSpeed = 10.0f;
|
||||
[Header("카메라 회전 감도(마우스)")]
|
||||
public float rotateSpeed = 500.0f;
|
||||
[Header("카메라 줌 속도")]
|
||||
public float zoomSpeed = 10.0f;
|
||||
[Header("카메라 줌 최소/최댓값")]
|
||||
public float minFov = 15.0f;
|
||||
public float maxFov = 90.0f;
|
||||
|
||||
protected bool isCursorVisible = true;
|
||||
|
||||
protected virtual void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
protected virtual void Update()
|
||||
{
|
||||
myCameraWalk();
|
||||
}
|
||||
protected virtual void myCameraWalk()
|
||||
{
|
||||
// WASD로 카메라 이동
|
||||
float horizontal = Input.GetAxis("Horizontal") * moveSpeed * Time.deltaTime;
|
||||
float vertical = Input.GetAxis("Vertical") * moveSpeed * Time.deltaTime;
|
||||
transform.Translate(horizontal, 0, vertical);
|
||||
if (Input.GetKey(KeyCode.Q))
|
||||
{
|
||||
transform.Translate(0, -moveSpeed * Time.deltaTime, 0);
|
||||
}
|
||||
if (Input.GetKey(KeyCode.E))
|
||||
{
|
||||
transform.Translate(0, moveSpeed * Time.deltaTime, 0);
|
||||
}
|
||||
// 마우스 휠로 확대/축소
|
||||
float fov = GetComponent<Camera>().fieldOfView;
|
||||
fov -= Input.GetAxis("Mouse ScrollWheel") * zoomSpeed;
|
||||
fov = Mathf.Clamp(fov, minFov, maxFov);
|
||||
GetComponent<Camera>().fieldOfView = fov;
|
||||
|
||||
// 오른쪽 마우스로 마우스 커서 표시/숨기기
|
||||
VisibleMouse();
|
||||
|
||||
//
|
||||
if (!isCursorVisible)
|
||||
{
|
||||
float mouseX = Input.GetAxis("Mouse X") * rotateSpeed * Time.deltaTime;
|
||||
float mouseY = Input.GetAxis("Mouse Y") * rotateSpeed * Time.deltaTime;
|
||||
|
||||
transform.eulerAngles = new Vector3(transform.eulerAngles.x - mouseY, transform.eulerAngles.y + mouseX, 0);
|
||||
}
|
||||
}
|
||||
protected void VisibleMouse()
|
||||
{
|
||||
if (Input.GetKeyDown(KeyCode.Escape))
|
||||
{
|
||||
isCursorVisible = !isCursorVisible;
|
||||
Cursor.visible = isCursorVisible;
|
||||
Cursor.lockState = isCursorVisible ? CursorLockMode.None : CursorLockMode.Locked;
|
||||
}
|
||||
}
|
||||
}
|
||||
18
Assets/FemaleRunnerAnimset/Scripts/CameraWalk.cs.meta
Normal file
18
Assets/FemaleRunnerAnimset/Scripts/CameraWalk.cs.meta
Normal file
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 91696e217c5db8145b16ab24acccbe11
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 301499
|
||||
packageName: Female Runner Animset - FreeWalk&Jog
|
||||
packageVersion: 1.1.2
|
||||
assetPath: Assets/FemaleRunnerAnimset/Scripts/CameraWalk.cs
|
||||
uploadId: 896938
|
||||
30
Assets/FemaleRunnerAnimset/Scripts/CliffCheck.cs
Normal file
30
Assets/FemaleRunnerAnimset/Scripts/CliffCheck.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class CliffCheck : GroundCheck
|
||||
{
|
||||
private Vector3 _initialGroundPos;
|
||||
|
||||
protected override void Start()
|
||||
{
|
||||
base.Start();
|
||||
_initialGroundPos = Vector3.zero;
|
||||
}
|
||||
|
||||
protected override void OnTriggerEnter(Collider other)
|
||||
{
|
||||
base.OnTriggerEnter(other);
|
||||
if (other.CompareTag("Ground"))
|
||||
{
|
||||
if(_initialGroundPos == Vector3.zero)
|
||||
{
|
||||
_initialGroundPos = _parent.localPosition;
|
||||
}
|
||||
else
|
||||
{
|
||||
_parent.localPosition = _initialGroundPos;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
18
Assets/FemaleRunnerAnimset/Scripts/CliffCheck.cs.meta
Normal file
18
Assets/FemaleRunnerAnimset/Scripts/CliffCheck.cs.meta
Normal file
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fec71231fc37a2047a07a1efff84bd6e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 301499
|
||||
packageName: Female Runner Animset - FreeWalk&Jog
|
||||
packageVersion: 1.1.2
|
||||
assetPath: Assets/FemaleRunnerAnimset/Scripts/CliffCheck.cs
|
||||
uploadId: 896938
|
||||
49
Assets/FemaleRunnerAnimset/Scripts/GroundCheck.cs
Normal file
49
Assets/FemaleRunnerAnimset/Scripts/GroundCheck.cs
Normal file
@@ -0,0 +1,49 @@
|
||||
using System.ComponentModel;
|
||||
using UnityEngine;
|
||||
|
||||
public class GroundCheck : MonoBehaviour
|
||||
{
|
||||
public Animator animator;
|
||||
public bool isGoingBack = true;
|
||||
public float startY;
|
||||
public float startX;
|
||||
private Vector3 _startPosition;
|
||||
|
||||
[SerializeField] protected Transform _parent;
|
||||
|
||||
protected virtual void Start()
|
||||
{
|
||||
_parent = this.transform.parent;
|
||||
_startPosition = _parent.localPosition;
|
||||
if (_startPosition.y != 0f)
|
||||
{
|
||||
_startPosition = new Vector3(_startPosition.x, 0f, _startPosition.z);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
protected virtual void OnTriggerEnter(Collider other)
|
||||
{
|
||||
if (other.CompareTag("Ground"))
|
||||
{
|
||||
animator.SetBool("isLanding", true);
|
||||
if (isGoingBack)
|
||||
{
|
||||
_parent.localPosition = new Vector3(_parent.localPosition.x, startY, _parent.localPosition.z);
|
||||
Debug.Log(_parent.localPosition);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected virtual void OnTriggerExit(Collider other)
|
||||
{
|
||||
if (other.CompareTag("Ground"))
|
||||
{
|
||||
animator.SetBool("isLanding", false);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
18
Assets/FemaleRunnerAnimset/Scripts/GroundCheck.cs.meta
Normal file
18
Assets/FemaleRunnerAnimset/Scripts/GroundCheck.cs.meta
Normal file
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 10c1dcd362a800843ba7d1e621522e3a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 301499
|
||||
packageName: Female Runner Animset - FreeWalk&Jog
|
||||
packageVersion: 1.1.2
|
||||
assetPath: Assets/FemaleRunnerAnimset/Scripts/GroundCheck.cs
|
||||
uploadId: 896938
|
||||
79
Assets/FemaleRunnerAnimset/Scripts/WallrunCheck.cs
Normal file
79
Assets/FemaleRunnerAnimset/Scripts/WallrunCheck.cs
Normal file
@@ -0,0 +1,79 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class WallrunCheck : GroundCheck
|
||||
{
|
||||
public string stateName;
|
||||
protected bool isStart = true;
|
||||
|
||||
protected void Update()
|
||||
{
|
||||
StartCoroutine(stateName);
|
||||
}
|
||||
protected override void OnTriggerEnter(Collider other)
|
||||
{
|
||||
if (isStart)
|
||||
{
|
||||
isStart = false;
|
||||
return;
|
||||
}
|
||||
base.OnTriggerEnter(other);
|
||||
|
||||
}
|
||||
protected IEnumerator wallrunJumpCheck()
|
||||
{
|
||||
if (animator.GetCurrentAnimatorStateInfo(0).IsName("Mvm_Jog_Stop_Rfoot"))
|
||||
{
|
||||
_parent.localPosition = Vector3.Lerp(_parent.localPosition, new Vector3(6.9f, _parent.localPosition.y, _parent.localPosition.z), Time.deltaTime * 1f);
|
||||
}
|
||||
if (animator.GetCurrentAnimatorStateInfo(0).IsName("Walk_Stop_Rfoot"))
|
||||
{
|
||||
_parent.localPosition = Vector3.Lerp(_parent.localPosition, new Vector3(6.9f, _parent.localPosition.y, _parent.localPosition.z), Time.deltaTime * 1f);
|
||||
}
|
||||
yield return null;
|
||||
}
|
||||
protected IEnumerator wallrun1FCheck()
|
||||
{
|
||||
if (animator.GetCurrentAnimatorStateInfo(0).IsName("WallL_Run_Exit") || animator.GetCurrentAnimatorStateInfo(0).IsName("WallR_Run_Exit"))
|
||||
{
|
||||
_parent.localPosition = Vector3.Lerp(_parent.localPosition, new Vector3(startX, _parent.localPosition.y, _parent.localPosition.z), Time.deltaTime * 10f);
|
||||
}
|
||||
if (animator.GetCurrentAnimatorStateInfo(0).IsName("Mvm_TurnIP_R180"))
|
||||
{
|
||||
_parent.localPosition = Vector3.Lerp(_parent.localPosition, new Vector3(_parent.localPosition.x, _parent.localPosition.y, 1f), Time.deltaTime * 2f);
|
||||
}
|
||||
yield return null;
|
||||
}
|
||||
protected IEnumerator wallrun2FCheck()
|
||||
{
|
||||
if (animator.GetCurrentAnimatorStateInfo(0).IsName("Mvm_Sprint_Start_R0"))
|
||||
{
|
||||
_parent.rotation = Quaternion.Lerp(_parent.rotation, Quaternion.Euler(0, 180, 0), Time.deltaTime * 10f);
|
||||
}
|
||||
if (animator.GetCurrentAnimatorStateInfo(0).IsName("Mvm_Sprint_Start_L0"))
|
||||
{
|
||||
_parent.rotation = Quaternion.Lerp(_parent.rotation, Quaternion.Euler(0, 0, 0), Time.deltaTime * 10f);
|
||||
}
|
||||
if (animator.GetCurrentAnimatorStateInfo(0).IsName("Mvm_TurnIP_R180 0"))
|
||||
{
|
||||
_parent.localPosition = Vector3.Lerp(_parent.localPosition, new Vector3(_parent.localPosition.x, _parent.localPosition.y, 0f), Time.deltaTime * 2f);
|
||||
}
|
||||
yield return null;
|
||||
}
|
||||
protected IEnumerator wallrunHold()
|
||||
{
|
||||
if (animator.GetCurrentAnimatorStateInfo(0).IsName("Mvm_Run_Stop_Rfoot") || animator.GetCurrentAnimatorStateInfo(0).IsName("Mvm_Run_Stop_Lfoot"))
|
||||
{
|
||||
_parent.localPosition = Vector3.Lerp(_parent.localPosition, new Vector3(startX, _parent.localPosition.y, _parent.localPosition.z), Time.deltaTime * 10f);
|
||||
|
||||
}
|
||||
if (animator.GetCurrentAnimatorStateInfo(0).IsName("Mvm_TurnIP_R180"))
|
||||
{
|
||||
_parent.localPosition = Vector3.Lerp(_parent.localPosition, new Vector3(_parent.localPosition.x, _parent.localPosition.y, 0f), Time.deltaTime * 2f);
|
||||
}
|
||||
|
||||
|
||||
yield return null;
|
||||
}
|
||||
}
|
||||
18
Assets/FemaleRunnerAnimset/Scripts/WallrunCheck.cs.meta
Normal file
18
Assets/FemaleRunnerAnimset/Scripts/WallrunCheck.cs.meta
Normal file
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e58bb4458ff180a47a4d9267dcb28dfc
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 301499
|
||||
packageName: Female Runner Animset - FreeWalk&Jog
|
||||
packageVersion: 1.1.2
|
||||
assetPath: Assets/FemaleRunnerAnimset/Scripts/WallrunCheck.cs
|
||||
uploadId: 896938
|
||||
Reference in New Issue
Block a user