Skip to content
Snippets Groups Projects
Commit 3099af93 authored by dawetmaster's avatar dawetmaster
Browse files

implementasi sword sudah, cuma kurang efek

parent 5a36c1e3
No related merge requests found
......@@ -20,10 +20,10 @@ public class PlayerShooting : MonoBehaviour
int shootableMask;
ParticleSystem gunParticles;
LineRenderer gunLine;
MeshRenderer swordSlash;
AudioSource gunAudio;
Light gunLight;
float effectsDisplayTime = 0.2f;
RaycastHit[] enemiesHit;
void Awake ()
{
......@@ -34,7 +34,6 @@ public class PlayerShooting : MonoBehaviour
gunLine = GetComponent <LineRenderer> ();
gunAudio = GetComponent<AudioSource> ();
gunLight = GetComponent<Light> ();
swordSlash = GetComponent<MeshRenderer>();
}
void SetGunMode()
......@@ -63,14 +62,14 @@ public class PlayerShooting : MonoBehaviour
range = 100f;
break;
case 2:
damagePerShot = 200;
damagePerShot = 50;
timeBetweenBullets = 1f;
range = 10f;
break;
default:
damagePerShot = 100;
timeBetweenBullets = 0.15f;
range = 5f;
damagePerShot = 80;
timeBetweenBullets = 0.5f;
range = 2f;
break;
}
}
......@@ -188,11 +187,10 @@ public class PlayerShooting : MonoBehaviour
void SwordAttack() {
timer = 0f;
shootRay.origin = transform.position;
shootRay.direction = transform.forward;
int dist = 0;
if (Physics.SphereCast(shootRay.origin, range, shootRay.direction, out shootHit, dist, shootableMask)) {
EnemyHealth enemyHealth = shootHit.collider.GetComponent <EnemyHealth> ();
enemiesHit = Physics.SphereCastAll(transform.position, range, transform.forward, 0, shootableMask);
for (int i = 0; i < enemiesHit.Length; i++) {
EnemyHealth enemyHealth = enemiesHit[i].collider.gameObject.GetComponent<EnemyHealth>();
if(enemyHealth != null)
{
//Lakukan Take Damage
......
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