Commit 4bd9e3fb authored by StonegazeFIN's avatar StonegazeFIN
Browse files

Fixed pickup items and few new sounds.

parent 080a1553
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class InputControls : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}
fileFormatVersion: 2
guid: 6af3b1ff1fd02fe4ebc1b95b8aaba43b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
This diff is collapsed.
......@@ -4,34 +4,20 @@ using UnityEngine;
public class PickupItem : MonoBehaviour
{
public GameObject shotgun;
public GameObject rifle;
public GameObject trap;
public GameObject obstacle;
int Ammo = 0;
int Health = 0;
int Traps = 0;
int Obstacles = 0;
public int Ammo = 0;
public int Health = 0;
private void Start()
{
if (gameObject.tag == "Ammo")
if (gameObject.tag.Contains("Ammo"))
{
Ammo = 10;
}
if (gameObject.tag == "Health")
{
Health = 10;
Health = 15;
}
if (gameObject.tag == "Traps")
{
Traps = 1;
}
if (gameObject.tag == "Obstacles")
{
Obstacles = 1;
}
}
private void OnTriggerEnter(Collider collider)
......@@ -63,49 +49,53 @@ public class PickupItem : MonoBehaviour
void PickupShotgunAmmo()
{
Weapon weapon = shotgun.GetComponent<Weapon>();
if (weapon.ammo < 20)
Weapon weapon = GameObject.Find("Shotgun").GetComponent<Weapon>();
if (weapon.ammo < weapon.ammoCap)
{
weapon.ammo = 20;
weapon.ammo += Ammo;
if(weapon.ammo > weapon.ammoCap)
{
weapon.ammo = weapon.ammoCap;
}
GameObject.Find("PlayerUI").GetComponent<PlayerUI>().GetAmmoValues(weapon.loadedAmmo, weapon.ammo);
Debug.Log("Picked up shotgun ammo.");
Destroy(gameObject);
} else
{
return;
}
}
void PickupRifleAmmo()
{
Rifle r = rifle.GetComponent<Rifle>();
Rifle rifle = GameObject.Find("Rifle").GetComponent<Rifle>();
if (r.ammo < 20)
if (rifle.ammo < rifle.AmmoCap)
{
r.ammo = 20;
rifle.ammo += Ammo;
if (rifle.ammo > rifle.AmmoCap)
{
rifle.ammo = rifle.AmmoCap;
}
GameObject.Find("PlayerUI").GetComponent<PlayerUI>().GetAmmoValues(rifle.loadedAmmo, rifle.ammo);
Debug.Log("Picked up rifle ammo.");
Destroy(gameObject);
} else
{
return;
}
}
void PickupHealth()
{
GameObject player = GameObject.Find("Player");
PlayerHealth character = player.GetComponent<PlayerHealth>();
int HP = character.GetHealth();
int maxHP = character.GetMaxHealth();
int MissingHP = maxHP - HP;
PlayerHealth character = GameObject.Find("Player").GetComponent<PlayerHealth>();
if(MissingHP > 0)
if(character.GetHealth() < character.GetMaxHealth())
{
if(Health >= MissingHP)
{
character.UpdateHealth(MissingHP);
Health -= MissingHP;
if(Health <= 0)
{
Destroy(gameObject);
}
} else
{
character.UpdateHealth(Health);
Destroy(gameObject);
}
character.UpdateHealth(Health);
Destroy(gameObject);
}
else
{
......@@ -115,19 +105,22 @@ public class PickupItem : MonoBehaviour
void PickupTraps()
{
BearTrapWeapon bearTrap = trap.GetComponent<BearTrapWeapon>();
BearTrapWeapon bearTrap = GameObject.Find("BearTrapWeapon").GetComponent<BearTrapWeapon>();
if(bearTrap.amount < 5)
{
Debug.Log("Beartrap picked up");
bearTrap.amount++;
Destroy(gameObject);
} else
{
return;
}
}
void PickupObstacles()
{
ObstacleWeapon obstacleWeapon = obstacle.GetComponent<ObstacleWeapon>();
ObstacleWeapon obstacleWeapon = GameObject.Find("ObstacleWeapon").GetComponent<ObstacleWeapon>();
if(obstacleWeapon.amount < 5)
{
......
......@@ -70,13 +70,13 @@ public class PlayerHealth : MonoBehaviour
{
if(lifeUpdate > -5)
{
SoundManager.PlayVoice(SoundManager.Voice.PlayerHurt_Small, GetAudioSource());
// SoundManager.PlayVoice(SoundManager.Voice.PlayerHurt_Small, GetAudioSource());
} else if(lifeUpdate <= -6 && lifeUpdate > -15)
{
SoundManager.PlayVoice(SoundManager.Voice.PlayerHurt_Medium, GetAudioSource());
// SoundManager.PlayVoice(SoundManager.Voice.PlayerHurt_Medium, GetAudioSource());
} else
{
SoundManager.PlayVoice(SoundManager.Voice.PlayerHurt_Large, GetAudioSource());
// SoundManager.PlayVoice(SoundManager.Voice.PlayerHurt_Large, GetAudioSource());
}
if(health <= 0)
{
......
......@@ -12,7 +12,7 @@ public class Rifle : MonoBehaviour
float fireRate = 2f;
float impactForce = 50f;
private int AmmoCap = 45;
public int AmmoCap = 25;
public int ammo;
public int loadedAmmo;
private int Magazine = 5;
......
......@@ -11,7 +11,8 @@ public class Weapon : MonoBehaviour
public float impactForce = 50f;
public int pellets = 24;
public int ammo = 20;
public int ammoCap = 20;
public int ammo;
public int loadedAmmo;
private int LoadedMax = 2;
public float reloadTime = 2f;
......@@ -35,6 +36,7 @@ public class Weapon : MonoBehaviour
private void Start()
{
ammo = ammoCap;
playerUI = GameObject.Find("PlayerUI");
UI = playerUI.GetComponent<PlayerUI>();
loadedAmmo = LoadedMax;
......
fileFormatVersion: 2
guid: b03ee846fb3de8947bbe4dd2070b363a
AudioImporter:
externalObjects: {}
serializedVersion: 6
defaultSettings:
loadType: 0
sampleRateSetting: 0
sampleRateOverride: 44100
compressionFormat: 1
quality: 1
conversionMode: 0
platformSettingOverrides: {}
forceToMono: 0
normalize: 1
preloadAudioData: 1
loadInBackground: 0
ambisonic: 0
3D: 1
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 9005bb7464e087a4cb100a0cce13ca40
AudioImporter:
externalObjects: {}
serializedVersion: 6
defaultSettings:
loadType: 0
sampleRateSetting: 0
sampleRateOverride: 44100
compressionFormat: 1
quality: 1
conversionMode: 0
platformSettingOverrides: {}
forceToMono: 0
normalize: 1
preloadAudioData: 1
loadInBackground: 0
ambisonic: 0
3D: 1
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: b56efa7a2f0409e41a2d6ca79b96ab0b
AudioImporter:
externalObjects: {}
serializedVersion: 6
defaultSettings:
loadType: 0
sampleRateSetting: 0
sampleRateOverride: 44100
compressionFormat: 1
quality: 1
conversionMode: 0
platformSettingOverrides: {}
forceToMono: 0
normalize: 1
preloadAudioData: 1
loadInBackground: 0
ambisonic: 0
3D: 1
userData:
assetBundleName:
assetBundleVariant:
......@@ -12,6 +12,7 @@ GameObject:
- component: {fileID: 5977714907501826058}
- component: {fileID: 2499339442437659018}
- component: {fileID: 3430085455787983671}
- component: {fileID: 4785194486237544099}
m_Layer: 0
m_Name: Blood Impact
m_TagString: Untagged
......@@ -4767,3 +4768,100 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 70e215529f05c464d9103bed97212272, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!82 &4785194486237544099
AudioSource:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1439179288417159974}
m_Enabled: 1
serializedVersion: 4
OutputAudioMixerGroup: {fileID: 3378691744575592581, guid: 426eb5f59adf289498f67a632a111c37,
type: 2}
m_audioClip: {fileID: 8300000, guid: bb84b36bb25987e4bba187cefe8019f5, type: 3}
m_PlayOnAwake: 1
m_Volume: 1
m_Pitch: 1
Loop: 0
Mute: 0
Spatialize: 0
SpatializePostEffects: 0
Priority: 128
DopplerLevel: 1
MinDistance: 1
MaxDistance: 500
Pan2D: 0
rolloffMode: 0
BypassEffects: 0
BypassListenerEffects: 0
BypassReverbZones: 0
rolloffCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 1
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
panLevelCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
spreadCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
reverbZoneMixCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
......@@ -12,6 +12,7 @@ GameObject:
- component: {fileID: 5977714907501826058}
- component: {fileID: 2499339442437659018}
- component: {fileID: 3430085455787983671}
- component: {fileID: 263887812533017650}
m_Layer: 0
m_Name: Grass Impact
m_TagString: Untagged
......@@ -4767,3 +4768,100 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 70e215529f05c464d9103bed97212272, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!82 &263887812533017650
AudioSource:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1439179288417159974}
m_Enabled: 1
serializedVersion: 4
OutputAudioMixerGroup: {fileID: 3378691744575592581, guid: 426eb5f59adf289498f67a632a111c37,
type: 2}
m_audioClip: {fileID: 0}
m_PlayOnAwake: 1
m_Volume: 1
m_Pitch: 1
Loop: 0
Mute: 0
Spatialize: 0
SpatializePostEffects: 0
Priority: 128
DopplerLevel: 1
MinDistance: 1
MaxDistance: 500
Pan2D: 0
rolloffMode: 0
BypassEffects: 0
BypassListenerEffects: 0
BypassReverbZones: 0
rolloffCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 1
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
panLevelCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
spreadCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
reverbZoneMixCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
......@@ -12,6 +12,7 @@ GameObject:
- component: {fileID: 5977714907501826058}
- component: {fileID: 2499339442437659018}
- component: {fileID: 3430085455787983671}
- component: {fileID: 1615155428346578712}
m_Layer: 0
m_Name: Water Impact
m_TagString: Untagged
......@@ -4767,3 +4768,100 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 70e215529f05c464d9103bed97212272, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!82 &1615155428346578712
AudioSource:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1439179288417159974}
m_Enabled: 1
serializedVersion: 4
OutputAudioMixerGroup: {fileID: 3378691744575592581, guid: 426eb5f59adf289498f67a632a111c37,
type: 2}
m_audioClip: {fileID: 8300000, guid: b56efa7a2f0409e41a2d6ca79b96ab0b, type: 3}
m_PlayOnAwake: 1
m_Volume: 1
m_Pitch: 1
Loop: 0
Mute: 0
Spatialize: 0
SpatializePostEffects: 0
Priority: 128
DopplerLevel: 1
MinDistance: 1
MaxDistance: 50
Pan2D: 0
rolloffMode: 0
BypassEffects: 0
BypassListenerEffects: 0
BypassReverbZones: 0
rolloffCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 1
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
panLevelCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
spreadCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2