diff --git a/Assets/AvatarFaceControl.cs b/Assets/AvatarFaceControl.cs new file mode 100644 index 0000000..ef7d088 --- /dev/null +++ b/Assets/AvatarFaceControl.cs @@ -0,0 +1,60 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using UnityEngine.UI; +using UnityEngine.EventSystems; + +public class AvatarFaceControl : MonoBehaviour +{ + [SerializeField] Material _avatarFace; + [SerializeField] Texture _defaultTexture; + + bool _crRunning = false; + IEnumerator _coroutine; + // Start is called before the first frame update + void Start() + { + _avatarFace.SetTexture("_MainTex", _defaultTexture); + } + + // Update is called once per frame + void Update() + { + if (Input.GetKey(KeyCode.Alpha1)) + ShowFace(QuickSlotManager.s_quickSlots[0].fid); + if (Input.GetKey(KeyCode.Alpha2)) + ShowFace(QuickSlotManager.s_quickSlots[1].fid); + if (Input.GetKey(KeyCode.Alpha3)) + ShowFace(QuickSlotManager.s_quickSlots[2].fid); + if (Input.GetKey(KeyCode.Alpha4)) + ShowFace(QuickSlotManager.s_quickSlots[3].fid); + } + + public void ChangeFace(int faceIndex) + { + _avatarFace.SetTexture("_MainTex", QuickSlotManager.s_faceTextures[faceIndex]); + } + + void ShowFace(int index) + { + if(_crRunning && _coroutine != null) + { + StopCoroutine(_coroutine); + } + _coroutine = ShowFaceCoroutine(index); + StartCoroutine(_coroutine); + } + + IEnumerator ShowFaceCoroutine(int index) + { + _crRunning = true; + + ChangeFace(index); + + yield return new WaitForSeconds(10f); + + ChangeFace(11); + + _crRunning = true; + } +} diff --git a/Assets/AvatarFaceControl.cs.meta b/Assets/AvatarFaceControl.cs.meta new file mode 100644 index 0000000..7dc5db4 --- /dev/null +++ b/Assets/AvatarFaceControl.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: e214c06747d49e84098aba1e0f695c23 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/CamManager.cs b/Assets/CamManager.cs new file mode 100644 index 0000000..5123f3e --- /dev/null +++ b/Assets/CamManager.cs @@ -0,0 +1,80 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using Cinemachine; + +public class CamManager : MonoBehaviour +{ + private GameObject player; + private CinemachineFreeLook thirdPersonCam; + private bool _useMouseToRotateTp; + + public GameObject lookAt; + public float xRotateSpeed; + public float yRotateSpeed; + public float zoomSpeed; + // Start is called before the first frame update + void Start() + { + player = GameObject.FindWithTag("Player").gameObject; + //lookAt = GameObject.Find("LookAt").gameObject; + thirdPersonCam = GameObject.Find("ThirdPersonCam").GetComponent(); + thirdPersonCam.Follow = player.transform; + thirdPersonCam.LookAt = lookAt.transform; + + } + + // Update is called once per frame + void Update() + { + if(Input.GetMouseButtonDown(1)) + { + _useMouseToRotateTp = true; + } + if (Input.GetMouseButtonUp(1)) + { + _useMouseToRotateTp = false; + } + } + + private void LateUpdate() + { + if (_useMouseToRotateTp) + { + RotateTp(); + } + else + { + thirdPersonCam.m_XAxis.m_MaxSpeed = 0; + thirdPersonCam.m_YAxis.m_MaxSpeed = 0; + } + if (Input.mouseScrollDelta.y != 0) + Zoom(); + } + + private void RotateTp() + { + thirdPersonCam.m_XAxis.m_MaxSpeed = xRotateSpeed; + thirdPersonCam.m_YAxis.m_MaxSpeed = yRotateSpeed; + } + + private void Zoom() + { + if(Input.mouseScrollDelta.y<0) + { + if(thirdPersonCam.m_Lens.FieldOfView < 80) + { + Debug.Log("Zoom out"); + thirdPersonCam.m_Lens.FieldOfView += zoomSpeed; + } + } + if (Input.mouseScrollDelta.y > 0) + { + if (thirdPersonCam.m_Lens.FieldOfView > 5) + { + Debug.Log("Zoom in"); + thirdPersonCam.m_Lens.FieldOfView -= zoomSpeed; + } + } + } +} diff --git a/Assets/CamManager.cs.meta b/Assets/CamManager.cs.meta new file mode 100644 index 0000000..f21505c --- /dev/null +++ b/Assets/CamManager.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 999daa8f7bb874e0b83314debe45eb92 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/CharacterAnimation.cs b/Assets/CharacterAnimation.cs new file mode 100644 index 0000000..a7e83e6 --- /dev/null +++ b/Assets/CharacterAnimation.cs @@ -0,0 +1,36 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using DG.Tweening; + +public class CharacterAnimation : MonoBehaviour +{ + private Transform _objectPivot; + private Transform _spaceSuit; + + // Start is called before the first frame update + void Start() + { + _objectPivot = transform.Find("ObjectPivot"); + _spaceSuit = transform.Find("ObjectPivot/Space_Suit"); + } + + public void Teleport(CharacterController controller, Vector3 startPosition, Vector3 destination) + { + DOTween.Sequence() + .Join(transform.DOMove(new Vector3(startPosition.x, transform.position.y, startPosition.z), 1f).SetEase(Ease.OutSine)) + .Join(_spaceSuit.DOLocalMoveX(0.8f, 0.8f)).SetEase(Ease.InOutSine) + .Join(_spaceSuit.DOLocalMoveY(2, 1.5f)).SetEase(Ease.InExpo) + .Join(_objectPivot.DOLocalRotate(new Vector3(0, 360 * 10, 0), 5f, RotateMode.FastBeyond360).SetEase(Ease.InOutSine)) + .Insert(4.6f, _spaceSuit.DOLocalMoveY(1, 0.2f)).SetEase(Ease.OutQuart) + .Insert(4.4f, _spaceSuit.DOLocalMoveX(0, 0.4f)).SetEase(Ease.OutSine) + .Append(_spaceSuit.DOLocalMoveY(50, 0.2f)).SetEase(Ease.OutCubic) + .AppendCallback(() => + { + transform.position = destination; + _spaceSuit.DOLocalMoveY(0, 0.2f).SetEase(Ease.OutCubic); + } + ) + .OnComplete(() => controller.enabled = true); + } +} diff --git a/Assets/CharacterAnimation.cs.meta b/Assets/CharacterAnimation.cs.meta new file mode 100644 index 0000000..416b21e --- /dev/null +++ b/Assets/CharacterAnimation.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: a7702cd88511bcf47ba709cac4e4f5f5 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Portal.cs b/Assets/Portal.cs new file mode 100644 index 0000000..e2911a2 --- /dev/null +++ b/Assets/Portal.cs @@ -0,0 +1,71 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using DG.Tweening; + +public class Portal : MonoBehaviour +{ + [SerializeField] private Portal _target; + + private Transform _spawnPoint; + public Transform spawnPoint { get { return _spawnPoint; } } + + public Transform _objectPivot; + private CharacterController _controller; + private bool _isActive; + private Sequence _portalSequence; + + + // Start is called before the first frame update + void Start() + { + _spawnPoint = transform.Find("ObjectPivot/SpawnPoint"); + _objectPivot = transform.Find("ObjectPivot"); + + _portalSequence = DOTween.Sequence().SetAutoKill(false) + .Join(transform.DOLocalRotate(new Vector3(0, 360 * 30, 0), 5f, RotateMode.FastBeyond360).SetEase(Ease.InOutSine)) + .Join(_objectPivot.DOLocalRotate(new Vector3(0, 0, 80), 1f).SetEase(Ease.InSine)) + .Insert(3.5f, _objectPivot.DOLocalRotate(new Vector3(0, 0, 0), 1.5f).SetEase(Ease.OutSine)) + .Pause(); + } + + // Update is called once per frame + void Update() + { + if(!_isActive) + { + return; + } + + if(Input.GetKeyDown(KeyCode.X)) + { + ActivatePortal(); + } + } + + private void OnTriggerEnter(Collider other) + { + if(other.CompareTag("Player")) + { + _controller = other.GetComponent(); + _isActive = true; + } + } + + private void OnTriggerExit(Collider other) + { + _isActive = false; + } + private void ActivatePortal() + { + _isActive = false; + _controller.enabled = false; + + _portalSequence.Rewind(); + _portalSequence.Play(); + + CharacterAnimation characterAnimation = _controller.GetComponent(); + characterAnimation.Teleport(_controller,transform.position,_target.spawnPoint.position); + } +} diff --git a/Assets/Portal.cs.meta b/Assets/Portal.cs.meta new file mode 100644 index 0000000..b16c523 --- /dev/null +++ b/Assets/Portal.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: afbf6ebc0f4ea1543af90ec023eeba01 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/QuickSlotButton.cs b/Assets/QuickSlotButton.cs new file mode 100644 index 0000000..c1bda4c --- /dev/null +++ b/Assets/QuickSlotButton.cs @@ -0,0 +1,31 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using UnityEngine.UI; +using UnityEngine.EventSystems; + +public class QuickSlotButton : MonoBehaviour, ISelectHandler, IPointerClickHandler +{ + public enum _Buttontype { Quickslot, Viewport } + + public _Buttontype Buttontype; + public Image ButtonImage; + public Text ButtonText; + public int fid; + + public void OnSelect(BaseEventData eventData) + { + if(Buttontype == _Buttontype.Viewport) + { + QuickSlotManager.CurrentlySelected = this; + } + } + + public void OnPointerClick(PointerEventData eventData) + { + if(Buttontype == _Buttontype.Quickslot && QuickSlotManager.CurrentlySelected != null) + { + QuickSlotManager.AddToQuickSlot(this); + } + } +} diff --git a/Assets/QuickSlotButton.cs.meta b/Assets/QuickSlotButton.cs.meta new file mode 100644 index 0000000..aca596d --- /dev/null +++ b/Assets/QuickSlotButton.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 2e5730c1f52ae554481e7e61894aaece +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/QuickSlotManager.cs b/Assets/QuickSlotManager.cs new file mode 100644 index 0000000..13002e2 --- /dev/null +++ b/Assets/QuickSlotManager.cs @@ -0,0 +1,96 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using UnityEngine.EventSystems; + +public class QuickSlotManager : MonoBehaviour, IPointerClickHandler +{ + [SerializeField] List _buttonIcons; + [SerializeField] List _quickSlots; + [SerializeField] List _faceTextures; + + + public Transform GridLayout; + + public GameObject _viewportButtonPrefab; + public static QuickSlotButton CurrentlySelected; + public static List s_quickSlots; + public static List s_faceTextures; + // Start is called before the first frame update + void Start() + { + GameObject buttonInstance; + QuickSlotButton buttonProp; + + for(int i=0; i<_buttonIcons.Count; i++) + { + buttonInstance = Instantiate(_viewportButtonPrefab, GridLayout); + buttonProp = buttonInstance.GetComponent(); + + buttonProp.ButtonImage.sprite = _buttonIcons[i]; + buttonProp.ButtonText.text = _buttonIcons[i].name; + buttonProp.fid = i; + } + + s_quickSlots = new List(); + for(int i=0;i<_quickSlots.Count;i++) + { + s_quickSlots.Add(_quickSlots[i]); + } + + s_faceTextures = new List(); + for(int i=0;i<_faceTextures.Count;i++) + { + s_faceTextures.Add(_faceTextures[i]); + } + } + + public static void AddToQuickSlot(QuickSlotButton quickSlotButton) + { + int index = CheckDistinct(); + if(index == -1) + { + quickSlotButton.ButtonImage.sprite = CurrentlySelected.ButtonImage.sprite; + quickSlotButton.ButtonText.text = CurrentlySelected.ButtonText.text; + quickSlotButton.fid = CurrentlySelected.fid; + } + else + { + SwapButtons(quickSlotButton, index); + } + CurrentlySelected = null; + } + + public void OnPointerClick(PointerEventData eventData) + { + CurrentlySelected = null; + } + + static int CheckDistinct() + { + int retVal = -1; + for(int i=0;i(); _animator = GetComponent(); _mainCamera = GameObject.FindGameObjectWithTag("MainCamera"); + _isPunch = false; } protected virtual void Update() @@ -43,13 +46,14 @@ protected virtual void Update() _isRun = Input.GetKey(KeyCode.LeftShift); _isJump = Input.GetKey(KeyCode.Space); + //_isPunch = Input.GetKey(KeyCode.Z); //Roll(); + Jump(); - GroundCheck(); Move(); - - //Punch(); + GroundCheck(); + Punch(); } private void Move() @@ -143,17 +147,19 @@ void Roll() Invoke("ResetTrigger", 1f); } } - + */ void Punch() { - if (Input.GetKeyDown(KeyCode.LeftControl) && !_isJump && !_isRoll && !_isPunch) + if (Input.GetKeyDown(KeyCode.Z) && _grounded && !_isPunch && (_input == Vector2.zero)) { - _isRoll = true; + _isPunch = true; _animator.SetTrigger("Punch"); - Invoke("ResetTrigger", 0.3f); } } - */ + void ResetTrigger() + { + _isPunch = false; + } } \ No newline at end of file diff --git a/Assets/StaticAssets.meta b/Assets/StaticAssets.meta new file mode 100644 index 0000000..e1ed322 --- /dev/null +++ b/Assets/StaticAssets.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 441916a5b1309fb41b752b6424afb1e2 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/StaticAssets/Common.meta b/Assets/StaticAssets/Common.meta new file mode 100644 index 0000000..e194c46 --- /dev/null +++ b/Assets/StaticAssets/Common.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: a0923b075f34eaf48949ee44bb48f0f2 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/StaticAssets/Common/Animations.meta b/Assets/StaticAssets/Common/Animations.meta new file mode 100644 index 0000000..16e9217 --- /dev/null +++ b/Assets/StaticAssets/Common/Animations.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: b6724987d10ce89469aa03917b0ae40e +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/StaticAssets/Common/Animations/Punching.fbx b/Assets/StaticAssets/Common/Animations/Punching.fbx new file mode 100644 index 0000000..a579f14 Binary files /dev/null and b/Assets/StaticAssets/Common/Animations/Punching.fbx differ diff --git a/Assets/StaticAssets/Common/Animations/Punching.fbx.meta b/Assets/StaticAssets/Common/Animations/Punching.fbx.meta new file mode 100644 index 0000000..3fbb9f0 --- /dev/null +++ b/Assets/StaticAssets/Common/Animations/Punching.fbx.meta @@ -0,0 +1,134 @@ +fileFormatVersion: 2 +guid: 9d624bec36245754d8f454e2c272ba2d +ModelImporter: + serializedVersion: 20200 + internalIDToNameTable: + - first: + 74: -203655887218126122 + second: Punching + externalObjects: {} + materials: + materialImportMode: 2 + materialName: 0 + materialSearch: 1 + materialLocation: 1 + animations: + legacyGenerateAnimations: 4 + bakeSimulation: 0 + resampleCurves: 1 + optimizeGameObjects: 0 + motionNodeName: + rigImportErrors: + rigImportWarnings: + animationImportErrors: + animationImportWarnings: + animationRetargetingWarnings: + animationDoRetargetingWarnings: 0 + importAnimatedCustomProperties: 0 + importConstraints: 0 + animationCompression: 3 + animationRotationError: 0.5 + animationPositionError: 0.5 + animationScaleError: 0.5 + animationWrapMode: 0 + extraExposedTransformPaths: [] + extraUserProperties: [] + clipAnimations: + - serializedVersion: 16 + name: Punching + takeName: mixamo.com + internalID: 0 + firstFrame: 0 + lastFrame: 26 + wrapMode: 0 + orientationOffsetY: 0 + level: 0 + cycleOffset: 0 + loop: 0 + hasAdditiveReferencePose: 0 + loopTime: 0 + loopBlend: 0 + loopBlendOrientation: 0 + loopBlendPositionY: 0 + loopBlendPositionXZ: 0 + keepOriginalOrientation: 0 + keepOriginalPositionY: 1 + keepOriginalPositionXZ: 0 + heightFromFeet: 0 + mirror: 0 + bodyMask: 01000000010000000100000001000000010000000100000001000000010000000100000001000000010000000100000001000000 + curves: [] + events: [] + transformMask: [] + maskType: 3 + maskSource: {instanceID: 0} + additiveReferencePoseFrame: 0 + isReadable: 0 + meshes: + lODScreenPercentages: [] + globalScale: 1 + meshCompression: 0 + addColliders: 0 + useSRGBMaterialColor: 1 + sortHierarchyByName: 1 + importVisibility: 1 + importBlendShapes: 1 + importCameras: 1 + importLights: 1 + fileIdsGeneration: 2 + swapUVChannels: 0 + generateSecondaryUV: 0 + useFileUnits: 1 + keepQuads: 0 + weldVertices: 1 + bakeAxisConversion: 0 + preserveHierarchy: 0 + skinWeightsMode: 0 + maxBonesPerVertex: 4 + minBoneWeight: 0.001 + meshOptimizationFlags: -1 + indexFormat: 0 + secondaryUVAngleDistortion: 8 + secondaryUVAreaDistortion: 15.000001 + secondaryUVHardAngle: 88 + secondaryUVMarginMethod: 1 + secondaryUVMinLightmapResolution: 40 + secondaryUVMinObjectScale: 1 + secondaryUVPackMargin: 4 + useFileScale: 1 + tangentSpace: + normalSmoothAngle: 60 + normalImportMode: 0 + tangentImportMode: 3 + normalCalculationMode: 4 + legacyComputeAllNormalsFromSmoothingGroupsWhenMeshHasBlendShapes: 0 + blendShapeNormalImportMode: 1 + normalSmoothingSource: 0 + referencedClips: [] + importAnimation: 1 + humanDescription: + serializedVersion: 3 + human: [] + skeleton: [] + armTwist: 0.5 + foreArmTwist: 0.5 + upperLegTwist: 0.5 + legTwist: 0.5 + armStretch: 0.05 + legStretch: 0.05 + feetSpacing: 0 + globalScale: 1 + rootMotionBoneName: + hasTranslationDoF: 0 + hasExtraRoot: 1 + skeletonHasParents: 1 + lastHumanDescriptionAvatarSource: {instanceID: 0} + autoGenerateAvatarMappingIfUnspecified: 1 + animationType: 3 + humanoidOversampling: 1 + avatarSetup: 1 + addHumanoidExtraRootOnlyWhenUsingAvatar: 1 + additionalBone: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/manifest.json b/Packages/manifest.json index 7b2a7f8..003d23f 100644 --- a/Packages/manifest.json +++ b/Packages/manifest.json @@ -6,6 +6,7 @@ "com.unity.ide.rider": "2.0.7", "com.unity.ide.visualstudio": "2.0.11", "com.unity.ide.vscode": "1.2.4", + "com.unity.postprocessing": "3.1.1", "com.unity.test-framework": "1.1.29", "com.unity.textmeshpro": "3.0.6", "com.unity.timeline": "1.4.8", diff --git a/Packages/packages-lock.json b/Packages/packages-lock.json index 05f5b5b..ef5ddca 100644 --- a/Packages/packages-lock.json +++ b/Packages/packages-lock.json @@ -62,6 +62,15 @@ "dependencies": {}, "url": "https://packages.unity.com" }, + "com.unity.postprocessing": { + "version": "3.1.1", + "depth": 0, + "source": "registry", + "dependencies": { + "com.unity.modules.physics": "1.0.0" + }, + "url": "https://packages.unity.com" + }, "com.unity.services.core": { "version": "1.0.1", "depth": 1, diff --git a/ProjectSettings/ProjectSettings.asset b/ProjectSettings/ProjectSettings.asset index 3d86880..780bf8d 100644 --- a/ProjectSettings/ProjectSettings.asset +++ b/ProjectSettings/ProjectSettings.asset @@ -589,7 +589,20 @@ PlayerSettings: webGLLinkerTarget: 1 webGLThreadsSupport: 0 webGLDecompressionFallback: 0 - scriptingDefineSymbols: {} + scriptingDefineSymbols: + 1: UNITY_POST_PROCESSING_STACK_V2 + 7: UNITY_POST_PROCESSING_STACK_V2 + 13: UNITY_POST_PROCESSING_STACK_V2 + 14: UNITY_POST_PROCESSING_STACK_V2 + 19: UNITY_POST_PROCESSING_STACK_V2 + 21: UNITY_POST_PROCESSING_STACK_V2 + 25: UNITY_POST_PROCESSING_STACK_V2 + 27: UNITY_POST_PROCESSING_STACK_V2 + 28: UNITY_POST_PROCESSING_STACK_V2 + 29: UNITY_POST_PROCESSING_STACK_V2 + 30: UNITY_POST_PROCESSING_STACK_V2 + 32: UNITY_POST_PROCESSING_STACK_V2 + 33: UNITY_POST_PROCESSING_STACK_V2 additionalCompilerArguments: {} platformArchitecture: {} scriptingBackend: {} diff --git a/ProjectSettings/TagManager.asset b/ProjectSettings/TagManager.asset index 588a62e..6d2d654 100644 --- a/ProjectSettings/TagManager.asset +++ b/ProjectSettings/TagManager.asset @@ -12,8 +12,8 @@ TagManager: - Water - UI - Ground - - - - + - PostProcessing + - MyPostProcess - - -