Skip to content
Snippets Groups Projects
Commit 1d33c9af authored by afifahfq's avatar afifahfq
Browse files

connect player power to shooting

parent 5ec4abe4
No related merge requests found
......@@ -3512,6 +3512,11 @@ PrefabInstance:
propertyPath: upgradeImage
value:
objectReference: {fileID: 248738325}
- target: {fileID: 8665781967449119952, guid: fd16b34ad2dca9f44a94fad4ea111362,
type: 3}
propertyPath: startingPower
value: 25
objectReference: {fileID: 0}
- target: {fileID: 8665781967449217581, guid: fd16b34ad2dca9f44a94fad4ea111362,
type: 3}
propertyPath: m_Name
......
......@@ -14,7 +14,6 @@ public class PlayerHealth : MonoBehaviour
public float flashSpeed = 5f;
public Color flashColour = new Color(1f, 0f, 0f, 0.1f);
Animator anim;
AudioSource playerAudio;
PlayerMovement playerMovement;
......
......@@ -6,7 +6,7 @@ using UnityEngine.SceneManagement;
public class PlayerPower : MonoBehaviour
{
public float startingPower = 12.5f;
public float startingPower = 25f;
public float currentPower;
public Slider powerSlider;
public Image upgradeImage;
......@@ -21,7 +21,6 @@ public class PlayerPower : MonoBehaviour
bool fullPower;
bool upgraded;
void Awake()
{
// Mendapatkan reference komponen
......@@ -37,6 +36,9 @@ public class PlayerPower : MonoBehaviour
{
if (upgraded)
{
float powerFactor = (currentPower - 12.5f) / 12.5f * 5;
playerShooting.damagePerShot += (int)powerFactor;
// Merubah warna gambar menjadi value dari flashColour
upgradeImage.color = flashColour;
playerAudio.clip = pickUpClip;
......
......@@ -14,7 +14,9 @@ public class PlayerShooting : MonoBehaviour
LineRenderer gunLine;
AudioSource gunAudio;
Light gunLight;
float effectsDisplayTime = 0.2f;
float effectsDisplayTime = 0.2f;
PlayerPower playerPower;
void Awake()
{
......
......@@ -6,7 +6,7 @@ using UnityEngine.SceneManagement;
public class PlayerSpeed : MonoBehaviour
{
public float startingSpeed = 25f;
public float startingSpeed = 12.5f;
public float currentSpeed;
public Slider speedSlider;
public Image upgradeImage;
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment