parent
9277811681
commit
e8b0617dbb
|
@ -3883,36 +3883,17 @@ MonoBehaviour:
|
||||||
m_Script: {fileID: 11500000, guid: 45e653bab7fb20e499bda25e1b646fea, type: 3}
|
m_Script: {fileID: 11500000, guid: 45e653bab7fb20e499bda25e1b646fea, type: 3}
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
--- !u!1 &1859157918 stripped
|
|
||||||
GameObject:
|
|
||||||
m_CorrespondingSourceObject: {fileID: 8616685848737228372, guid: c5efc39a8aaf6e64ea40e9ad573e9b47, type: 3}
|
|
||||||
m_PrefabInstance: {fileID: 8204767108263278737}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
--- !u!114 &1859157935 stripped
|
--- !u!114 &1859157935 stripped
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
m_CorrespondingSourceObject: {fileID: 5420857361349278248, guid: c5efc39a8aaf6e64ea40e9ad573e9b47, type: 3}
|
m_CorrespondingSourceObject: {fileID: 5420857361349278248, guid: c5efc39a8aaf6e64ea40e9ad573e9b47, type: 3}
|
||||||
m_PrefabInstance: {fileID: 8204767108263278737}
|
m_PrefabInstance: {fileID: 8204767108263278737}
|
||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 1859157918}
|
m_GameObject: {fileID: 0}
|
||||||
m_Enabled: 1
|
m_Enabled: 1
|
||||||
m_EditorHideFlags: 0
|
m_EditorHideFlags: 0
|
||||||
m_Script: {fileID: 11500000, guid: e087ecce43ebbff45a1b360637807d93, type: 3}
|
m_Script: {fileID: 11500000, guid: e087ecce43ebbff45a1b360637807d93, type: 3}
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
--- !u!114 &1859157939
|
|
||||||
MonoBehaviour:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 1859157918}
|
|
||||||
m_Enabled: 1
|
|
||||||
m_EditorHideFlags: 0
|
|
||||||
m_Script: {fileID: 11500000, guid: 51cf941944fb27e43863c290683f7068, type: 3}
|
|
||||||
m_Name:
|
|
||||||
m_EditorClassIdentifier:
|
|
||||||
_weapons: []
|
|
||||||
_currentWeapon: 0
|
|
||||||
--- !u!20 &1874573760 stripped
|
--- !u!20 &1874573760 stripped
|
||||||
Camera:
|
Camera:
|
||||||
m_CorrespondingSourceObject: {fileID: 9005220659476430821, guid: 2d3a85ecde41a8246a79669975912b74, type: 3}
|
m_CorrespondingSourceObject: {fileID: 9005220659476430821, guid: 2d3a85ecde41a8246a79669975912b74, type: 3}
|
||||||
|
|
|
@ -30,32 +30,48 @@ public class WeaponSwitcher : MonoBehaviour
|
||||||
{
|
{
|
||||||
foreach (Weapon weapon in _weapons)
|
foreach (Weapon weapon in _weapons)
|
||||||
{
|
{
|
||||||
if (weapon.Index == _currentWeapon)
|
weapon.gameObject.SetActive(false);
|
||||||
|
if (weapon.Index == index)
|
||||||
{
|
{
|
||||||
weapon.gameObject.SetActive(true);
|
weapon.gameObject.SetActive(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DeselectAllWeapons()
|
|
||||||
{
|
|
||||||
foreach (Weapon weapon in _weapons)
|
|
||||||
{
|
|
||||||
weapon.gameObject.SetActive(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void Update()
|
private void Update()
|
||||||
{
|
{
|
||||||
if (Mouse.current.middleButton.wasPressedThisFrame)
|
if (Mouse.current.middleButton.wasPressedThisFrame)
|
||||||
{
|
{
|
||||||
_currentWeapon += 1;
|
_currentWeapon++;
|
||||||
if (_currentWeapon > _weapons.Length - 1)
|
if (_currentWeapon > _weapons.Length - 1)
|
||||||
{
|
{
|
||||||
_currentWeapon = 0;
|
_currentWeapon = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
DeselectAllWeapons();
|
SelectWeapon(_currentWeapon);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Keyboard.current.digit1Key.wasPressedThisFrame)
|
||||||
|
{
|
||||||
|
_currentWeapon = 0;
|
||||||
|
SelectWeapon(_currentWeapon);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Keyboard.current.digit2Key.wasPressedThisFrame)
|
||||||
|
{
|
||||||
|
_currentWeapon = 1;
|
||||||
|
SelectWeapon(_currentWeapon);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Keyboard.current.digit3Key.wasPressedThisFrame)
|
||||||
|
{
|
||||||
|
_currentWeapon = 2;
|
||||||
|
SelectWeapon(_currentWeapon);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Keyboard.current.digit4Key.wasPressedThisFrame)
|
||||||
|
{
|
||||||
|
_currentWeapon = 3;
|
||||||
SelectWeapon(_currentWeapon);
|
SelectWeapon(_currentWeapon);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue