Esempio n. 1
0
 public void ArcherAtack(IShootable shootable)
 {
     if (TargetProviderGetter.HasTarget)
     {
         shootable.Shoot(TargetProviderGetter.GetTarget(), PrefabProvideGetter.GetPrefab(Arrow));
     }
 }
Esempio n. 2
0
 void Update()
 {
     if (Input.anyKeyDown)
     {
         shootable.Shoot(pistolBulletSpeed);
     }
 }
Esempio n. 3
0
    void IActions.Do()
    {
        int currentMode = MyInputManager.instance.GetFireMode();

        if (currentMode >= 0 && currentMode < ShootsAbility.Count && currentShootAbility != ShootsAbility[currentMode])
        {
            currentShootAbility = ShootsAbility[currentMode];
        }
        currentShootAbility.Shoot();
    }
Esempio n. 4
0
    private void FixedUpdate()
    {
        if (isShooting)
        {
            shootable.Shoot(1);
            transform.LookAt(currentTarget.transform);
        }

        //Update animation
        m_ActorAnimation.SetBlendTree(m_Agent.velocity.normalized.magnitude);
    }
Esempio n. 5
0
    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));
    }
Esempio n. 6
0
    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;
    }
Esempio n. 7
0
    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;
        }
    }
Esempio n. 8
0
    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;
    }
Esempio n. 9
0
    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);
    }
Esempio n. 10
0
    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);
    }
Esempio n. 11
0
    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();
        }
    }
Esempio n. 12
0
 public virtual Bullet Shoot()
 {
     return(Shooter?.Shoot());
 }
Esempio n. 13
0
 private void FixedUpdate()
 {
     movable.Move(moveValue);
     rotable.Rotate(aimValue);
     shootable.Shoot(aimValue.sqrMagnitude);
 }
Esempio n. 14
0
 public string TryToShoot()
 {
     return(weaponType.Shoot());
 }
Esempio n. 15
0
 public string Shoot()
 {
     return($"{GetFullName()}: {_shootable.Shoot()}");
 }