Skip to content
Snippets Groups Projects
Commit 14bde77d authored by Sumerta Yoga's avatar Sumerta Yoga
Browse files

add buff to other weapon

parent 52de7cfb
Branches
Tags
No related merge requests found
......@@ -9,15 +9,26 @@ public class RobotSkill : MonoBehaviour
PlayerShooting playerShooting;
SkinnedMeshRenderer skinnedMeshRenderer;
Material material;
Sword sword;
Arrow arrow;
ShotgunBullet shotgun;
int initialDamage;
int initialDamageGun;
int initialDamageSword;
int initialDamageArrow;
int initialDamageShotgun;
void Awake()
{
player = GameObject.FindGameObjectWithTag("Player");
playerShooting = player.GetComponentInChildren<PlayerShooting>();
initialDamage = playerShooting.damagePerShot;
playerShooting.damagePerShot = 100 + initialDamage;
sword = player.GetComponentInChildren<Sword>();
arrow = player.GetComponentInChildren<Arrow>();
shotgun = player.GetComponentInChildren<ShotgunBullet>();
initialDamageGun = playerShooting.damagePerShot;
initialDamageSword = sword.attackDamage;
initialDamageArrow = arrow.damage;
initialDamageShotgun = shotgun.damagePerShot;
playerSkin = GameObject.FindGameObjectWithTag("PlayerMaterial");
skinnedMeshRenderer = playerSkin?.GetComponent<SkinnedMeshRenderer>();
material = skinnedMeshRenderer?.material;
......@@ -25,7 +36,11 @@ public class RobotSkill : MonoBehaviour
void Update()
{
playerShooting.damagePerShot = 100 + initialDamage;
playerShooting.damagePerShot = 50 + initialDamageGun;
sword.attackDamage = 70 + initialDamageSword;
arrow.damage = 30 + initialDamageArrow;
shotgun.damagePerShot = 30 + initialDamageShotgun;
if(player != null)
{
if(playerSkin != null) material.color = new Color(0.992f, 0.506f, 0.423f, 1.0f);
......@@ -33,14 +48,20 @@ public class RobotSkill : MonoBehaviour
if(distance > 10)
{
if(playerSkin != null) material.color = new Color(1f, 1f, 1f, 1.0f);
playerShooting.damagePerShot = initialDamage;
playerShooting.damagePerShot = initialDamageGun;
sword.attackDamage = initialDamageSword;
arrow.damage = initialDamageArrow;
shotgun.damagePerShot = initialDamageShotgun;
}
}
}
void OnDestroy()
{
playerShooting.damagePerShot = initialDamage;
playerShooting.damagePerShot = initialDamageGun;
sword.attackDamage = initialDamageSword;
arrow.damage = initialDamageArrow;
shotgun.damagePerShot = initialDamageShotgun;
if(playerSkin != null) material.color = new Color(1f, 1f, 1f, 1.0f);
}
......
......@@ -48,7 +48,6 @@ public class PlayerShooting : MonoBehaviour
void Shoot()
{
Debug.Log(damagePerShot);
timer = 0f;
gunAudio.Play();
......
......@@ -5,7 +5,7 @@ using System.Collections;
public class Arrow : MonoBehaviour
{
[SerializeField]
private int damage;
public int damage;
[SerializeField]
private float torque;
......
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