예제 #1
0
    private static IEnumerator Arrows(Gun gun, BulletScript script)
    {
        script.coroutines_running++;
        Quaternion rot = Quaternion.LookRotation(
            gun.barrel_end.forward
            ) *
                         Quaternion.Euler(0, 90, 0);
        Flurry     Gun = (Flurry)gun;
        GameObject b   = Instantiate(Gun.Bullet, gun.barrel_end.position, rot) as GameObject;

        NetworkServer.Spawn(b);
        Gun.Claimed_Gun_Mods -= Arrows;
        Gun.ReadyWeaponForFire(ref b);
        Gun.RpcFire(b.transform.forward, b);
        rot = Quaternion.LookRotation(
            gun.barrel_end.forward
            ) *
              Quaternion.Euler(0, -90, 0);
        b = Instantiate(Gun.Bullet, gun.barrel_end.position, rot) as GameObject;
        NetworkServer.Spawn(b);
        Gun.ReadyWeaponForFire(ref b);
        Gun.RpcFire(b.transform.forward, b);
        while (!script.Target && !Gun.HasReloaded(-.2f))
        {
            yield return(new WaitForFixedUpdate());
        }
        Gun.Claimed_Gun_Mods += Arrows;
        script.coroutines_running--;
    }
예제 #2
0
 public static IEnumerator Diverge(Gun gun, BulletScript script)
 {
     if (rand.NextDouble() < .1)
     {
         Flurry ggun = (Flurry)gun;
         script.coroutines_running++;
         while (!script.Target)
         {
             yield return(new WaitForEndOfFrame());
         }
         for (float i = 0; i < 360; i += 36)
         {
             GameObject bullet = Instantiate(ggun.Bullet,
                                             script.transform.position,
                                             Quaternion.Euler(0, i, 0));
             BulletScript s = bullet.GetComponent <BulletScript>();
             Destroy(s.homer);
             NetworkServer.Spawn(bullet);
             ggun.Claimed_Gun_Mods -= Diverge;
             ggun.ReadyWeaponForFire(ref bullet);
             s.can_pierce = true;
             ggun.RpcFire(bullet.transform.forward, bullet);
             ggun.Claimed_Gun_Mods += Diverge;
         }
         script.coroutines_running--;
     }
     else
     {
         yield return(null);
     }
 }