This commit is contained in:
옥소명_playm 2026-01-22 19:14:23 +09:00
parent 2997fd2284
commit 7fa6ff80dd
5 changed files with 5429 additions and 5068 deletions

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 6426ac9a2bd960f45b9c77cd4255aa5d
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@ -7,11 +7,16 @@ public class Player : MonoBehaviour
{
public float speed;
public GameObject[] weapons;
public bool[] hasWeapons;
float hAxis;
float vAxis;
bool wDown;
bool iDown;
bool jDown;
bool sDown1;
bool sDown2;
bool isJump;
@ -35,6 +40,8 @@ public class Player : MonoBehaviour
Move();
Turn();
Jump();
Swap();
Interation();
}
void GetInput()
@ -43,6 +50,9 @@ public class Player : MonoBehaviour
vAxis = Input.GetAxisRaw("Vertical");
wDown = Input.GetButton("Walk");
jDown = Input.GetButtonDown("Jump");
iDown = Input.GetButtonDown("Interation");
sDown1 = Input.GetButtonDown("Swap1");
sDown2 = Input.GetButtonDown("Swap2");
}
void Move()
@ -74,6 +84,32 @@ public class Player : MonoBehaviour
}
}
void Swap()
{
int weaponIndex = -1;
if (sDown1) weaponIndex = 0;
if (sDown2) weaponIndex = 1;
if ((sDown1 || sDown2) && !isJump)
{
weapons[weaponIndex].SetActive(true);
}
}
void Interation()
{
if(iDown && nearObject != null) {
if(nearObject.tag == "Weapon") {
Item item = nearObject.GetComponent<Item>();
int weaponIndex = item.value;
hasWeapons[weaponIndex] = true;
Destroy(nearObject);
}
}
}
void OnCollisionEnter(Collision collision)
{
if(collision.gameObject.tag == "Floor") {

View File

@ -294,13 +294,13 @@ InputManager:
axis: 0
joyNum: 0
- serializedVersion: 3
m_Name: Cancel
m_Name: Interation
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton: escape
positiveButton: e
altNegativeButton:
altPositiveButton: joystick button 1
altPositiveButton:
gravity: 1000
dead: 0.001
sensitivity: 1000
@ -310,13 +310,13 @@ InputManager:
axis: 0
joyNum: 0
- serializedVersion: 3
m_Name: Cancel
m_Name: Swap1
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton: escape
positiveButton: 1
altNegativeButton:
altPositiveButton: joystick button 1
altPositiveButton:
gravity: 1000
dead: 0.001
sensitivity: 1000
@ -326,13 +326,13 @@ InputManager:
axis: 0
joyNum: 0
- serializedVersion: 3
m_Name: Cancel
m_Name: Swap2
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton: escape
positiveButton: 2
altNegativeButton:
altPositiveButton: joystick button 1
altPositiveButton:
gravity: 1000
dead: 0.001
sensitivity: 1000