コード例 #1
0
    public IEnumerator AimWeapon()
    {
        currentGun.transform.rotation = GunFunctions.CalcPlayerToMouseAngle(transform.position);
        yield return(new WaitForSeconds(0.5f));

        IdleWeapon();
    }
コード例 #2
0
 public void LavaExplosion(Transform spawnPos)
 {
     particleHost.position = spawnPos.position;
     for (int i = 0; i < maxParticles / 2; i++)
     {
         float randomSpeed = UnityEngine.Random.Range(minSpeed, maxSpeed);
         objectPool.GetObj().InitialiseObj(GunFunctions.calcSpreadShot(transform.position, -minSpread, maxSpread), minSpread, maxSpread, randomSpeed, spawnPos);
     }
 }
コード例 #3
0
    //Special attack
    public override IEnumerator Special()
    {
        for (int i = 0; i < specialBulletAmount; i++)
        {
            Quaternion rot = GunFunctions.calcSpreadShot(this.transform.position, -minSpread, maxSpread);
            GameObject go  = Instantiate(specialBulletPrefab, shootPos.transform.position, rot);
            go.GetComponent <IBullet>().SetupStats(specialBulletSpeed, specialBulletDmg, new Vector2(1, 0));
            //Feedback
            GunFunctions.KnockBack(player.GetComponent <Rigidbody2D>(), (rot * transform.right * -1), shotForce);
            StartCoroutine(cam.GetComponent <CameraScript>().CameraShake(shotCameraShakeForce, shotCameraDuration + 0.2f));

            //Wouter HeavyGunShot
            FMODUnity.RuntimeManager.PlayOneShot("event:/Weapon/GrenadeLauncherShot");
        }
        yield return(null);
    }
コード例 #4
0
    public IEnumerator SpewLavaOverTime()
    {
        float t = 0;

        while (true)
        {
            yield return(null);

            float randomSpeed = UnityEngine.Random.Range(minSpeed, maxSpeed);
            objectPool.GetObj().InitialiseObj(GunFunctions.calcSpreadShot(transform.position, -minSpread, maxSpread), minSpread, maxSpread, randomSpeed, spawnPos);
            t += Time.deltaTime;
            if (t > spewTime)
            {
                break;
            }
        }
    }
コード例 #5
0
    //Normal attack
    public override void Shoot()
    {
        if (!bulletPrefab)
        {
            return;
        }

        Quaternion rot = GunFunctions.CalcPlayerToMouseAngle(this.transform.position);
        GameObject go  = Instantiate(bulletPrefab, shootPos.transform.position, rot);

        go.GetComponent <IBullet>().SetupStats(bulletSpeed, bulletDmg, new Vector2(1, 0));
        //Feedback
        GunFunctions.KnockBack(player.GetComponent <Rigidbody2D>(), (rot * transform.right * -1), shotForce);
        StartCoroutine(cam.GetComponent <CameraScript>().CameraShake(shotCameraShakeForce, shotCameraDuration));

        //Wouter PlasmaGunShot
        FMODUnity.RuntimeManager.PlayOneShot("event:/Weapon/GrenadeLauncherShot");
    }