本文整理汇总了C#中Projectile.Initialize方法的典型用法代码示例。如果您正苦于以下问题:C# Projectile.Initialize方法的具体用法?C# Projectile.Initialize怎么用?C# Projectile.Initialize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Projectile
的用法示例。
在下文中一共展示了Projectile.Initialize方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Shoot
public bool Shoot(double elapsedTime, Projectile ammunitionType)
{
coolDownElapsed += elapsedTime;
if (coolDownElapsed <= coolDownTime)
{
IsBeingUsed = false;
return false;
}
coolDownElapsed = 0;
IsBeingUsed = true;
foreach (Projectile projectile in ammo.Where(projectile => !projectile.IsVisible))
{
projectile.Fire(owner.Center, owner.Target.Center);
return true;
}
ammunitionType.Initialize();
ammunitionType.Fire(owner.Center, owner.Target.Center);
ammo.Add(ammunitionType);
return true;
}
示例2: AddTurretProjectile
private void AddTurretProjectile(Turret tur)
{
Projectile projectile = new Projectile();
projectile.Initialize(this.ScreenManager.GraphicsDevice.Viewport, this.turretProjTexture, new Vector2(tur.Position.X, tur.Position.Y), tur);
this.projectiles.Add(projectile);
SoundCaller turretShotFired = new SoundCaller(this.turretSound);
}
示例3: AddPlayerProjectile
private void AddPlayerProjectile(Vector2 position)
{
Projectile projectile = new Projectile();
projectile.Initialize(this.ScreenManager.GraphicsDevice.Viewport, this.projectileTexture, position, this.player);
this.projectiles.Add(projectile);
SoundCaller shotFired = new SoundCaller(this.shotSound);
}
示例4: Initialize
public override void Initialize()
{
// Define initial state of the catapult
currentState = CatapultState.Idle;
// Load the idle texture
idleTexture = curGame.Content.Load<Texture2D>(idleTextureName);
// Initialize the projectile
Vector2 projectileStartPosition;
if (isAI)
projectileStartPosition = new Vector2(630, 340);
else
projectileStartPosition = new Vector2(175, 340);
// TODO: Update hit offset
projectile = new Projectile(curGame, spriteBatch,
"Textures/Ammo/rock_ammo", projectileStartPosition,
60, isAI, gravity);
projectile.Initialize();
IsActive = true;
AnimationRunning = false;
stallUpdateCycles = 0;
// Initialize randomizer
random = new Random();
base.Initialize();
}
示例5: AddProjectile
private void AddProjectile(Vector2 position)
{
//moving to top
int projDamage = player.DamageMod + 3;
Projectile projectile = new Projectile();
projectile.Initialize(ScreenManager.GraphicsDevice.Viewport, projectileTexture, position, projDamage);
projectiles.Add(projectile);
}