コード例 #1
0
    private void Shoot()
    {
        //creates a spawn of the laser to the player position
        //Quaternion.identity-->default position
        //sets the laser to the player position above with no rotation
        //countdown on laser so player is not spaming
        if (Time.time > _nextFire)
        {
            //setting triple shot
            if (canTripleShot == true)
            {
                //Play FX!
                audioController.PlaySound(Sounds.tripleShotLaserSound);
                Instantiate(_tripleShotPrefab, _transform.position, Quaternion.identity);
            }
            else
            {
                //Play FX!
                audioController.PlaySound(Sounds.laserSound);

                //instanciamos el laser del player mediante Poolsystem
                PoolSystem.SpawnObject(_laserPrefab, PoolTypes.laserPlayer, _transform.position + new Vector3(0, 0.9f, 0));
                //Instantiate(_laserPrefab, _transform.position + new Vector3(0, 0.9f, 0), Quaternion.identity);
            }
            _nextFire = Time.time + _fireRate;
        }
    }
コード例 #2
0
    void Shoot()
    {
        if (Time.time > nextFire)
        {
            //Play FX!
            audioController.PlaySound(Sounds.laserSound);

            //se spawnea el objeto des del pool system
            PoolSystem.SpawnObject(laserPrefab, weaponType, laserSpawn.position, transform.rotation);
            //Instantiate(laserPrefab, laserSpawn.position,transform.rotation);
            nextFire = Time.time + shootingRate;
        }
    }