/// <summary> /// 弾丸とあたっている敵を返すメソッド /// </summary> /// <returns> /// 敵 or null /// </returns> /// <param name='en'> /// 敵 /// </param> /// <param name='bulletlist'> /// 弾丸リスト /// </param> public static Bullet1 EnemyCollisionDetection(Enemy1 en, ArrayList bulletlist) { foreach(Bullet1 bl in bulletlist){ if(en.Sprite.Position.Distance(bl.Sprite.Position) < 50){ return bl; } } return null; }
/// <summary> /// 敵を削除する /// </summary> /// <param name='en'> /// 削除する敵 /// </param> public static void RemoveEnemy(Enemy1 en) { en.Sprite.RemoveAllChildren(true); Scenes.sceneOnGame.RemoveChild(en.Sprite,true); EnemyList.Remove(en); }
/// <summary> /// 新しい敵を作成する /// </summary> /// <returns> /// 作成した敵 /// </returns> /// <param name='textureId'> /// Texture identifier. /// </param> /// <param name='x'> /// 初期位置 /// </param> /// <param name='y'> /// 初期位置 /// </param> /// <param name='bulletType'> /// 攻撃の弾丸タイプ /// </param> /// <param name='attackInterval'> /// Attack interval. /// </param> /// <param name='hp'> /// Hp. /// </param> /// <param name='timeout'> /// 生成してから消えるまでの時間 /// </param> public static Enemy1 MakeNewEnemy(EnemyType textureId, float x, float y,BulletType bulletType, int attackInterval, int hp, float timeout) { var newEnemy = new Enemy1(x,y, bulletType, attackInterval,hp,timeout); newEnemy.Sprite = new SpriteUV(){TextureInfo = TextureInfo[(int)textureId]}; newEnemy.Sprite.Quad.S = TextureInfo[(int)textureId].TextureSizef; newEnemy.Sprite.CenterSprite(); newEnemy.Sprite.Position = new Sce.PlayStation.Core.Vector2(x,y); EnemyList.Add(newEnemy); Scenes.sceneOnGame.AddChild(((Enemy1)EnemyList[EnemyList.Count-1]).Sprite); return ((Enemy1)EnemyList[EnemyList.Count-1]); }