항해 Fix
This commit is contained in:
parent
f1e1ac0be6
commit
275a4d9a5c
File diff suppressed because it is too large
Load Diff
9403
Assets/01.Scenes/_03.Sail.unity
Normal file
9403
Assets/01.Scenes/_03.Sail.unity
Normal file
File diff suppressed because it is too large
Load Diff
7
Assets/01.Scenes/_03.Sail.unity.meta
Normal file
7
Assets/01.Scenes/_03.Sail.unity.meta
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: dfdc87be57e724c41a8bab692be76c9c
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
72
Assets/02.Scripts/Sail/ShipMove.cs
Normal file
72
Assets/02.Scripts/Sail/ShipMove.cs
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace BlueWater
|
||||||
|
{
|
||||||
|
public class TestCharacterMove_01 : MonoBehaviour
|
||||||
|
{
|
||||||
|
[SerializeField]
|
||||||
|
private GameObject obj;
|
||||||
|
|
||||||
|
public float speed = 50.0f;
|
||||||
|
protected float force = 0.0f;
|
||||||
|
public float force_add = 0.002f;
|
||||||
|
|
||||||
|
void Update()
|
||||||
|
{
|
||||||
|
float rotation_01 = Mathf.Abs(-0.5f + ((obj.transform.eulerAngles.y)/ 180) % 1.0f);
|
||||||
|
float rotation_02 = Mathf.Abs(-0.5f + rotation_01);
|
||||||
|
float back_check = (obj.transform.eulerAngles.y >= 90.0f && obj.transform.eulerAngles.y <= 270.0f) ? 1.0f : -1.0f;
|
||||||
|
float side_check = (obj.transform.eulerAngles.y <= 180.0f)? -1.0f : 1.0f;
|
||||||
|
|
||||||
|
float time = Time.deltaTime;
|
||||||
|
|
||||||
|
float move_time = (-speed * time);
|
||||||
|
|
||||||
|
if (Input.GetKey(KeyCode.UpArrow)|| Input.GetKey(KeyCode.W))
|
||||||
|
{
|
||||||
|
force += force_add;
|
||||||
|
if (force >= 1.0f) force = 1.0f;
|
||||||
|
|
||||||
|
}
|
||||||
|
else if (Input.GetKey(KeyCode.DownArrow) || Input.GetKey(KeyCode.S))
|
||||||
|
{
|
||||||
|
if (force > 0.0f)
|
||||||
|
{
|
||||||
|
force -= force_add;
|
||||||
|
if (force <= 0.0f) force = 0.0f;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
force -= force_add/4.0f;
|
||||||
|
if (force <= -0.5f) force = -0.5f;
|
||||||
|
}
|
||||||
|
// transform.Translate(0, 0, speed * time);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (force < 0.0f)force += force_add/2.0f;
|
||||||
|
else if(force > 0.0f)force -= force_add/2.0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
transform.Translate((side_check * move_time * rotation_02)*force, 0.0f, (back_check * move_time * rotation_01)*force);
|
||||||
|
|
||||||
|
|
||||||
|
if (Input.GetKey(KeyCode.RightArrow)|| Input.GetKey(KeyCode.D))
|
||||||
|
{
|
||||||
|
obj.transform.Rotate(new Vector3(0.0f, speed * Time.deltaTime , 0.0f));
|
||||||
|
}
|
||||||
|
else if (Input.GetKey(KeyCode.LeftArrow)|| Input.GetKey(KeyCode.A))
|
||||||
|
{
|
||||||
|
obj.transform.Rotate(new Vector3(0.0f, speed * -Time.deltaTime , 0.0f));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
obj.transform.Rotate(new Vector3(0.0f, 0.0f * Time.deltaTime , 0.0f));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
2
Assets/02.Scripts/Sail/ShipMove.cs.meta
Normal file
2
Assets/02.Scripts/Sail/ShipMove.cs.meta
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: e6cb3b30d3a111d4aa6d3b433ee544c2
|
@ -89,9 +89,9 @@ Material:
|
|||||||
- Boolean_2918AA79: 0
|
- Boolean_2918AA79: 0
|
||||||
- Vector1_20DB7652: 0.158
|
- Vector1_20DB7652: 0.158
|
||||||
- Vector1_301E02E2: 240
|
- Vector1_301E02E2: 240
|
||||||
- Vector1_31894ABB: 0.0158
|
- Vector1_31894ABB: 0.017
|
||||||
- Vector1_3632ABA2: 0
|
- Vector1_3632ABA2: 0
|
||||||
- Vector1_45F25267: 7.23
|
- Vector1_45F25267: 5.84
|
||||||
- Vector1_738B39CF: 0
|
- Vector1_738B39CF: 0
|
||||||
- Vector1_854A7D8C: 0.51
|
- Vector1_854A7D8C: 0.51
|
||||||
- Vector1_9C73072A: 0.88
|
- Vector1_9C73072A: 0.88
|
||||||
@ -133,8 +133,8 @@ Material:
|
|||||||
- _WorkflowMode: 1
|
- _WorkflowMode: 1
|
||||||
- _ZWrite: 1
|
- _ZWrite: 1
|
||||||
m_Colors:
|
m_Colors:
|
||||||
- Color_1139F668: {r: 0.22241013, g: 0.80931354, b: 0.9622642, a: 0.46666667}
|
- Color_1139F668: {r: 0.22241013, g: 0.9843137, b: 1, a: 0.6862745}
|
||||||
- Color_198818EE: {r: 0, g: 0.24201687, b: 0.94337153, a: 1}
|
- Color_198818EE: {r: 0, g: 0.25882354, b: 1, a: 0.6745098}
|
||||||
- Color_626750DD: {r: 2, g: 2, b: 2, a: 1}
|
- Color_626750DD: {r: 2, g: 2, b: 2, a: 1}
|
||||||
- Color_77A2EDE9: {r: 31.626795, g: 31.626795, b: 31.626795, a: 0.21960784}
|
- Color_77A2EDE9: {r: 31.626795, g: 31.626795, b: 31.626795, a: 0.21960784}
|
||||||
- Vector2_1E1B6943: {r: 1, g: 5, b: 0, a: 0}
|
- Vector2_1E1B6943: {r: 1, g: 5, b: 0, a: 0}
|
||||||
|
@ -322,4 +322,4 @@ QualitySettings:
|
|||||||
m_PerPlatformDefaultQuality:
|
m_PerPlatformDefaultQuality:
|
||||||
Android: 0
|
Android: 0
|
||||||
Standalone: 0
|
Standalone: 0
|
||||||
Windows Store Apps: 0
|
iPhone: 0
|
||||||
|
Loading…
Reference in New Issue
Block a user