#15 Ready to movement in ship

This commit is contained in:
M1_IDMhan 2023-08-10 22:33:10 +09:00
parent 8af4158f44
commit a15e8cf91e
6 changed files with 1119 additions and 15 deletions

File diff suppressed because it is too large Load Diff

View File

@ -15,10 +15,11 @@ public class DraggableCard : MonoBehaviour, IPointerDownHandler, IDragHandler, I
public void OnPointerDown(PointerEventData eventData)
{
originalPosition = transform.position;
originalScale = transform.localScale;
var transform1 = transform;
originalPosition = transform1.position;
originalScale = transform1.localScale;
canvasGroup.alpha = 0.5f;
transform.localScale = new Vector3(0.3f, 0.3f, 1f);
transform1.localScale = new Vector3(0.3f, 0.3f, 1f);
}
public void OnDrag(PointerEventData eventData)
@ -26,7 +27,7 @@ public class DraggableCard : MonoBehaviour, IPointerDownHandler, IDragHandler, I
transform.position = Input.mousePosition;
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
RaycastHit hit;
if (Physics.Raycast(ray, out hit) && hit.collider.tag == "Ground")
if (Physics.Raycast(ray, out hit) && hit.collider.CompareTag("Ground"))
{
// 마우스가 Ground 위에 있을 때
@ -38,8 +39,9 @@ public class DraggableCard : MonoBehaviour, IPointerDownHandler, IDragHandler, I
// 지형에 올바르게 드롭되지 않으면
if (!IsDroppedOnTarget())
{
transform.position = originalPosition;
transform.localScale = originalScale;
var transform1 = transform;
transform1.position = originalPosition;
transform1.localScale = originalScale;
canvasGroup.alpha = 1;
}
}
@ -51,7 +53,7 @@ public class DraggableCard : MonoBehaviour, IPointerDownHandler, IDragHandler, I
if (Physics.Raycast(ray, out hit))
{
if (hit.collider.tag == "Ground")
if (hit.collider.CompareTag("Ground"))
{
Destroy(gameObject);
return true;

View File

@ -2,6 +2,7 @@ using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[RequireComponent(typeof(Rigidbody))]
public class Floater : MonoBehaviour
{
private GerstnerWave waveGenerator;

View File

@ -4,6 +4,8 @@ using UnityEngine.InputSystem;
namespace _02.Scripts.WaterAndShip
{
[RequireComponent(typeof(Rigidbody))]
[RequireComponent(typeof(PlayerInput))]
public class Player : MonoBehaviour
{
public float maxSpeed = 10f;

View File

@ -36,6 +36,7 @@ Material:
RenderType: Transparent
disabledShaderPasses:
- DepthOnly
- SHADOWCASTER
m_LockedProperties:
m_SavedProperties:
serializedVersion: 3
@ -132,7 +133,7 @@ Material:
- _ZWrite: 0
m_Colors:
- _BaseColor: {r: 0.454902, g: 0.454902, b: 0.454902, a: 1}
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _Color: {r: 0.454902, g: 0.454902, b: 0.454902, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
m_BuildTextureStacks: []

View File

@ -117,7 +117,7 @@ Material:
- _ZWrite: 1
m_Colors:
- _BaseColor: {r: 0, g: 0.666667, b: 1, a: 1}
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _Color: {r: 0, g: 0.666667, b: 1, a: 1}
- _EmissionColor: {r: 1, g: 1, b: 1, a: 1}
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
m_BuildTextureStacks: []