本文整理汇总了C#中Bullet类的典型用法代码示例。如果您正苦于以下问题:C# Bullet类的具体用法?C# Bullet怎么用?C# Bullet使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Bullet类属于命名空间,在下文中一共展示了Bullet类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: ShootWeapon
private void ShootWeapon(Vector2 PlayerCenter)
{
Bullet newBullet = new Bullet();
newBullet.Shoot(PlayerCenter, new Vector2(Mouse.GetState().X, Mouse.GetState().Y) - Camera._position);
_Shoot.Play();
Bullets.Add(newBullet);
}
开发者ID:ShadowMen,项目名称:ZombieSurvival,代码行数:7,代码来源:Weapon.cs
示例2: HealOnHit
protected void HealOnHit(HittableObject target, Bullet bullet, RaycastHit rch, ref bool pierce)
{
Enemy e = target as Enemy;
if (e == null) return;
e.Heal(amt);
}
开发者ID:ReinAkane,项目名称:Monotopia,代码行数:7,代码来源:RepairBullet.cs
示例3: ProcessHit
//struct FishAndOddsMulti
//{
// public FishAndOddsMulti(Fish f,int oddMulti)
// {
// F = f;
// OddMulti = oddMulti;
// }
// public Fish F;
// public int OddMulti;
//}
public static void ProcessHit(Bullet b , Fish f)
{
switch(f.HittableTypeS)
{
case "Normal":
Process_NormalFish(b,f);
break;
case "AreaBomb":
Process_AreaBomb(b,f);
break;
case "SameTypeBomb":
Process_FishTypeBomb2(b,f);
break;
case "FreezeBomb":
Process_FreezeBomb(b, f);
break;
case "SameTypeBombEx":
Process_FishTypeBombEx(b, f);
break;
default:
if (Evt_HitExtension != null)
Evt_HitExtension(b, f);
break;
}
}
开发者ID:minh3d,项目名称:Fish,代码行数:35,代码来源:HitProcessor.cs
示例4: CreateWeb
void CreateWeb(Bullet b, WebScoreScaleRatio webData,bool isLizi)
{
GameObject goWebBoom = Instantiate(webData.PrefabWebBoom) as GameObject;
goWebBoom.transform.parent = transform;
Ef_WebBubble efBubble = goWebBoom.GetComponent<Ef_WebBubble>();
if (efBubble != null)
{
efBubble.ScaleTarget = webData.BubbleScale;
}
Ef_WebBoom[] efWebs = goWebBoom.GetComponentsInChildren<Ef_WebBoom>();
foreach (Ef_WebBoom efWeb in efWebs)
{
efWeb.Prefab_GoSpriteWeb = webData.PrefabWeb;
efWeb.NameSprite = webData.NameSprite;
//Debug.Log(webData.NameSprite);
efWeb.ScaleTarget = webData.Scale;
efWeb.transform.localPosition *= webData.PositionScale;
if(!isLizi)
efWeb.ColorInitialize = Prefab_WebColorNormal.Colors[b.Owner.Idx % Prefab_WebColorNormal.Colors.Length];
}
Transform tsWeb = goWebBoom.transform;
Transform tsBullet = b.transform;
tsWeb.position = new Vector3(tsBullet.position.x, tsBullet.position.y, Defines.GlobleDepth_Web);
tsWeb.rotation = tsBullet.rotation;
}
开发者ID:minh3d,项目名称:Fish,代码行数:28,代码来源:Ef_WebGenerate.cs
示例5: onHit
private void onHit(Vector3 position, Bullet bullet)
{
bullet.OnHit -= onHit;
StartCoroutine(effectCoroutine(explosionsPull, bullet.transform.position, false));
bullet.Rigidbody.velocity = Vector3.zero;
bulletsPull.ReleaseObject(bullet);
}
开发者ID:Mouserr,项目名称:TankSimulator,代码行数:7,代码来源:BulletsEmiter.cs
示例6: attack
public void attack()
{
if (Engine.IsKeyDown(keyMap.attack) && Engine.Timer.Get("coolDown") <= 0)
{
bullet = new Bullet(direction);
if (direction == Bullet.bulletsDirection.RIGHT)
{
bullet.X = this.X + Sprite.Width;
bullet.Y = this.Y + Sprite.Height / 2;
}
if (direction == Bullet.bulletsDirection.LEFT)
{
bullet.X = this.X - bullet.Width;
bullet.Y = this.Y + Sprite.Height / 2;
}
if (direction == Bullet.bulletsDirection.UP)
{
bullet.X = this.X + Sprite.Width / 2 - (bullet.Width / 2);
bullet.Y = this.Y - bullet.Height;
}
if (direction == Bullet.bulletsDirection.DOWN)
{
bullet.X = this.X + Sprite.Width / 2 - (bullet.Width / 2);
bullet.Y = this.Y + Sprite.Height;
}
bulletsShot.Add(bullet);
Engine.SpawnObject("bullet", bullet);
bullet.isShoot = true;
Engine.Timer.Set("coolDown", 0.5f);
}
}
开发者ID:Insane-96,项目名称:Resumption,代码行数:33,代码来源:PlayerWater.cs
示例7: Gun
public Gun(GameplayScreen gameplayScreen, GameCharacter owner)
: base(gameplayScreen, owner)
{
_bullet = new Bullet(ImageManager.BulletTexture);
coolDownTime = 0.8;
coolDownElapsed = 0;
}
开发者ID:ruairitobrien,项目名称:Nathaniel-WP7,代码行数:7,代码来源:Gun.cs
示例8: AddThreat
public void AddThreat(Bullet threat, Vector2 collisionPosition, float timeToCollision)
{
if (!AlreadyHasThisBullet(threat.transform))
{
threats.Add(new Threat(threat.transform, collisionPosition, timeToCollision));
}
}
开发者ID:adahera222,项目名称:Squid-Arena,代码行数:7,代码来源:AIControls.cs
示例9: Start
/// <summary>
/// Gets all necessary references.
/// </summary>
void Start()
{
photonView = this.GetComponent<PhotonView>();
myBullet = this.GetComponent<Bullet>();
isMine = photonView.isMine;
}
开发者ID:dearzhangle,项目名称:UNION-OpenSource-MOBA,代码行数:10,代码来源:BulletNetworkLayer.cs
示例10: Awake
public static BulletManager instance; // 다른 곳에서 참조하지 못하도록 static 변수로 선언
void Awake()
{
instance = this;
bullet[0].skillBorder.enabled = true;
bullet[1].skillBorder.enabled = false;
selected = bullet[0];
}
开发者ID:gus5345,项目名称:Unity_DomainWar,代码行数:9,代码来源:BulletManager.cs
示例11: drawBullet
public void drawBullet(Bullet theBullet)
{
gameCanvas.Children.Add(theBullet.getBulletShape());
TranslateTransform initialTransform = new TranslateTransform(theBullet.getBulletX(), theBullet.getBulletY());
theBullet.getBulletShape().RenderTransform = initialTransform;
}
开发者ID:Beansy,项目名称:Asteroids,代码行数:7,代码来源:GameController.cs
示例12: InstantiateBullet
void InstantiateBullet(Bullet bullet, int angle)
{
var obj = Instantiate( bullet, transform.position, Quaternion.AngleAxis(angle - 90, Vector3.forward) ) as Bullet;
//Debug.Log ("Obj is " + obj );
obj.transform.parent = Manager.RootBullet.transform;
}
开发者ID:k-yokozawa,项目名称:Unity_STG,代码行数:7,代码来源:SpShot_A.cs
示例13: Start
new void Start()
{
base.Start();
m_bullet = CreateBullet(m_firingDescs[0], m_gunPoint.transform.position) as Bullet;
StartCoroutine(EffectShield());
}
开发者ID:yakolla,项目名称:MarineVsAlien,代码行数:7,代码来源:ShieldPassiveLauncher.cs
示例14: Handle_BulletHit
void Handle_BulletHit(bool isMiss, Player p, Bullet b, Fish f)
{
if (!isMiss)
{
b.SelfDestroy();
}
}
开发者ID:minh3d,项目名称:Fish,代码行数:7,代码来源:Module_Bullet.cs
示例15: OnCollisionEnter
void OnCollisionEnter(Collision collision) {
Debug.Log("Enemy was hit by Collision:" + collision.transform.name);
playerBullet = collision.gameObject.GetComponent<Bullet>();
if(playerBullet == null) {
playerWeapon = (Weapon)GameConstants.findPlayerInProject().GetComponent<ToonCharacter_Inventory>().getPlayerWeapon();
}
if (playerBullet != null) {
this.GetComponent<BaseEnemy>().health -= GameConstants.getPlayerAttackDamage();
Destroy(collision.gameObject);
} else if (playerWeapon != null) {
if (collision.transform.name.Equals(playerWeapon.transform.name)) {
//Make Enemy Damage from Melee
if (collision.transform.gameObject.GetComponent<Inventory>() is IWeapon) {
if (GameConstants.findPlayerInProject().GetComponent<ToonCharacter_DamageEnemyOneTime>().isAttacking) {
if (!GameConstants.findPlayerInProject().GetComponent<ToonCharacter_DamageEnemyOneTime>().oneHit) {
this.GetComponent<BaseEnemy>().health -= GameConstants.getPlayerAttackDamage();
}
//Set Only One Time Damage per Animation
GameConstants.findPlayerInProject().GetComponent<ToonCharacter_DamageEnemyOneTime>().oneHit = true;
}
}
}
}
}
开发者ID:VtheunforgivenV,项目名称:DigitaleSpiele,代码行数:27,代码来源:Enemy_OnHit.cs
示例16: RemoveBullet
public void RemoveBullet(Bullet toRemove)
{
if (GameManager.playWithAIs)
foreach (AIControls ai in AIs)
ai.RemoveThreat(toRemove);
bulletMap.Remove(toRemove);
}
开发者ID:adahera222,项目名称:Squid-Arena,代码行数:7,代码来源:AIManager.cs
示例17: onManagedUpdate
public override void onManagedUpdate(float secondsElapsed)
{
this.CenterX += this.VectorX * this.Speed * secondsElapsed;
this.CenterY += this.VectorY * this.Speed * secondsElapsed;
this.LifeTime -= secondsElapsed;
if (this.LifeTime <= 0 || this.Health <= 0)
{
for (int i = 0; i < this.FragmetsCount; ++i)
{
Bullet bullet = new Bullet()
{
Parent = this.Parent,
CenterX = this.CenterX,
CenterY = this.CenterY,
Width = this.Width * this.FragmetsPart,
Height = this.Height * this.FragmetsPart,
Angle = (float)(2 * Math.PI * Options.Random.NextDouble()),
Speed = this.Speed / this.FragmetsPart,
LifeTime = this.LifeTime,
Health = this.Health * this.FragmetsPart,
};
(this.Parent as Weapon).bullets.Add(bullet);
}
}
if (this.LifeTime <= 0 || this.Health <= 0 || this.Y > Options.CameraHeight || this.Y + this.Height < 0)
{
(this.Parent as Weapon).bullets.Remove(this);
}
}
开发者ID:Ring-r,项目名称:sandbox,代码行数:32,代码来源:Bullet.cs
示例18: Start
// Use this for initialization
void Start () {
BS = GameObject.FindGameObjectWithTag ("Bullet").GetComponent<Bullet> ();
BM = GameObject.FindGameObjectWithTag ("BulletManager").GetComponent<BulletManager> ();
ColSwitch ();
// BM.NewRand ();
//Code that changes the color of the target itself
if (CurrentColor == _Color.Pink)
Border.GetComponent<Renderer>().material.color = Color.blue + Color.red + Color.yellow;
else if(CurrentColor == _Color.Red)
Border.GetComponent<Renderer>().material.color = Color.red;
else if(CurrentColor == _Color.Orange)
Border.GetComponent<Renderer>().material.color = new Color32(255, 145, 0, 255);
else if(CurrentColor == _Color.Yellow)
Border.GetComponent<Renderer>().material.color = Color.red + Color.yellow + Color.grey;
else if(CurrentColor == _Color.Green)
Border.GetComponent<Renderer>().material.color = Color.green;
else if(CurrentColor == _Color.Blue)
Border.GetComponent<Renderer>().material.color = Color.blue;
else if(CurrentColor == _Color.Purple)
Border.GetComponent<Renderer>().material.color = Color.magenta;
else if(CurrentColor == _Color.Brown)
Border.GetComponent<Renderer>().material.color = new Color32(99, 59, 5, 255);
else if(CurrentColor == _Color.Black)
Border.GetComponent<Renderer>().material.color = Color.grey;
}
开发者ID:Shad0wKing92,项目名称:MiniGame,代码行数:30,代码来源:ColorScript.cs
示例19: GetHit
public void GetHit(Bullet bullet)
{
life -= bullet.damage;
if (life <= 0) {
mobKilled();
}
}
开发者ID:TinyTeaTree,项目名称:Crimson-Land,代码行数:7,代码来源:EnemyBehaviour.cs
示例20: setupBullet
void setupBullet(Bullet b)
{
b.m_Damage = m_Damage;
b.m_Distance = m_Distance;
b.m_Speed = m_Speed;
b.gameObject.tag = gameObject.tag;
}
开发者ID:scaraba,项目名称:game,代码行数:7,代码来源:BulletShield.cs
注:本文中的Bullet类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论