Merge branch 'main' of 121.165.94.243:capers/bluewater into NTG

# Conflicts:
#	BlueWater/Assets/01.Scenes/03.Stage_Test.unity.meta
#	BlueWater/Assets/02.Scripts/GameManager.cs
This commit is contained in:
NTG 2023-10-06 16:17:41 +09:00
commit 073f99384d
7 changed files with 4444 additions and 378 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: dd9e1208df2066d4baf93ac5b45bffdb
timeCreated: 1496770385
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,10 +1,17 @@
using UnityEngine;
using UnityEngine.InputSystem;
// ReSharper disable once CheckNamespace
namespace BlueWaterProject
{
[RequireComponent(typeof(PlayerInput))]
public class Player : BaseCharacter
{
protected Vector2 movementInput;
public void OnMove(InputValue value) // WASD
{
movementInput = value.Get<Vector2>();
}
}
}

View File

@ -5,6 +5,32 @@ namespace BlueWaterProject
{
public class InShipPlayer : Player
{
private float characterSpeed;
private void Init()
{
characterSpeed = 5;
}
protected override void Awake()
{
base.Awake();
Init();
}
protected override void FixedUpdate()
{
base.FixedUpdate();
MoveCharacterPlayer();
}
private void MoveCharacterPlayer()
{
if(!GameManager.Inst.IsInShipMode) return;
var movement = transform.rotation * new Vector3(-movementInput.y, 0, movementInput.x) *
(characterSpeed * Time.deltaTime);
gameObject.transform.position += movement;
}
}
}

View File

@ -13,14 +13,22 @@ namespace BlueWaterProject
[Title("Controller")]
public CameraController CameraController { get; private set; }
public ShipPlayer shipPlayer;
public List<Boat> boats = new List<Boat>(10);
public List<Boat> boats = new(10);
[Required("BlueWater Player Input Action을 넣어주세요.")]
public InputActionAsset playerAction;
[SerializeField] private InputActionAsset playerAction;
[Required("Viking Prefab을 넣어주세요.")]
public GameObject inIslandPlayer;
[SerializeField] private GameObject inIslandPlayer;
[Range(0f, 1f)]
[SerializeField] private float slowSpeed = 0.1f;
private const string IN_ISLAND_PLAYER_NAME = "InIslandPlayer";
[Title("Game State")]
[field: SerializeField] public bool IsInShipMode { get; set; }
[field: SerializeField] public bool IsDredgeMode { get; set; }
[field: SerializeField] public bool IsTakeAim { get; set; }
[field: SerializeField] public bool IsAssaultMode { get; set; }
private void Init()
{
@ -37,11 +45,31 @@ namespace BlueWaterProject
Cursor.lockState = CursorLockMode.Confined;
}
public void testPrint()
public void SpawnInIslandPlayer(Vector3 spawnPosition)
{
print("Boat가 목표에 도착해서 이 함수를 호출합니다");
}
var islandPlayer = Instantiate(inIslandPlayer, spawnPosition, Quaternion.identity);
islandPlayer.name = IN_ISLAND_PLAYER_NAME;
var playerInput = islandPlayer.GetComponent<PlayerInput>();
if (playerInput == null)
{
playerInput = islandPlayer.AddComponent<PlayerInput>();
}
playerInput.actions = playerAction;
var desiredActionMap = playerInput.actions.FindActionMap(IN_ISLAND_PLAYER_NAME);
if (desiredActionMap == null)
{
print($"Action map named '{IN_ISLAND_PLAYER_NAME}' not found in player actions!");
return;
}
playerInput.defaultActionMap = IN_ISLAND_PLAYER_NAME;
playerInput.SwitchCurrentActionMap(IN_ISLAND_PLAYER_NAME);
islandPlayer.AddComponent<InIslandPlayer>();
}
public void SlowSpeedMode()
{
Time.timeScale = slowSpeed;
@ -53,5 +81,84 @@ namespace BlueWaterProject
Time.timeScale = 1f;
Time.fixedDeltaTime = 0.02f;
}
#region Game State switch
public void SwitchDredgeMode(bool isOn)
{
if (isOn)
{
SwitchTakeAim(false);
SwitchAssaultMode(false);
SwitchInShipMode(false);
CameraController.CamDredgeMode();
IsDredgeMode = true;
}
else if (IsDredgeMode)
{
IsDredgeMode = false;
}
}
public void SwitchInShipMode(bool isOn)
{
if (isOn)
{
SwitchTakeAim(false);
SwitchAssaultMode(false);
SwitchDredgeMode(false);
CameraController.CamInShipMode();
IsInShipMode = true;
}
else if (IsInShipMode)
{
CameraController.CamDredgeMode();
IsInShipMode = false;
}
}
public void SwitchAssaultMode(bool isOn)
{
if (isOn)
{
SwitchTakeAim(false);
SwitchInShipMode(false);
SwitchDredgeMode(false);
CameraController.CamAssaultMode();
UiManager.Inst.CardLayoutGroupAnimator.Play();
IsAssaultMode = true;
}
else if (IsAssaultMode)
{
CameraController.CamDredgeMode();
UiManager.Inst.CardLayoutGroupAnimator.Reverse();
IsAssaultMode = false;
}
}
public void SwitchTakeAim(bool isOn)
{
if (isOn)
{
SwitchAssaultMode(false);
SwitchInShipMode(false);
SwitchDredgeMode(false);
CameraController.CamTakeAim(true);
Cursor.visible = false;
Cursor.lockState = CursorLockMode.Locked;
IsTakeAim = true;
}
else if (IsTakeAim)
{
CameraController.CamTakeAim(false);
Cursor.visible = true;
Cursor.lockState = CursorLockMode.Confined;
IsTakeAim = false;
}
UiManager.Inst.AimOnOff(isOn);
}
#endregion
}
}

View File

@ -8,26 +8,17 @@ using UnityEngine.InputSystem;
// ReSharper disable once CheckNamespace
namespace BlueWaterProject
{
[RequireComponent(typeof(Rigidbody))]
[RequireComponent(typeof(PlayerInput))]
[SelectionBase]
public class ShipPlayer : Player
{
[Title("Component")]
private Rigidbody rb;
private Vector2 movementInput;
[Title("쉽의 기본 설정")]
private Rigidbody rb;
[Tooltip("최대 스피드")] public float maxSpeed = 10f;
[Tooltip("가속 수치")] public float acceleration = 2f;
[Tooltip("감속 수치")] public float deceleration = 2f;
[Tooltip("회전 속도")] public float turnSpeed = 10f;
[Title("캐릭터의 기본 설정")]
private GameObject character;
[Tooltip("캐릭터의 이동 속도")] public float characterSpeed = 10f;
[Title("레이더")]
public Collider[] radar = new Collider[10];
public List<Transform> inCameraRadar = new(10);
@ -40,15 +31,7 @@ namespace BlueWaterProject
public float timeOfFlight;
public Transform predictedPos;
[field: SerializeField] public List<Canon> Canons { get; private set; } = new(GlobalValue.MAX_CANON_COUNT);
[field: Title("Mode")]
[field: SerializeField]
public bool IsAssaultMode { get; set; }
[field: SerializeField] public bool IsInShipMode { get; set; }
[field: SerializeField] public bool IsDredgeMode { get; set; }
[field: SerializeField] public bool IsTakeAim { get; set; }
[Title("Interaction")]
public bool IsIslandInteraction { get; set; }
private float rayLength;
@ -58,7 +41,6 @@ namespace BlueWaterProject
private void Init()
{
character = transform.Find("InShipPlayer").gameObject;
rb = GetComponent<Rigidbody>();
GetComponentsInChildren(Canons);
@ -93,7 +75,7 @@ namespace BlueWaterProject
protected override void Start()
{
SwitchDredgeMode(true);
GameManager.Inst.SwitchDredgeMode(true);
}
protected override void FixedUpdate()
@ -113,11 +95,6 @@ namespace BlueWaterProject
#region Movement
public void OnMove(InputValue value) // WASD
{
movementInput = value.Get<Vector2>();
}
private void MoveShipPlayer()
{
var desiredVelocity = transform.forward * (movementInput.y * maxSpeed);
@ -132,21 +109,9 @@ namespace BlueWaterProject
rb.MoveRotation(rb.rotation * turnRotation);
}
private void MoveCharacterPlayer()
{
var movement = character.transform.rotation * new Vector3(-movementInput.y, 0, movementInput.x) *
(characterSpeed * Time.deltaTime);
character.transform.position += movement;
}
private void HandleMovement()
{
if (IsInShipMode)
{
MoveCharacterPlayer();
}
else
if (GameManager.Inst.IsDredgeMode)
{
MoveShipPlayer();
RotatePlayer();
@ -165,42 +130,7 @@ namespace BlueWaterProject
private void OnAssaultMode(InputValue value) // V
{
SwitchAssaultMode(!IsAssaultMode);
}
private void SwitchAssaultMode(bool isOn)
{
if (isOn)
{
SwitchTakeAim(false);
SwitchInShipMode(false);
SwitchDredgeMode(false);
GameManager.Inst.CameraController.CamAssaultMode();
UiManager.Inst.CardLayoutGroupAnimator.Play();
IsAssaultMode = true;
}
else if (IsAssaultMode)
{
GameManager.Inst.CameraController.CamDredgeMode();
UiManager.Inst.CardLayoutGroupAnimator.Reverse();
IsAssaultMode = false;
}
}
private void SwitchDredgeMode(bool isOn)
{
if (isOn)
{
SwitchTakeAim(false);
SwitchAssaultMode(false);
SwitchInShipMode(false);
GameManager.Inst.CameraController.CamDredgeMode();
IsDredgeMode = true;
}
else if (IsDredgeMode)
{
IsDredgeMode = false;
}
GameManager.Inst.SwitchAssaultMode(!GameManager.Inst.IsAssaultMode);
}
#endregion
@ -230,31 +160,14 @@ namespace BlueWaterProject
private void OnInteraction(InputValue value) //F
{
if (!IsIslandInteraction) return;
SwitchAssaultMode(true);
GameManager.Inst.SwitchAssaultMode(true);
UiManager.Inst.DefaultInteractionOnOff(false);
StopShipMovement();
}
private void OnInteractionHold(InputValue value) //F Hold
{
SwitchInShipMode(!IsInShipMode);
}
private void SwitchInShipMode(bool isOn)
{
if (isOn)
{
SwitchTakeAim(false);
SwitchAssaultMode(false);
SwitchDredgeMode(false);
GameManager.Inst.CameraController.CamInShipMode();
IsInShipMode = true;
}
else if (IsInShipMode)
{
GameManager.Inst.CameraController.CamDredgeMode();
IsInShipMode = false;
}
GameManager.Inst.SwitchInShipMode(!GameManager.Inst.IsInShipMode);
}
#endregion
@ -268,30 +181,7 @@ namespace BlueWaterProject
private void OnTakeAim(InputValue value) // Space
{
SwitchTakeAim(!IsTakeAim);
}
private void SwitchTakeAim(bool isOn)
{
if (isOn)
{
SwitchAssaultMode(false);
SwitchInShipMode(false);
SwitchDredgeMode(false);
GameManager.Inst.CameraController.CamTakeAim(true);
Cursor.visible = false;
Cursor.lockState = CursorLockMode.Locked;
IsTakeAim = true;
}
else if (IsTakeAim)
{
GameManager.Inst.CameraController.CamTakeAim(false);
Cursor.visible = true;
Cursor.lockState = CursorLockMode.Confined;
IsTakeAim = false;
}
UiManager.Inst.AimOnOff(isOn);
GameManager.Inst.SwitchTakeAim(!GameManager.Inst.IsTakeAim);
}
#endregion
@ -359,7 +249,7 @@ namespace BlueWaterProject
private void Raycast8Direction()
{
if (!IsDredgeMode) return;
if (!GameManager.Inst.IsDredgeMode) return;
var isOn = false;

View File

@ -35,6 +35,76 @@
"type": "System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089",
"key": "experimental.enabled",
"value": "{\"m_Value\":false}"
},
{
"type": "System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089",
"key": "editor.toolbarIconGUI",
"value": "{\"m_Value\":false}"
},
{
"type": "System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089",
"key": "editor.showEditorNotifications",
"value": "{\"m_Value\":false}"
},
{
"type": "System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089",
"key": "editor.showSceneInfo",
"value": "{\"m_Value\":false}"
},
{
"type": "System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089",
"key": "editor.stripProBuilderScriptsOnBuild",
"value": "{\"m_Value\":true}"
},
{
"type": "System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089",
"key": "editor.autoRecalculateCollisions",
"value": "{\"m_Value\":false}"
},
{
"type": "System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089",
"key": "mesh.meshColliderIsConvex",
"value": "{\"m_Value\":false}"
},
{
"type": "System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089",
"key": "mesh.newShapesSnapToGrid",
"value": "{\"m_Value\":true}"
},
{
"type": "UnityEngine.ProBuilder.UnwrapParameters, Unity.ProBuilder, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null",
"key": "lightmapping.defaultLightmapUnwrapParameters",
"value": "{\"m_Value\":{\"m_HardAngle\":88.0,\"m_PackMargin\":20.0,\"m_AngleError\":8.0,\"m_AreaError\":15.0}}"
},
{
"type": "System.Single, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089",
"key": "uv.uvEditorGridSnapIncrement",
"value": "{\"m_Value\":0.125}"
},
{
"type": "UnityEngine.Material, UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null",
"key": "mesh.userMaterial",
"value": "{\"m_Value\":{\"instanceID\":0}}"
},
{
"type": "UnityEditor.StaticEditorFlags, UnityEditor.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null",
"key": "mesh.defaultStaticEditorFlags",
"value": "{\"m_Value\":0}"
},
{
"type": "UnityEngine.ProBuilder.PivotLocation, Unity.ProBuilder, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null",
"key": "mesh.newShapePivotLocation",
"value": "{\"m_Value\":1}"
},
{
"type": "UnityEngine.Rendering.ShadowCastingMode, UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null",
"key": "mesh.shadowCastingMode",
"value": "{\"m_Value\":1}"
},
{
"type": "UnityEngine.ProBuilder.ColliderType, Unity.ProBuilder, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null",
"key": "mesh.newShapeColliderType",
"value": "{\"m_Value\":2}"
}
]
}