protected override void UpdateBulletStatus(ProjectileBase projectile) { base.UpdateBulletStatus(projectile); projectile.SetDamage(projectile.GetDamage() * currentChargeLevel); projectile.SetExplosionRadius(currentChargeLevel); projectile.transform.localScale = projectile.GetInitialSize() * (1 + currentChargeLevel * .25f); }
protected override void Shoot() { // base.Shoot(); charging.Stop(); //GameObject bulletGO = Instantiate(bulletPrefab, firePoint.position, firePoint.rotation); for (int i = 0; i < bullets.Count; i++) { if (!bullets[i].activeInHierarchy) { GameObject _bullet = bullets[i]; ProjectileBase projectile = _bullet.GetComponent <ProjectileBase>(); _bullet.transform.position = firePoint.position; _bullet.transform.rotation = firePoint.rotation; _bullet.SetActive(true); projectile.SetDamage(projectile.GetDamage() * currentChargeLevel); projectile.SetExplosionRadius(projectile.GetExplosionRadius() * currentChargeLevel); projectile.transform.localScale = projectile.transform.localScale * (1 + currentChargeLevel * .25f); projectile.SetTarget(target); shoot.Play(); break; } } }
protected virtual void CreateProjectile() { //Create basic projectile GameObject newBullet; if (projectileData.hitscan) { newBullet = Instantiate(hitscanProjectilePrefab, projectileStartPos.position, Quaternion.identity); } else { newBullet = Instantiate(physicalProjectilePrefab, projectileStartPos.position, Quaternion.identity); } ProjectileBase projectile = newBullet.GetComponent <ProjectileBase>(); //Set general properties projectile.SetDirection(TrigUtilities.DegreesToVector(owner.GetPlayerMovement().GetPlayerAngle() + Random.Range(-accuracyDegreeOffsetRange, accuracyDegreeOffsetRange))); projectile.SetDamage(projectileData.damage); projectile.SetDamageForce(projectileData.damageForce); projectile.SetOwner(owner); projectile.SetCanHitOwner(projectileData.canHitOwner); projectile.SetColor(owner.GetColor().GetModifiedBrightness(3f)); projectile.SetBounces(projectileData.bounces); projectile.SetCauseExplosion(projectileData.causeExplosion); projectile.SetExplosionRadius(projectileData.explosionRadius); projectile.SetExplodeEveryBounce(projectileData.explodeEveryBounce); //Set properties depending on if it's hitscan or physical if (projectileData.hitscan) { SetHitscanProperties(newBullet); } else { SetPhysicalProperties(newBullet); } }