mirror of
https://github.com/DerTyp7/defrain-shooter-unity.git
synced 2026-07-31 07:29:02 +02:00
Started Keybinds (1,2,3,4)
added: "Weapon1","Weapon2","Weapon3","Weapon4" to InputManager and started implementing Keybinds for weapons
This commit is contained in:
@@ -76,6 +76,141 @@ MonoBehaviour:
|
||||
m_FillOrigin: 0
|
||||
m_UseSpriteMesh: 0
|
||||
m_PixelsPerUnitMultiplier: 1
|
||||
--- !u!1 &4502486257810487330
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 3909710806011504367}
|
||||
- component: {fileID: 2894526427292389244}
|
||||
- component: {fileID: 392004782722667802}
|
||||
m_Layer: 5
|
||||
m_Name: DebugAmmunition
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &3909710806011504367
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4502486257810487330}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 4636852677861728898}
|
||||
m_RootOrder: 6
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 1, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 0}
|
||||
m_AnchoredPosition: {x: -3.243988, y: 38.272995}
|
||||
m_SizeDelta: {x: 71.512, y: 38.273}
|
||||
m_Pivot: {x: 1, y: 1}
|
||||
--- !u!222 &2894526427292389244
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4502486257810487330}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &392004782722667802
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4502486257810487330}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_text: 0 / 0
|
||||
m_isRightToLeft: 0
|
||||
m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
|
||||
m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
|
||||
m_fontSharedMaterials: []
|
||||
m_fontMaterial: {fileID: 0}
|
||||
m_fontMaterials: []
|
||||
m_fontColor32:
|
||||
serializedVersion: 2
|
||||
rgba: 4294967295
|
||||
m_fontColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_enableVertexGradient: 0
|
||||
m_colorMode: 3
|
||||
m_fontColorGradient:
|
||||
topLeft: {r: 1, g: 1, b: 1, a: 1}
|
||||
topRight: {r: 1, g: 1, b: 1, a: 1}
|
||||
bottomLeft: {r: 1, g: 1, b: 1, a: 1}
|
||||
bottomRight: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_fontColorGradientPreset: {fileID: 0}
|
||||
m_spriteAsset: {fileID: 0}
|
||||
m_tintAllSprites: 0
|
||||
m_StyleSheet: {fileID: 0}
|
||||
m_TextStyleHashCode: -1183493901
|
||||
m_overrideHtmlColors: 0
|
||||
m_faceColor:
|
||||
serializedVersion: 2
|
||||
rgba: 4294967295
|
||||
m_fontSize: 26
|
||||
m_fontSizeBase: 26
|
||||
m_fontWeight: 400
|
||||
m_enableAutoSizing: 0
|
||||
m_fontSizeMin: 18
|
||||
m_fontSizeMax: 72
|
||||
m_fontStyle: 1
|
||||
m_HorizontalAlignment: 1
|
||||
m_VerticalAlignment: 256
|
||||
m_textAlignment: 65535
|
||||
m_characterSpacing: 0
|
||||
m_wordSpacing: 0
|
||||
m_lineSpacing: 0
|
||||
m_lineSpacingMax: 0
|
||||
m_paragraphSpacing: 0
|
||||
m_charWidthMaxAdj: 0
|
||||
m_enableWordWrapping: 1
|
||||
m_wordWrappingRatios: 0.4
|
||||
m_overflowMode: 0
|
||||
m_linkedTextComponent: {fileID: 0}
|
||||
parentLinkedComponent: {fileID: 0}
|
||||
m_enableKerning: 1
|
||||
m_enableExtraPadding: 0
|
||||
checkPaddingRequired: 0
|
||||
m_isRichText: 1
|
||||
m_parseCtrlCharacters: 1
|
||||
m_isOrthographic: 1
|
||||
m_isCullingEnabled: 0
|
||||
m_horizontalMapping: 0
|
||||
m_verticalMapping: 0
|
||||
m_uvLineOffset: 0
|
||||
m_geometrySortingOrder: 0
|
||||
m_IsTextObjectScaleStatic: 0
|
||||
m_VertexBufferAutoSizeReduction: 0
|
||||
m_useMaxVisibleDescender: 1
|
||||
m_pageToDisplay: 1
|
||||
m_margin: {x: 0, y: 0, z: 2.1383667, w: 0}
|
||||
m_isUsingLegacyAnimationComponent: 0
|
||||
m_isVolumetricText: 0
|
||||
m_hasFontAssetChanged: 0
|
||||
m_baseMaterial: {fileID: 0}
|
||||
m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
|
||||
--- !u!1 &4636852677861728911
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -114,6 +249,7 @@ RectTransform:
|
||||
- {fileID: 4636852677968575730}
|
||||
- {fileID: 6075137446994482569}
|
||||
- {fileID: 6195396447162429096}
|
||||
- {fileID: 3909710806011504367}
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
@@ -197,6 +333,7 @@ MonoBehaviour:
|
||||
m_EditorClassIdentifier:
|
||||
DebugTextGrounded: {fileID: 4636852678745905425}
|
||||
DebugTextClientServer: {fileID: 0}
|
||||
DebugAmmunition: {fileID: 392004782722667802}
|
||||
Player: {fileID: 0}
|
||||
GameManager: {fileID: 0}
|
||||
fpsText: {fileID: 4636852679900821490}
|
||||
|
||||
@@ -1629,6 +1629,18 @@ PrefabInstance:
|
||||
propertyPath: m_IsActive
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7365407325767981111, guid: f1dd059fe90d9e14da7ad60b3612969c, type: 3}
|
||||
propertyPath: magazinSize
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7365407325767981111, guid: f1dd059fe90d9e14da7ad60b3612969c, type: 3}
|
||||
propertyPath: totalAmmunition
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7365407325767981111, guid: f1dd059fe90d9e14da7ad60b3612969c, type: 3}
|
||||
propertyPath: currentAmmunition
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7716234701984758470, guid: f1dd059fe90d9e14da7ad60b3612969c, type: 3}
|
||||
propertyPath: m_Name
|
||||
value: Gun_Right_Hand_REF
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -9,6 +9,7 @@ public class DebugCanvas : MonoBehaviour
|
||||
{
|
||||
public TextMeshProUGUI DebugTextGrounded;
|
||||
public TextMeshProUGUI DebugTextClientServer;
|
||||
public TextMeshProUGUI DebugAmmunition;
|
||||
public GameObject Player;
|
||||
public GameObject GameManager;
|
||||
public TextMeshProUGUI fpsText;
|
||||
@@ -36,6 +37,8 @@ public class DebugCanvas : MonoBehaviour
|
||||
else
|
||||
{
|
||||
DebugTextGrounded.text = "isGrounded: " + Player.GetComponent<PlayerController>().isGrounded.ToString();
|
||||
Shoot shoot = Player.GetComponent<Shoot>();
|
||||
DebugAmmunition.text = shoot.CurAmmo + " / " + shoot.TotalAmmo;
|
||||
deltaTime += (Time.deltaTime - deltaTime) * 0.1f;
|
||||
float fps = 1.0f / deltaTime;
|
||||
fpsText.text = Mathf.Ceil(fps).ToString() + "FPS";
|
||||
|
||||
@@ -8,6 +8,7 @@ public class Weapon : MonoBehaviour
|
||||
{
|
||||
Rifle, Pistole, Knife, Grenade
|
||||
}
|
||||
[SerializeField] string WeaponName;
|
||||
[SerializeField] weaponKinds weaponKind;
|
||||
[SerializeField] bool active = false;
|
||||
[SerializeField] int damage = 0;
|
||||
@@ -38,9 +39,10 @@ public class Weapon : MonoBehaviour
|
||||
public Transform GunLeftREF { get => gunLeftREF; }
|
||||
public Transform GunRightREF { get => gunRightREF; }
|
||||
|
||||
private void Start()
|
||||
private void Awake()
|
||||
{
|
||||
CurrentAmmunition = MagazinSize;
|
||||
WeaponName = transform.name;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -25,12 +25,19 @@ public class WeaponManager : NetworkBehaviour
|
||||
|
||||
void Update() {
|
||||
if (isLocalPlayer) {
|
||||
if (Input.GetAxis("Mouse ScrollWheel") > 0f) { // Scroll up
|
||||
if (Input.GetButtonDown("Weapon1")) {
|
||||
currentWeaponIndex = 0;
|
||||
}else if (Input.GetButtonDown("Weapon2")) {
|
||||
currentWeaponIndex = 1;
|
||||
}else if (Input.GetButtonDown("Weapon3")) {
|
||||
currentWeaponIndex = 2;
|
||||
}else if (Input.GetButtonDown("Weapon4")) {
|
||||
currentWeaponIndex = 4;
|
||||
}else if (Input.GetAxis("Mouse ScrollWheel") > 0f) { // Scroll up
|
||||
lastWeaponIndex = currentWeaponIndex;
|
||||
activeWeapons[currentWeaponIndex].SetActive(false);
|
||||
switchWeapon(-1);
|
||||
}
|
||||
else if (Input.GetAxis("Mouse ScrollWheel") < 0f) { // Scroll down
|
||||
}else if (Input.GetAxis("Mouse ScrollWheel") < 0f) { // Scroll down
|
||||
lastWeaponIndex = currentWeaponIndex;
|
||||
activeWeapons[currentWeaponIndex].SetActive(false);
|
||||
switchWeapon(1);
|
||||
|
||||
Reference in New Issue
Block a user