Update Cannon Shooting Effect

This commit is contained in:
Philip W 2021-11-11 10:18:30 +00:00
parent 819fdbe401
commit 9594fddfb6
3 changed files with 102 additions and 1 deletions

View File

@ -1315,6 +1315,7 @@ GameObject:
m_Component: m_Component:
- component: {fileID: 565676025} - component: {fileID: 565676025}
- component: {fileID: 565676026} - component: {fileID: 565676026}
- component: {fileID: 565676028}
m_Layer: 0 m_Layer: 0
m_Name: Shooter m_Name: Shooter
m_TagString: Player m_TagString: Player
@ -1354,6 +1355,102 @@ MonoBehaviour:
shootSpeed: 5 shootSpeed: 5
shootDirection: {x: 0, y: 1} shootDirection: {x: 0, y: 1}
relativeToRotation: 1 relativeToRotation: 1
--- !u!82 &565676028
AudioSource:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 565676024}
m_Enabled: 1
serializedVersion: 4
OutputAudioMixerGroup: {fileID: 0}
m_audioClip: {fileID: 8300000, guid: 6b8e3c84427db0e4583454e3b7fb843a, type: 3}
m_PlayOnAwake: 0
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: 0
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
--- !u!1 &605827951 --- !u!1 &605827951
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

View File

@ -18,7 +18,7 @@ public class DifficultyScale : MonoBehaviour
// Update is called once per frame // Update is called once per frame
void Update() void Update()
{ {
if (((Mathf.FloorToInt(time.GetComponent<UITimer>().time) - (incrementAmountInSeconds * currentDifficultyLevel)) / incrementDifficultyInSeconds) + 1 == 2) if (((Mathf.FloorToInt(time.GetComponent<UITimer>().time) - (incrementAmountInSeconds * currentDifficultyLevel)) / incrementDifficultyInSeconds) == 1)
{ {
currentDifficultyLevel++; currentDifficultyLevel++;
incrementDifficultyInSeconds += incrementAmountInSeconds; incrementDifficultyInSeconds += incrementAmountInSeconds;

View File

@ -57,6 +57,10 @@ public class ObjectShooter : MonoBehaviour
if(rigidbody2D != null) if(rigidbody2D != null)
{ {
rigidbody2D.AddForce(actualBulletDirection * shootSpeed, ForceMode2D.Impulse); rigidbody2D.AddForce(actualBulletDirection * shootSpeed, ForceMode2D.Impulse);
if (GetComponent<AudioSource>() != null)
{
GetComponent<AudioSource>().Play();
}
} }
// add a Bullet component if the prefab doesn't already have one, and assign the player ID // add a Bullet component if the prefab doesn't already have one, and assign the player ID