protected void Fire() { LinearMovement bullet = ObjectRecycler.Singleton.GetObject <LinearMovement>(0); bullet.speed = 25; bullet.initialPosition = playerCharacter.transform.position; bullet.orientation = playerCharacter.transform.parent.GetComponentInChildren <MouseIndicator>().GetAttackDirection(); bullet.GetComponent <Bullet>().isFriendly = true; bullet.GetComponent <Bullet>().Bounce = true; bullet.GetComponent <Bullet>().bounceRatio = 1.5f; bullet.GetComponent <Bullet>().maxBounceTimes = 3; bullet.transform.right = bullet.orientation; bullet.gameObject.SetActive(true); }
protected virtual void Fire(RangedWeaponConfiguration firingConfiguration) { Bullet bullet = ObjectRecycler.Singleton.GetObject <Bullet>(firingConfiguration.BulletID); bullet.hit.source = enemy; bullet.isFriendly = false; LinearMovement bulletMovement = bullet.GetComponent <LinearMovement>(); bulletMovement.speed = firingConfiguration.BulletSpeed; bulletMovement.initialPosition = firingConfiguration.Muzzle ? firingConfiguration.Muzzle.position : enemy.transform.position; bulletMovement.orientation = (enemy.currentTarget.transform.position - bulletMovement.initialPosition).normalized; bulletMovement.GetComponent <Bullet>().isFriendly = false; bulletMovement.transform.right = bulletMovement.orientation; bulletMovement.gameObject.SetActive(true); }
public void EmitShockwave(int objectID, Vector3 direction, bool cameraShake = true) { LinearMovement shockwaveMovement = ObjectRecycler.Singleton.GetObject <LinearMovement>(objectID); shockwaveMovement.initialPosition = transform.position + new Vector3(1, 0, 0); shockwaveMovement.orientation = direction.x > 0 ? Vector3.right : Vector3.left; HitBox shockwaveHitbox = shockwaveMovement.GetComponent <HitBox>(); if (shockwaveHitbox) { shockwaveHitbox.hit.source = this; } shockwaveMovement.gameObject.SetActive(true); if (cameraShake) { CameraManager.Instance.Shaking(0.2f, 0.2f); } }