コード例 #1
0
ファイル: PowerUp.cs プロジェクト: luqui/space-shooter
 public override void Collision(Actor other)
 {
     PlayerShip ship = other as PlayerShip;
     if (ship != null)
     {
         dead = true;
         action(ship);
     }
 }
コード例 #2
0
ファイル: Actor.cs プロジェクト: luqui/space-shooter
 public virtual void Collision(Actor other)
 {
 }
コード例 #3
0
ファイル: Component.cs プロジェクト: luqui/space-shooter
        public override void OnHit(Actor other)
        {
            Bullet bullet = other as Bullet;
            if (bullet == null || bullet.Dead) return;

            bullet.Die();
            hitPoints--;
            if (hitPoints <= 0)
            {
                self.Die();
            }

            if (bullet is PrismBullet)
            {
                Vector2 v = bullet.Velocity;
                Vector2 vn = v; vn.Normalize();
                PrismBullet a = new PrismBullet(bullet.Position + new Vector2(vn.X, vn.Y), new Vector2(v.X, v.Y), bullet.Color);
                PrismBullet b = new PrismBullet(bullet.Position + new Vector2(-vn.Y, vn.X), new Vector2(-v.Y, v.X), bullet.Color);
                PrismBullet c = new PrismBullet(bullet.Position + new Vector2(vn.Y, -vn.X), new Vector2(v.Y, -v.X), bullet.Color);
                PrismBullet d = new PrismBullet(bullet.Position + new Vector2(-vn.X, -vn.Y), new Vector2(-v.X, -v.Y), bullet.Color);
                Util.Actors.Add(a);
                Util.Actors.Add(b);
                Util.Actors.Add(c);
                Util.Actors.Add(d);
            }
        }
コード例 #4
0
ファイル: Component.cs プロジェクト: luqui/space-shooter
 public override void OnHit(Actor other)
 {
     Bullet bullet = other as Bullet;
     if (bullet == null || bullet.Dead) return;
     bullet.Die();
     self.Die();
 }
コード例 #5
0
ファイル: Component.cs プロジェクト: luqui/space-shooter
 public override void OnHit(Actor other)
 {
     Enemy enemy = other as Enemy;
     if (enemy != null && enemy.Damage is MineDamage) return;
     self.Die();
 }
コード例 #6
0
ファイル: Component.cs プロジェクト: luqui/space-shooter
 public abstract void OnHit(Actor other);
コード例 #7
0
ファイル: PlayerShip.cs プロジェクト: luqui/space-shooter
        public override void Collision(Actor other)
        {
            Bullet b = other as Bullet;
            if (b != null) {
                b.Die();
                if (Util.MODE == Util.Mode.TwoPlayer)
                {
                    Util.GetPlayer(Util.OtherPlayer(player)).Equip("Empty", 1);
                }
            }

            Enemy e = other as Enemy;
            if (e != null && e.fadeIn <= 0)
            {
                if (immunity > 0) e.Die();
                else
                {
                    Die();
                    Util.Actors.Add(new ProxyEnemy(e));
                }
            }
        }