Implemented multiple ammo types
This commit is contained in:
parent
8608d27d67
commit
34099af405
|
@ -0,0 +1,79 @@
|
||||||
|
using System;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Linq;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
public enum AmmoType
|
||||||
|
{
|
||||||
|
[Description("1A")]
|
||||||
|
CrossbowBolt,
|
||||||
|
[Description("5.56mm")]
|
||||||
|
Five_FiveSix,
|
||||||
|
[Description("9mm")]
|
||||||
|
Nine,
|
||||||
|
[Description("11.5mm")]
|
||||||
|
Eleven_Five,
|
||||||
|
}
|
||||||
|
|
||||||
|
public class AmmoBelt : MonoBehaviour
|
||||||
|
{
|
||||||
|
[Serializable] private class AmmoSlot
|
||||||
|
{
|
||||||
|
[field: SerializeField] public AmmoType AmmoType { get; set; }
|
||||||
|
[field: SerializeField] public int MaxBeltAmmoAmount { get; set; }
|
||||||
|
[field: SerializeField] public int CurrentBeltAmmoAmount { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
[SerializeField] private AmmoSlot[] _ammoSlots;
|
||||||
|
|
||||||
|
private void Awake()
|
||||||
|
{
|
||||||
|
InitializeAmmoBelt();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void InitializeAmmoBelt()
|
||||||
|
{
|
||||||
|
foreach (AmmoSlot ammoSlot in _ammoSlots)
|
||||||
|
{
|
||||||
|
ammoSlot.CurrentBeltAmmoAmount = ammoSlot.MaxBeltAmmoAmount;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public int GetBeltCurrentAmmoAmount(AmmoType ammoType)
|
||||||
|
{
|
||||||
|
return (from ammoSlot in _ammoSlots
|
||||||
|
where ammoType == ammoSlot.AmmoType
|
||||||
|
select ammoSlot.CurrentBeltAmmoAmount)
|
||||||
|
.FirstOrDefault();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int GetBeltMaxAmmoAmount(AmmoType ammoType)
|
||||||
|
{
|
||||||
|
return (from ammoSlot in _ammoSlots
|
||||||
|
where ammoType == ammoSlot.AmmoType
|
||||||
|
select ammoSlot.MaxBeltAmmoAmount)
|
||||||
|
.FirstOrDefault();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetBeltCurrentAmmoAmount(AmmoType ammoType, int value)
|
||||||
|
{
|
||||||
|
foreach (AmmoSlot ammoSlot in _ammoSlots)
|
||||||
|
{
|
||||||
|
if (ammoType == ammoSlot.AmmoType)
|
||||||
|
{
|
||||||
|
ammoSlot.CurrentBeltAmmoAmount = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ModifyBeltCurrentAmmoAmount(AmmoType ammoType, int value)
|
||||||
|
{
|
||||||
|
foreach (AmmoSlot ammoSlot in _ammoSlots)
|
||||||
|
{
|
||||||
|
if (ammoType == ammoSlot.AmmoType)
|
||||||
|
{
|
||||||
|
ammoSlot.CurrentBeltAmmoAmount += value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: dbcfad096f7809942bd5a514e82d5678
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
|
@ -10,6 +10,7 @@ GameObject:
|
||||||
m_Component:
|
m_Component:
|
||||||
- component: {fileID: 2265701993784981172}
|
- component: {fileID: 2265701993784981172}
|
||||||
- component: {fileID: 7253208606534141378}
|
- component: {fileID: 7253208606534141378}
|
||||||
|
- component: {fileID: 8838302087844949975}
|
||||||
m_Layer: 8
|
m_Layer: 8
|
||||||
m_Name: Weapons
|
m_Name: Weapons
|
||||||
m_TagString: Untagged
|
m_TagString: Untagged
|
||||||
|
@ -50,6 +51,31 @@ MonoBehaviour:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
_weapons: []
|
_weapons: []
|
||||||
_currentWeapon: 0
|
_currentWeapon: 0
|
||||||
|
--- !u!114 &8838302087844949975
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 160269183453626702}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: dbcfad096f7809942bd5a514e82d5678, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
_ammoSlots:
|
||||||
|
- <AmmoType>k__BackingField: 0
|
||||||
|
<MaxBeltAmmoAmount>k__BackingField: 10
|
||||||
|
<CurrentBeltAmmoAmount>k__BackingField: 0
|
||||||
|
- <AmmoType>k__BackingField: 2
|
||||||
|
<MaxBeltAmmoAmount>k__BackingField: 30
|
||||||
|
<CurrentBeltAmmoAmount>k__BackingField: 0
|
||||||
|
- <AmmoType>k__BackingField: 1
|
||||||
|
<MaxBeltAmmoAmount>k__BackingField: 200
|
||||||
|
<CurrentBeltAmmoAmount>k__BackingField: 0
|
||||||
|
- <AmmoType>k__BackingField: 3
|
||||||
|
<MaxBeltAmmoAmount>k__BackingField: 15
|
||||||
|
<CurrentBeltAmmoAmount>k__BackingField: 0
|
||||||
--- !u!1 &4135013735270702863
|
--- !u!1 &4135013735270702863
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|
|
@ -2119,25 +2119,6 @@ CanvasRenderer:
|
||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 925195241}
|
m_GameObject: {fileID: 925195241}
|
||||||
m_CullTransparentMesh: 1
|
m_CullTransparentMesh: 1
|
||||||
--- !u!1 &942203718 stripped
|
|
||||||
GameObject:
|
|
||||||
m_CorrespondingSourceObject: {fileID: 160269183453626702, guid: c5efc39a8aaf6e64ea40e9ad573e9b47, type: 3}
|
|
||||||
m_PrefabInstance: {fileID: 8204767108263278737}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
--- !u!114 &942203720
|
|
||||||
MonoBehaviour:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 942203718}
|
|
||||||
m_Enabled: 1
|
|
||||||
m_EditorHideFlags: 0
|
|
||||||
m_Script: {fileID: 11500000, guid: 51cf941944fb27e43863c290683f7068, type: 3}
|
|
||||||
m_Name:
|
|
||||||
m_EditorClassIdentifier:
|
|
||||||
_weapons: []
|
|
||||||
_currentWeapon: 0
|
|
||||||
--- !u!1001 &945433442
|
--- !u!1001 &945433442
|
||||||
PrefabInstance:
|
PrefabInstance:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
@ -4336,7 +4317,7 @@ PrefabInstance:
|
||||||
m_Modifications:
|
m_Modifications:
|
||||||
- target: {fileID: 160269183453626702, guid: c5efc39a8aaf6e64ea40e9ad573e9b47, type: 3}
|
- target: {fileID: 160269183453626702, guid: c5efc39a8aaf6e64ea40e9ad573e9b47, type: 3}
|
||||||
propertyPath: m_Name
|
propertyPath: m_Name
|
||||||
value: Weapon
|
value: Weapons
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 335461055095249328, guid: c5efc39a8aaf6e64ea40e9ad573e9b47, type: 3}
|
- target: {fileID: 335461055095249328, guid: c5efc39a8aaf6e64ea40e9ad573e9b47, type: 3}
|
||||||
propertyPath: _fpCamera
|
propertyPath: _fpCamera
|
||||||
|
@ -4354,14 +4335,30 @@ PrefabInstance:
|
||||||
propertyPath: reloadAction.m_Id
|
propertyPath: reloadAction.m_Id
|
||||||
value: e5dd7aae-807b-46fc-8c1a-a6e621305625
|
value: e5dd7aae-807b-46fc-8c1a-a6e621305625
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 335461055095249328, guid: c5efc39a8aaf6e64ea40e9ad573e9b47, type: 3}
|
|
||||||
propertyPath: _timeBetweenReloads
|
|
||||||
value: 1.5
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: 335461055095249328, guid: c5efc39a8aaf6e64ea40e9ad573e9b47, type: 3}
|
- target: {fileID: 335461055095249328, guid: c5efc39a8aaf6e64ea40e9ad573e9b47, type: 3}
|
||||||
propertyPath: reloadAction.m_Name
|
propertyPath: reloadAction.m_Name
|
||||||
value: Reload
|
value: Reload
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 411911725668603200, guid: c5efc39a8aaf6e64ea40e9ad573e9b47, type: 3}
|
||||||
|
propertyPath: _ammoSlot.Array.size
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 411911725668603200, guid: c5efc39a8aaf6e64ea40e9ad573e9b47, type: 3}
|
||||||
|
propertyPath: _ammoSlot.Array.data[0].AmmoType
|
||||||
|
value: 3
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 411911725668603200, guid: c5efc39a8aaf6e64ea40e9ad573e9b47, type: 3}
|
||||||
|
propertyPath: _ammoSlot.Array.data[1].AmmoType
|
||||||
|
value: 3
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 411911725668603200, guid: c5efc39a8aaf6e64ea40e9ad573e9b47, type: 3}
|
||||||
|
propertyPath: _ammoSlot.Array.data[2].AmmoType
|
||||||
|
value: 3
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 411911725668603200, guid: c5efc39a8aaf6e64ea40e9ad573e9b47, type: 3}
|
||||||
|
propertyPath: _ammoSlot.Array.data[3].AmmoType
|
||||||
|
value: 3
|
||||||
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 1218087889432038952, guid: c5efc39a8aaf6e64ea40e9ad573e9b47, type: 3}
|
- target: {fileID: 1218087889432038952, guid: c5efc39a8aaf6e64ea40e9ad573e9b47, type: 3}
|
||||||
propertyPath: m_IsActive
|
propertyPath: m_IsActive
|
||||||
value: 1
|
value: 1
|
||||||
|
@ -4382,10 +4379,6 @@ PrefabInstance:
|
||||||
propertyPath: reloadAction.m_Id
|
propertyPath: reloadAction.m_Id
|
||||||
value: b6e2ceaf-6126-4eb9-8b2e-91b3dc0253b4
|
value: b6e2ceaf-6126-4eb9-8b2e-91b3dc0253b4
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 2132953286740742962, guid: c5efc39a8aaf6e64ea40e9ad573e9b47, type: 3}
|
|
||||||
propertyPath: _timeBetweenReloads
|
|
||||||
value: 1.5
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: 2132953286740742962, guid: c5efc39a8aaf6e64ea40e9ad573e9b47, type: 3}
|
- target: {fileID: 2132953286740742962, guid: c5efc39a8aaf6e64ea40e9ad573e9b47, type: 3}
|
||||||
propertyPath: reloadAction.m_Name
|
propertyPath: reloadAction.m_Name
|
||||||
value: Reload
|
value: Reload
|
||||||
|
@ -4398,6 +4391,14 @@ PrefabInstance:
|
||||||
propertyPath: m_IsActive
|
propertyPath: m_IsActive
|
||||||
value: 1
|
value: 1
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 4348065138891612859, guid: c5efc39a8aaf6e64ea40e9ad573e9b47, type: 3}
|
||||||
|
propertyPath: _input
|
||||||
|
value:
|
||||||
|
objectReference: {fileID: 1859157935}
|
||||||
|
- target: {fileID: 4348065138891612859, guid: c5efc39a8aaf6e64ea40e9ad573e9b47, type: 3}
|
||||||
|
propertyPath: _camera
|
||||||
|
value:
|
||||||
|
objectReference: {fileID: 1850161070}
|
||||||
- target: {fileID: 4641286401744272850, guid: c5efc39a8aaf6e64ea40e9ad573e9b47, type: 3}
|
- target: {fileID: 4641286401744272850, guid: c5efc39a8aaf6e64ea40e9ad573e9b47, type: 3}
|
||||||
propertyPath: _fpCamera
|
propertyPath: _fpCamera
|
||||||
value:
|
value:
|
||||||
|
@ -4406,10 +4407,6 @@ PrefabInstance:
|
||||||
propertyPath: _BulletImpact
|
propertyPath: _BulletImpact
|
||||||
value:
|
value:
|
||||||
objectReference: {fileID: 252487699782519274, guid: 82851982cb47c134a8403ffcb052b9d2, type: 3}
|
objectReference: {fileID: 252487699782519274, guid: 82851982cb47c134a8403ffcb052b9d2, type: 3}
|
||||||
- target: {fileID: 4641286401744272850, guid: c5efc39a8aaf6e64ea40e9ad573e9b47, type: 3}
|
|
||||||
propertyPath: _timeBetweenReloads
|
|
||||||
value: 1.5
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: 5428686084875064986, guid: c5efc39a8aaf6e64ea40e9ad573e9b47, type: 3}
|
- target: {fileID: 5428686084875064986, guid: c5efc39a8aaf6e64ea40e9ad573e9b47, type: 3}
|
||||||
propertyPath: m_Name
|
propertyPath: m_Name
|
||||||
value: MuzzleFlash
|
value: MuzzleFlash
|
||||||
|
@ -4434,10 +4431,6 @@ PrefabInstance:
|
||||||
propertyPath: reloadAction.m_Id
|
propertyPath: reloadAction.m_Id
|
||||||
value: 9a13135e-9c14-4a7a-a277-378fc4a31eae
|
value: 9a13135e-9c14-4a7a-a277-378fc4a31eae
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 7060812621224890882, guid: c5efc39a8aaf6e64ea40e9ad573e9b47, type: 3}
|
|
||||||
propertyPath: _timeBetweenReloads
|
|
||||||
value: 1.5
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: 7060812621224890882, guid: c5efc39a8aaf6e64ea40e9ad573e9b47, type: 3}
|
- target: {fileID: 7060812621224890882, guid: c5efc39a8aaf6e64ea40e9ad573e9b47, type: 3}
|
||||||
propertyPath: reloadAction.m_Name
|
propertyPath: reloadAction.m_Name
|
||||||
value: Reload
|
value: Reload
|
||||||
|
@ -4534,6 +4527,5 @@ PrefabInstance:
|
||||||
propertyPath: m_LocalEulerAnglesHint.z
|
propertyPath: m_LocalEulerAnglesHint.z
|
||||||
value: 0
|
value: 0
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
m_RemovedComponents:
|
m_RemovedComponents: []
|
||||||
- {fileID: 9083568455291165773, guid: c5efc39a8aaf6e64ea40e9ad573e9b47, type: 3}
|
|
||||||
m_SourcePrefab: {fileID: 100100000, guid: c5efc39a8aaf6e64ea40e9ad573e9b47, type: 3}
|
m_SourcePrefab: {fileID: 100100000, guid: c5efc39a8aaf6e64ea40e9ad573e9b47, type: 3}
|
||||||
|
|
|
@ -1,26 +1,23 @@
|
||||||
using System;
|
|
||||||
using System.Collections;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
public class Ammo : MonoBehaviour
|
public class Ammo : MonoBehaviour
|
||||||
{
|
{
|
||||||
[Header("Config")]
|
[Header("Config")]
|
||||||
[SerializeField] private int _ammoType;
|
[SerializeField] private AmmoType _ammoType;
|
||||||
[SerializeField] private int _maxBeltAmmoAmount;
|
|
||||||
[SerializeField] private int _maxMagAmmoAmount;
|
[SerializeField] private int _maxMagAmmoAmount;
|
||||||
|
|
||||||
[Header("State")]
|
[Header("State")]
|
||||||
[SerializeField] private int _currentBeltAmmoAmount;
|
|
||||||
[SerializeField] private int _currentMagAmmoAmount;
|
[SerializeField] private int _currentMagAmmoAmount;
|
||||||
|
|
||||||
[Header("Connections")]
|
[Header("Connections")]
|
||||||
|
[SerializeField] private AmmoBelt _ammoBelt;
|
||||||
[SerializeField] private FloatVariable _S_currentBeltAmmoAmount;
|
[SerializeField] private FloatVariable _S_currentBeltAmmoAmount;
|
||||||
[SerializeField] private FloatVariable _S_currentMagAmmoAmount;
|
[SerializeField] private FloatVariable _S_currentMagAmmoAmount;
|
||||||
|
|
||||||
private void Awake()
|
private void Awake()
|
||||||
{
|
{
|
||||||
_currentBeltAmmoAmount = _maxBeltAmmoAmount;
|
_ammoBelt = GetComponentInParent<AmmoBelt>();
|
||||||
|
|
||||||
_currentMagAmmoAmount = _maxMagAmmoAmount;
|
_currentMagAmmoAmount = _maxMagAmmoAmount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,7 +28,7 @@ public class Ammo : MonoBehaviour
|
||||||
|
|
||||||
#region Public Properties
|
#region Public Properties
|
||||||
|
|
||||||
public int AmmoType
|
public AmmoType AmmoType
|
||||||
{
|
{
|
||||||
get => _ammoType;
|
get => _ammoType;
|
||||||
set => _ammoType = value;
|
set => _ammoType = value;
|
||||||
|
@ -57,15 +54,15 @@ public class Ammo : MonoBehaviour
|
||||||
{
|
{
|
||||||
int diff = _maxMagAmmoAmount - _currentMagAmmoAmount;
|
int diff = _maxMagAmmoAmount - _currentMagAmmoAmount;
|
||||||
print(diff);
|
print(diff);
|
||||||
if (diff < _currentBeltAmmoAmount)
|
if (diff < _ammoBelt.GetBeltCurrentAmmoAmount(_ammoType))
|
||||||
{
|
{
|
||||||
_currentBeltAmmoAmount -= diff;
|
_ammoBelt.ModifyBeltCurrentAmmoAmount(_ammoType, -diff);
|
||||||
_currentMagAmmoAmount += diff;
|
_currentMagAmmoAmount += diff;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_currentMagAmmoAmount += _currentBeltAmmoAmount;
|
_currentMagAmmoAmount += _ammoBelt.GetBeltCurrentAmmoAmount(_ammoType);
|
||||||
_currentBeltAmmoAmount = 0;
|
_ammoBelt.SetBeltCurrentAmmoAmount(_ammoType, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
AmmoUpdate();
|
AmmoUpdate();
|
||||||
|
@ -98,14 +95,14 @@ public class Ammo : MonoBehaviour
|
||||||
|
|
||||||
public float GetBeltAmmoFactor()
|
public float GetBeltAmmoFactor()
|
||||||
{
|
{
|
||||||
return _currentBeltAmmoAmount / (float)_maxBeltAmmoAmount;
|
return _ammoBelt.GetBeltCurrentAmmoAmount(_ammoType) / (float)_ammoBelt.GetBeltMaxAmmoAmount(_ammoType);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
private void AmmoUpdate()
|
private void AmmoUpdate()
|
||||||
{
|
{
|
||||||
_S_currentBeltAmmoAmount.Value = _currentBeltAmmoAmount;
|
_S_currentBeltAmmoAmount.Value = _ammoBelt.GetBeltCurrentAmmoAmount(_ammoType);
|
||||||
_S_currentMagAmmoAmount.Value = _currentMagAmmoAmount;
|
_S_currentMagAmmoAmount.Value = _currentMagAmmoAmount;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -79,13 +79,17 @@ MonoBehaviour:
|
||||||
m_Script: {fileID: 11500000, guid: 01ef216392c8f33409f2efcd91f4e510, type: 3}
|
m_Script: {fileID: 11500000, guid: 01ef216392c8f33409f2efcd91f4e510, type: 3}
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
|
_ammoType: 0
|
||||||
|
_index: 0
|
||||||
_range: 100
|
_range: 100
|
||||||
_weaponDamage: 100
|
_weaponDamage: 100
|
||||||
_timeBetweenShots: 2
|
_timeBetweenShots: 2
|
||||||
|
_timeBetweenReloads: 1.5
|
||||||
_fpCamera: {fileID: 0}
|
_fpCamera: {fileID: 0}
|
||||||
_muzzleFlash: {fileID: 0}
|
_muzzleFlash: {fileID: 0}
|
||||||
_bulletImpact: {fileID: 252487699782519274, guid: 82851982cb47c134a8403ffcb052b9d2, type: 3}
|
_bulletImpact: {fileID: 252487699782519274, guid: 82851982cb47c134a8403ffcb052b9d2, type: 3}
|
||||||
_ammo: {fileID: 1537282594975695390}
|
_ammo: {fileID: 1537282594975695390}
|
||||||
|
_canShoot: 0
|
||||||
--- !u!114 &1537282594975695390
|
--- !u!114 &1537282594975695390
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
@ -98,11 +102,10 @@ MonoBehaviour:
|
||||||
m_Script: {fileID: 11500000, guid: 97c35481a551c3a4d9d5f0e3fe13a03d, type: 3}
|
m_Script: {fileID: 11500000, guid: 97c35481a551c3a4d9d5f0e3fe13a03d, type: 3}
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
_ammoType: 1
|
_ammoType: 0
|
||||||
_maxBeltAmmoAmount: 10
|
|
||||||
_maxMagAmmoAmount: 1
|
_maxMagAmmoAmount: 1
|
||||||
_currentBeltAmmoAmount: 0
|
|
||||||
_currentMagAmmoAmount: 0
|
_currentMagAmmoAmount: 0
|
||||||
|
_ammoBelt: {fileID: 0}
|
||||||
_S_currentBeltAmmoAmount: {fileID: 11400000, guid: f19d1fc1d5102a545800f4f8273640b1, type: 2}
|
_S_currentBeltAmmoAmount: {fileID: 11400000, guid: f19d1fc1d5102a545800f4f8273640b1, type: 2}
|
||||||
_S_currentMagAmmoAmount: {fileID: 11400000, guid: 9a77ec14c64717643bed1c6e7a3885ae, type: 2}
|
_S_currentMagAmmoAmount: {fileID: 11400000, guid: 9a77ec14c64717643bed1c6e7a3885ae, type: 2}
|
||||||
--- !u!114 &7047714336720636310
|
--- !u!114 &7047714336720636310
|
||||||
|
|
|
@ -129,13 +129,17 @@ MonoBehaviour:
|
||||||
m_Script: {fileID: 11500000, guid: 01ef216392c8f33409f2efcd91f4e510, type: 3}
|
m_Script: {fileID: 11500000, guid: 01ef216392c8f33409f2efcd91f4e510, type: 3}
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
|
_ammoType: 2
|
||||||
|
_index: 0
|
||||||
_range: 100
|
_range: 100
|
||||||
_weaponDamage: 50
|
_weaponDamage: 25
|
||||||
_timeBetweenShots: 1
|
_timeBetweenShots: 0.5
|
||||||
|
_timeBetweenReloads: 1.5
|
||||||
_fpCamera: {fileID: 0}
|
_fpCamera: {fileID: 0}
|
||||||
_muzzleFlash: {fileID: 0}
|
_muzzleFlash: {fileID: 0}
|
||||||
_bulletImpact: {fileID: 252487699782519274, guid: 82851982cb47c134a8403ffcb052b9d2, type: 3}
|
_bulletImpact: {fileID: 252487699782519274, guid: 82851982cb47c134a8403ffcb052b9d2, type: 3}
|
||||||
_ammo: {fileID: 4085014607242062707}
|
_ammo: {fileID: 4085014607242062707}
|
||||||
|
_canShoot: 0
|
||||||
--- !u!114 &4085014607242062707
|
--- !u!114 &4085014607242062707
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
@ -148,10 +152,9 @@ MonoBehaviour:
|
||||||
m_Script: {fileID: 11500000, guid: 97c35481a551c3a4d9d5f0e3fe13a03d, type: 3}
|
m_Script: {fileID: 11500000, guid: 97c35481a551c3a4d9d5f0e3fe13a03d, type: 3}
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
_ammoType: 3
|
_ammoType: 2
|
||||||
_maxBeltAmmoAmount: 20
|
|
||||||
_maxMagAmmoAmount: 4
|
_maxMagAmmoAmount: 4
|
||||||
_currentBeltAmmoAmount: 0
|
|
||||||
_currentMagAmmoAmount: 0
|
_currentMagAmmoAmount: 0
|
||||||
|
_ammoBelt: {fileID: 0}
|
||||||
_S_currentBeltAmmoAmount: {fileID: 11400000, guid: f19d1fc1d5102a545800f4f8273640b1, type: 2}
|
_S_currentBeltAmmoAmount: {fileID: 11400000, guid: f19d1fc1d5102a545800f4f8273640b1, type: 2}
|
||||||
_S_currentMagAmmoAmount: {fileID: 11400000, guid: 9a77ec14c64717643bed1c6e7a3885ae, type: 2}
|
_S_currentMagAmmoAmount: {fileID: 11400000, guid: 9a77ec14c64717643bed1c6e7a3885ae, type: 2}
|
||||||
|
|
|
@ -48,11 +48,12 @@ MonoBehaviour:
|
||||||
m_Script: {fileID: 11500000, guid: 01ef216392c8f33409f2efcd91f4e510, type: 3}
|
m_Script: {fileID: 11500000, guid: 01ef216392c8f33409f2efcd91f4e510, type: 3}
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
|
_ammoType: 1
|
||||||
_index: 0
|
_index: 0
|
||||||
_range: 100
|
_range: 100
|
||||||
_weaponDamage: 4
|
_weaponDamage: 4
|
||||||
_timeBetweenShots: 0.1
|
_timeBetweenShots: 0.1
|
||||||
_timeBetweenReloads: 0
|
_timeBetweenReloads: 1.5
|
||||||
_fpCamera: {fileID: 0}
|
_fpCamera: {fileID: 0}
|
||||||
_muzzleFlash: {fileID: 0}
|
_muzzleFlash: {fileID: 0}
|
||||||
_bulletImpact: {fileID: 252487699782519274, guid: 82851982cb47c134a8403ffcb052b9d2, type: 3}
|
_bulletImpact: {fileID: 252487699782519274, guid: 82851982cb47c134a8403ffcb052b9d2, type: 3}
|
||||||
|
@ -70,11 +71,10 @@ MonoBehaviour:
|
||||||
m_Script: {fileID: 11500000, guid: 97c35481a551c3a4d9d5f0e3fe13a03d, type: 3}
|
m_Script: {fileID: 11500000, guid: 97c35481a551c3a4d9d5f0e3fe13a03d, type: 3}
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
_ammoType: 2
|
_ammoType: 1
|
||||||
_maxBeltAmmoAmount: 300
|
|
||||||
_maxMagAmmoAmount: 45
|
_maxMagAmmoAmount: 45
|
||||||
_currentBeltAmmoAmount: 0
|
|
||||||
_currentMagAmmoAmount: 0
|
_currentMagAmmoAmount: 0
|
||||||
|
_ammoBelt: {fileID: 0}
|
||||||
_S_currentBeltAmmoAmount: {fileID: 11400000, guid: f19d1fc1d5102a545800f4f8273640b1, type: 2}
|
_S_currentBeltAmmoAmount: {fileID: 11400000, guid: f19d1fc1d5102a545800f4f8273640b1, type: 2}
|
||||||
_S_currentMagAmmoAmount: {fileID: 11400000, guid: 9a77ec14c64717643bed1c6e7a3885ae, type: 2}
|
_S_currentMagAmmoAmount: {fileID: 11400000, guid: 9a77ec14c64717643bed1c6e7a3885ae, type: 2}
|
||||||
--- !u!114 &1366121443174139284
|
--- !u!114 &1366121443174139284
|
||||||
|
|
|
@ -50,13 +50,17 @@ MonoBehaviour:
|
||||||
m_Script: {fileID: 11500000, guid: 01ef216392c8f33409f2efcd91f4e510, type: 3}
|
m_Script: {fileID: 11500000, guid: 01ef216392c8f33409f2efcd91f4e510, type: 3}
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
|
_ammoType: 3
|
||||||
|
_index: 0
|
||||||
_range: 100
|
_range: 100
|
||||||
_weaponDamage: 25
|
_weaponDamage: 50
|
||||||
_timeBetweenShots: 0.5
|
_timeBetweenShots: 1
|
||||||
|
_timeBetweenReloads: 1.5
|
||||||
_fpCamera: {fileID: 0}
|
_fpCamera: {fileID: 0}
|
||||||
_muzzleFlash: {fileID: 6070271853189258210}
|
_muzzleFlash: {fileID: 6070271853189258210}
|
||||||
_bulletImpact: {fileID: 252487699782519274, guid: 82851982cb47c134a8403ffcb052b9d2, type: 3}
|
_bulletImpact: {fileID: 252487699782519274, guid: 82851982cb47c134a8403ffcb052b9d2, type: 3}
|
||||||
_ammo: {fileID: 8817107657672854186}
|
_ammo: {fileID: 8817107657672854186}
|
||||||
|
_canShoot: 0
|
||||||
--- !u!114 &8817107657672854186
|
--- !u!114 &8817107657672854186
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
@ -69,11 +73,10 @@ MonoBehaviour:
|
||||||
m_Script: {fileID: 11500000, guid: 97c35481a551c3a4d9d5f0e3fe13a03d, type: 3}
|
m_Script: {fileID: 11500000, guid: 97c35481a551c3a4d9d5f0e3fe13a03d, type: 3}
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
_ammoType: 0
|
_ammoType: 3
|
||||||
_maxBeltAmmoAmount: 45
|
|
||||||
_maxMagAmmoAmount: 7
|
_maxMagAmmoAmount: 7
|
||||||
_currentBeltAmmoAmount: 0
|
|
||||||
_currentMagAmmoAmount: 3
|
_currentMagAmmoAmount: 3
|
||||||
|
_ammoBelt: {fileID: 0}
|
||||||
_S_currentBeltAmmoAmount: {fileID: 11400000, guid: f19d1fc1d5102a545800f4f8273640b1, type: 2}
|
_S_currentBeltAmmoAmount: {fileID: 11400000, guid: f19d1fc1d5102a545800f4f8273640b1, type: 2}
|
||||||
_S_currentMagAmmoAmount: {fileID: 11400000, guid: 9a77ec14c64717643bed1c6e7a3885ae, type: 2}
|
_S_currentMagAmmoAmount: {fileID: 11400000, guid: 9a77ec14c64717643bed1c6e7a3885ae, type: 2}
|
||||||
--- !u!114 &3637412066234339666
|
--- !u!114 &3637412066234339666
|
||||||
|
|
|
@ -5,7 +5,7 @@ using UnityEngine;
|
||||||
public class Weapon : MonoBehaviour
|
public class Weapon : MonoBehaviour
|
||||||
{
|
{
|
||||||
[Header("Config")]
|
[Header("Config")]
|
||||||
[SerializeField] private int _index;
|
[SerializeField] private AmmoType _ammoType;
|
||||||
[SerializeField] private float _range = 100f;
|
[SerializeField] private float _range = 100f;
|
||||||
[SerializeField] private float _weaponDamage = 25f;
|
[SerializeField] private float _weaponDamage = 25f;
|
||||||
[SerializeField] private float _timeBetweenShots;
|
[SerializeField] private float _timeBetweenShots;
|
||||||
|
@ -18,6 +18,7 @@ public class Weapon : MonoBehaviour
|
||||||
[SerializeField] private Ammo _ammo;
|
[SerializeField] private Ammo _ammo;
|
||||||
|
|
||||||
[Header("State")]
|
[Header("State")]
|
||||||
|
[SerializeField] private int _index;
|
||||||
[SerializeField] private bool _canShoot;
|
[SerializeField] private bool _canShoot;
|
||||||
|
|
||||||
private void Awake()
|
private void Awake()
|
||||||
|
|
Loading…
Reference in New Issue