public void ArcherAtack(IShootable shootable) { if (TargetProviderGetter.HasTarget) { shootable.Shoot(TargetProviderGetter.GetTarget(), PrefabProvideGetter.GetPrefab(Arrow)); } }
void Update() { if (Input.anyKeyDown) { shootable.Shoot(pistolBulletSpeed); } }
void IActions.Do() { int currentMode = MyInputManager.instance.GetFireMode(); if (currentMode >= 0 && currentMode < ShootsAbility.Count && currentShootAbility != ShootsAbility[currentMode]) { currentShootAbility = ShootsAbility[currentMode]; } currentShootAbility.Shoot(); }
private void FixedUpdate() { if (isShooting) { shootable.Shoot(1); transform.LookAt(currentTarget.transform); } //Update animation m_ActorAnimation.SetBlendTree(m_Agent.velocity.normalized.magnitude); }
private void FireProjectile() { GameObject bullet = ObjectPoolManager.Spawn(projectilePrefab, firePoint.position, firePoint.rotation); IShootable shot = bullet.GetComponent <IShootable>(); IAudio player = ObjectPoolManager.Spawn(audioPlayerPrefab.gameObject, transform.position, transform.rotation).GetComponent <IAudio>(); player.SetUpAudioSource(AudioManager.instance.GetSound("SlimeFireProjectile")); player.PlayAtRandomPitch(); float dmg = Random.Range(settings.minDamage, settings.maxDamage); float kBack = Random.Range(settings.minKnockBack, settings.minKnockBack); shot.SetUpBullet(kBack, dmg); shot.Shoot(firePoint.up, shootForce); canAttack = false; Invoke("ResetShotTime", Random.Range(Mathf.Clamp(settings.attackRate - 1.5f, 0f, settings.attackRate), settings.attackRate + 1.5f)); }
public virtual void Shoot() { shootSound.Play(this.transform); timeToNextShoot = 1; IShootable projectile = projectilePool.FirstOrDefault(); if (projectile == null && currentTarget != null) { IShootable newProjectile = ((IShootable)Instantiate((Object)projectilePrefab, this.transform.position, Quaternion.identity)); newProjectile.Shoot(projectileSpeed, currentTarget.transform.position - shootPoint.position, projectileDamage, this, shootPoint.position); } else if (currentTarget != null) { projectilePool.Remove(projectile); projectile.Shoot(projectileSpeed, currentTarget.transform.position - shootPoint.position, projectileDamage, this, shootPoint.position); } currentTarget = null; }
public void SpawnFragments() { float angleIncrement = 360f / fragmentCounts; float currentAngle = 0f; GameObject currentFragment; for (int i = 0; i < fragmentCounts; i++) { int rand = Random.Range(0, slimeFragmentsPrefabs.Count); currentFragment = ObjectPoolManager.Spawn(slimeFragmentsPrefabs[rand], transform.position); Vector3 dir = EssoUtility.GetVectorFromAngle(currentAngle).normalized; currentFragment.transform.up = dir; IShootable frag = currentFragment.GetComponent <IShootable>(); frag.SetUpBullet(knockBack / fragmentCounts, damage / fragmentCounts); frag.Shoot(dir, shotForce * 0.8f); currentAngle += angleIncrement; } }
private void Shoot() { shootSound.Play(this.transform); currentAmmo--; changeAmmoEvent.Invoke(AmmunitionRelative); timeToNextShoot = 1; IShootable projectile = projectilePool.FirstOrDefault(); if (projectile == null) { IShootable newProjectile = ((IShootable)Instantiate((Object)projectilePrefab, this.transform.position, Quaternion.identity)); newProjectile.Shoot(projectileSpeed, currentTarget.transform.position - shootPoint.position, projectileDamage, this, shootPoint.position); } else { projectilePool.Remove(projectile); projectile.Shoot(projectileSpeed, currentTarget.transform.position - shootPoint.position, projectileDamage, this, shootPoint.position); } currentTarget = null; }
void Shoot() { timer = 0f; CurrentClipSize--; if (CurrentClipSize == 0) { OnWeaponClipDepleted(this); } //gunAudio.Play(); gunLight.enabled = true; //gunParticles.Stop(); //gunParticles.Play(); shootable.Shoot(Inaccuracy, ShotsAtOnce, Range, DamagePerShot); OnWeaponMakeSound(transform.position, gunSoundDistance); }
public GameObject SpawnFromPool(string tag, Vector3 position, Quaternion rotation) { if (!objectPools.ContainsKey(tag)) { Debug.LogWarning("Specified tag " + tag + " doesn't exist"); return(null); } GameObject toSpawn = objectPools[tag].Dequeue(); toSpawn.transform.position = position; toSpawn.transform.rotation = rotation; toSpawn.SetActive(true); IShootable shootable = toSpawn.GetComponent <IShootable>(); shootable.Shoot(); objectPools[tag].Enqueue(toSpawn); return(toSpawn); }
void Update() { // Stop if we aren't the local player // We don't want to move all the tanks if (!isLocalPlayer) { return; } // Read the input hMotion = (sbyte)Input.GetAxisRaw("Horizontal"); vMotion = (sbyte)Input.GetAxisRaw("Vertical"); mousePos = Input.mousePosition; // Pass it to the controllers tankCtrl.Move(hMotion, vMotion); turretCtrl.Rotate(mousePos); if (Input.GetAxis("Fire1") > 0) { weaponCtrl.Shoot(); } }
public virtual Bullet Shoot() { return(Shooter?.Shoot()); }
private void FixedUpdate() { movable.Move(moveValue); rotable.Rotate(aimValue); shootable.Shoot(aimValue.sqrMagnitude); }
public string TryToShoot() { return(weaponType.Shoot()); }
public string Shoot() { return($"{GetFullName()}: {_shootable.Shoot()}"); }