/// ダメージを与える bool Damage(int v) { _hp -= v; if (_hp <= 0) { // HPがなくなったので死亡 Vanish(); // 倒した for (int i = 0; i < 4; i++) { Particle.Add(X, Y); } // 破壊SE再生 Sound.PlaySe("destroy", 0); // ボスを倒したらザコ敵と敵弾を消す if (_id == 0) { // 生存しているザコ敵を消す Enemy.parent.ForEachExist(e => e.Damage(9999)); // 敵弾をすべて消す if (Bullet.parent != null) { Bullet.parent.Vanish(); } } return(true); } // まだ生きている return(false); }
/// アップグレードする public void Upgrade(eUpgrade type) { switch (type) { case eUpgrade.Range: // 射程範囲のレベルアップ _lvRange++; break; case eUpgrade.Firerate: // 連射速度のレベルアップ _lvFirerate++; break; case eUpgrade.Power: // 攻撃威力のレベルアップ _lvPower++; break; } // パラメータ更新 UpdateParam(); // アップグレードエフェクト生成 Particle p = Particle.Add(Particle.eType.Ellipse, 20, X, Y, 0, 0); if (p) { p.SetColor(0.2f, 0.2f, 1); } }
private void OnTriggerEnter2D(Collider2D c) { string name = LayerMask.LayerToName(c.gameObject.layer); switch (name) { case "Enemy": break; case "Bullet": life--; destroyCount++; UpdateLifeIcon(); if (life <= 0) { Vanish(); for (int i = 0; i < 8; i++) { Particle.Add(X, Y); } } break; } }
public void Vanish() { Info info = _GetInfo(id); float scale = _GetSize(info.size) * 10f; Particle.Add(particle, transform.position.x, transform.position.y, 4, -1, Color.green, scale); Destroy(gameObject); }
public override void Vanish() { for (int i = 0; i < 32; i++) { Particle.Add(X, Y); } base.Vanish(); }
public void Vanish() { float deg = Utils.GetDegree(_rigidbody2D); deg += 180.0f; Particle.Add(particle, transform.position.x, transform.position.y, 2, deg, Color.cyan); Destroy(gameObject); }
public void OnMouseDown() { Count--; for (int i = 0; i < 32; i++) { Particle.Add(X, Y); } DestroyObj(); }
public override void Vanish() { Particle p = Particle.Add(X, Y); if (p != null) { p.SetColor(0.1f, 0.1f, 1); p.MulVelocity(0.7f); } base.Vanish(); }
public void OnMouseDown() { Count--; //パーティクルを生成 for (int i = 0; i < 32; i++) { Particle.Add(X, Y); } //破棄する DestroyObj(); }
public void OnMouseDown() { Count--; // パーティクルを生成 for (int i = 0; i < 32; i++) { Particle.Add(transform.position.x, transform.position.y); } Destroy(gameObject); }
public void OnMouseDown() { // 生存数を減らす Count--; Particle p = new Particle(); for (int i = 0; i < 32; i++) { p.Add(enemy.transform.position.x, enemy.transform.position.y); } Destroy(enemy); }
bool Damage(int v) { hp -= v; if (hp <= 0) { Vanish(); for (int i = 0; i < 4; i++) { Particle.Add(X, Y); } return(true); } return(false); }
/// 消滅 public override void Vanish() { // パーティクル生成 Particle p = Particle.Add(X, Y); if (p != null) { // 青色にする p.SetColor(0.1f, 0.1f, 1); // 速度を少し遅くする p.MulVelocity(0.7f); } base.Vanish(); }
public void OnMouseDown() { // 生存数を減らす Count--; // delete Object DestroyObj(); // パーティクルを生成 for (int i = 0; i < 16; i++) { Particle.Add(X, Y); } }
public void OnMouseDown() { //生存数減らす Count--; //create Partice for (int i = 0; i < 32; i++) { Particle.Add(X, Y); } //destroy DestroyObj(); }
// 消滅 public override void Vanish() { // パーティクル生成 for (int i = 0; i < 32; i++) { Particle.Add(X, Y); } base.Vanish(); GameObject obj = GameObject.Find("Doctor") as GameObject; if (obj != null) { // Doctor doc = obj.GetComponent<Doctor>(); // doc.Vanish(); //// obj.SetActive (false); } }
protected override void PreDrawUpdate(GameTime gameTime) { if (Random.NextFloat() > 0.99f) { var side = Vector2.Zero; if (Random.Coin()) { side = Origin + leftDrift * (float)Age(gameTime).TotalSeconds + momentum * (float)Age(gameTime).TotalSeconds - Sprite.TextureOrigin; } else { side = Origin + rightDrift * (float)Age(gameTime).TotalSeconds + new Vector2(Sprite.TextureOrigin.X, 0) + momentum * (float)Age(gameTime).TotalSeconds - Sprite.TextureOrigin; } Particle.Add(new Particles.MultiBlast(side, (int)Sprite.TextureOrigin.Length() * 2)); } base.PreDrawUpdate(gameTime); }
/// <summary> /// Deals the given amount of damage to this ship. /// </summary> /// <param name="hitpointsToAdd"></param> public void DealDamage(int hitpointsToAdd, Vector2 position) { Debug.Assert(hitpointsToAdd <= 0); Hitpoints = (int)MathHelper.Clamp(Hitpoints + hitpointsToAdd, 0, MaxHitpoints); if (HitpointsChanged != null) { HitpointsChanged(this); } if (hitpointsToAdd != 0) { Particle.Add(new Particles.Text(position, hitpointsToAdd > 0 ? "+" : "" + hitpointsToAdd, 1, hitpointsToAdd > 0 ? Color.Green : Color.Red)); } if (Hitpoints == 0) { Delete(); } }
public override void Delete(DeleteReasons reason = DeleteReasons.Destroyed) { if (reason == DeleteReasons.SelfDestruction) { Particle.Add(new Particles.Explosion(Position, ExplosionSize) { Color = ExplosionColor }); foreach (var ship in GameControl.Ships) { if (ship != this && Vector2.DistanceSquared(ship.Position, Position) <= ExplosionRangeSquared) { ship.DealDamage(-ExplosionDamage, Vector2.Zero); } } } base.Delete(reason); }
/// 消滅 (①) public override void Vanish() { // パーティクル生成 for (int i = 0; i < 4; i++) { int timer = Random.Range(20, 40); // 反対方向に飛ばす (②) float dir = Direction - 180 + Random.Range(-60, 60); float spd = Random.Range(1.0f, 1.5f); Particle p = Particle.Add(Particle.eType.Ball, timer, X, Y, dir, spd); if (p) { // 小さくする p.Scale = 0.6f; // 赤色にする p.SetColor(1, 0.0f, 0.0f); } } // 親クラスの消滅処理を呼び出す base.Vanish(); }
public virtual void Delete(DeleteReasons reason = DeleteReasons.Destroyed) { if (DeleteFlag) { return; } if (reason == DeleteReasons.Destroyed || reason == DeleteReasons.SelfDestruction) { Particle.Add(new Particles.Explosion(Position, (int)this.Sprite.TextureOrigin.Length())); Particle.Add(new Particles.DestroyedShip(Position, Vector2.Zero.Transform(Angle, Speed), Sprite) { Color = Color, Rotation = MathHelper.PiOver2 + Angle }); } DeleteableShips = true; DeleteFlag = true; if (DeleteFlagSet != null) { DeleteFlagSet(this); } }
//消滅 public override void Vanish() { //ボールエフェクト生成 for (int i = 0; i < 4; i++) { //消滅フレーム数 int timer = Random.Range(30, 50); //反対方向に飛ばす float dir = Direction - 180 + Random.Range(-60, 60); float spd = Random.Range(1.0f, 1.5f); Particle p = Particle.Add(Particle.eType.Ball, timer, X, Y, dir, spd); if (p) { //大きさ p.Scale = 0.8f; //赤色を設定 p.SetColor(1.0f, 0.0f, 0.0f); } } //親の消滅処理を呼び出す base.Vanish(); }
/// 衝突判定 void OnTriggerEnter2D(Collider2D other) { string name = LayerMask.LayerToName(other.gameObject.layer); switch (name) { case "Enemy": case "Bullet": // ゲームオーバー Vanish(); // パーティクル生成 for (int i = 0; i < 8; i++) { Particle.Add(X, Y); } // やられSE再生 Sound.PlaySe("damage"); // BGMを止める Sound.StopBgm(); break; } }
/// 消滅 public override void Vanish() { // パーティクル生成 // リングエフェクト生成 { // 生存時間は30フレーム。移動はしない Particle p = Particle.Add(Particle.eType.Ring, 30, X, Y, 0, 0); if (p) { // 明るい緑 p.SetColor(0.7f, 1, 0.7f); } } // ボールエフェクト生成 float dir = Random.Range(35, 55); for (int i = 0; i < 8; i++) { // 消滅フレーム数 int timer = Random.Range(20, 40); // 移動速度 float spd = Random.Range(0.5f, 2.5f); Particle p = Particle.Add(Particle.eType.Ball, timer, X, Y, dir, spd); // 移動方向 dir += Random.Range(35, 55); if (p) { // 緑色を設定 p.SetColor(0.0f, 1, 0.0f); // 大きさを設定 p.Scale = 0.8f; } } // 親の消滅処理を呼び出す base.Vanish(); }
public void Vanish() { Particle.Add(particle, transform.position.x, transform.position.y, 2, -1, Color.red); Destroy(gameObject); }