示例#1
0
 public bool Shoot()
 {
     if (shootTimer <= 0 && ownerShip.energy >= energyCost)
     {
         if (!ownerShip.world.isRemote)
         {
             Bullet bp = new Bullet(gunType, ownerShip, Position, Rotation, bulletSpeed, ownerShip.world);
             ownerShip.energy -= energyCost;
             effectColor       = bp.color;
             shootTimer        = shootTimerMax;
             ownerShip.world.bullets.Add(bp);
             ServerPacketSender.CreateBullet(bp);
         }
         else
         {
             Bullet bp = new Bullet(gunType, ownerShip, Position, Rotation, bulletSpeed, ownerShip.world);
             effectColor       = bp.color;
             shootTimer        = shootTimerMax;
             ownerShip.energy -= energyCost;
             randomSize        = 1 + (float)core.random.NextDouble() / 4F;
             randomEffect      = (byte)core.random.Next(2);
         }
         return(true);
     }
     return(false);
 }