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

change buff mechanism

parent 382d99e8
Branches
Tags
No related merge requests found
......@@ -24,6 +24,7 @@ public class StateController : MonoBehaviour
public static bool showSaveUI = true;
public static int playerHealth = 100;
public static string saveSlotName;
public static int attBuff = 0;
public static void reset()
{
......@@ -44,6 +45,7 @@ public class StateController : MonoBehaviour
petTag = 3;
petCurrentHealth = 0;
slot = "0";
attBuff = 0;
resetShop();
}
......
......@@ -54,7 +54,7 @@ public class PetMovement : MonoBehaviour
return;
}
if(nav.remainingDistance > 3){
if(nav.remainingDistance > nav.stoppingDistance){
anim.SetBool("isWalking", true);
}
else{
......@@ -62,7 +62,6 @@ public class PetMovement : MonoBehaviour
}
playerCurrentPosition = player.position;
Debug.Log(StateController.petCurrentHealth);
if(petHealth.currentHealth > 0 && playerHealth.currentHealth > 0)
{
if(playerCurrentPosition != playerLastPosition)
......
......@@ -21,48 +21,31 @@ public class RobotSkill : MonoBehaviour
void Awake()
{
player = GameObject.FindGameObjectWithTag("Player");
playerShooting = player.GetComponentInChildren<PlayerShooting>();
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;
StateController.attBuff = 50;
}
void Update()
{
playerShooting.damagePerShot = 50 + initialDamageGun;
sword.attackDamage = 70 + initialDamageSword;
arrow.damage = 30 + initialDamageArrow;
shotgun.damagePerShot = 30 + initialDamageShotgun;
StateController.attBuff = 50;
if(player != null)
{
if(playerSkin != null) material.color = new Color(0.992f, 0.506f, 0.423f, 1.0f);
float distance = Vector3.Distance(player.transform.position, transform.position);
if(distance > 10)
{
StateController.attBuff = 0;
if(playerSkin != null) material.color = new Color(1f, 1f, 1f, 1.0f);
playerShooting.damagePerShot = initialDamageGun;
sword.attackDamage = initialDamageSword;
arrow.damage = initialDamageArrow;
shotgun.damagePerShot = initialDamageShotgun;
}
}
}
void OnDestroy()
{
playerShooting.damagePerShot = initialDamageGun;
sword.attackDamage = initialDamageSword;
arrow.damage = initialDamageArrow;
shotgun.damagePerShot = initialDamageShotgun;
if(playerSkin != null) material.color = new Color(1f, 1f, 1f, 1.0f);
StateController.attBuff = 0;
}
......
......@@ -69,14 +69,14 @@ public class PlayerShooting : MonoBehaviour
if (enemyHealth != null)
{
enemyHealth.TakeDamage((int)(damagePerShot * StateController.gunMultiplier), shootHit.point);
enemyHealth.TakeDamage((int)(damagePerShot * StateController.gunMultiplier + StateController.attBuff), shootHit.point);
}
BossHealth bossHealth = shootHit.collider.GetComponent<BossHealth>();
if (bossHealth != null)
{
bossHealth.TakeDamage((int)(damagePerShot * StateController.gunMultiplier), shootHit.point);
bossHealth.TakeDamage((int)(damagePerShot * StateController.gunMultiplier + StateController.attBuff), shootHit.point);
}
gunLine.SetPosition(1, shootHit.point);
......
......@@ -38,18 +38,19 @@ public class Arrow : MonoBehaviour
{
if (hit || flying == false) return;
hit = true;
Debug.Log(damage);
EnemyHealth enemy = other.GetComponent<EnemyHealth>();
if (enemy != null)
{
enemy.TakeDamage((int)(damage * StateController.bowMultiplier), other.ClosestPointOnBounds(transform.position));
enemy.TakeDamage((int)(damage * StateController.bowMultiplier + StateController.attBuff), other.ClosestPointOnBounds(transform.position));
}
BossHealth boss = other.GetComponent<BossHealth>();
if (boss != null)
{
boss.TakeDamage((int)(damage * StateController.bowMultiplier), other.ClosestPointOnBounds(transform.position));
boss.TakeDamage((int)(damage * StateController.bowMultiplier + StateController.attBuff), other.ClosestPointOnBounds(transform.position));
}
rigidbody.velocity = Vector3.zero;
......
......@@ -72,13 +72,13 @@ public class ShotgunBullet : MonoBehaviour
if (enemyHealth != null)
{
enemyHealth.TakeDamage((int) (damagePerShot * StateController.shotGunMultiplier), shootHit.point);
enemyHealth.TakeDamage((int) (damagePerShot * StateController.shotGunMultiplier + StateController.attBuff), shootHit.point);
}
BossHealth bossHealth = shootHit.collider.GetComponent<BossHealth>();
if (bossHealth != null)
{
bossHealth.TakeDamage((int)(damagePerShot * StateController.shotGunMultiplier), shootHit.point);
bossHealth.TakeDamage((int)(damagePerShot * StateController.shotGunMultiplier + StateController.attBuff), shootHit.point);
}
gunLine.SetPosition(1, shootHit.point);
......
......@@ -56,13 +56,13 @@ public class Sword : MonoBehaviour
EnemyHealth enemyHealth = enemy.GetComponent<EnemyHealth>();
if (enemyHealth != null)
{
enemyHealth.TakeDamage(attackDamage, enemy.ClosestPointOnBounds(transform.position));
enemyHealth.TakeDamage(attackDamage + StateController.attBuff, enemy.ClosestPointOnBounds(transform.position));
}
BossHealth bossHealth = enemy.GetComponent<BossHealth>();
if (bossHealth != null)
{
bossHealth.TakeDamage(attackDamage, enemy.ClosestPointOnBounds(transform.position));
bossHealth.TakeDamage(attackDamage + StateController.attBuff, enemy.ClosestPointOnBounds(transform.position));
}
}
......
......@@ -165,7 +165,7 @@ Adapun aplikasi ini memiliki beberapa spesifikasi , yaitu :
NIM | Nama | Tugas | Jam Persiapan | Jam Pengerjaan
--- | --- | --- | --- | ---
13520021 | Gede Sumerta Yoga | inisialisasi game, pet | |
13520021 | Gede Sumerta Yoga | inisialisasi game, pet | 9 jam | 16 jam
13520090 | Rahmat Rafid Akbar | Cheat, Main Menu, Game Over, Local Scoreboard, Bug Tester | 10 jam | 24 jam
13520133 | Jevant Jedidia Augustine | Inisialisasi game, story mode, Save & Load, Integrasi | 10 jam | 36 jam
13520141 | Yoseph Alexander Siregar | Shop, Bonus Upgrade Weapon | 9 jam | 15 jam
......
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