public GameObject SpawnBullet(JDBullet bullet) { GameObject loadedBullet = (GameObject)Instantiate(Resources.Load(bullet.ResourceName), this.Position, this.Rotation); FallingBullet loadedBulletScript = loadedBullet.GetComponent<FallingBullet>(); if (loadedBulletScript != null) { loadedBulletScript.BulletReference = bullet; } return loadedBullet; }
public BulletActionEventArgs(Position2D point, JDBullet bulletSpawned) { this.point = point; this.bulletSpawned = bulletSpawned; }
public void DestroyBullet(JDBullet bulletReference) { if (this.BulletCollection.Contains(bulletReference)) { bulletReference.ReportStatistics(JDIStatTypes.INDIVIDUALS, 1); this.BulletCollection.Remove(bulletReference); } }
private void QueueBulletInSpawner(JDBullet bullet, Position2D point) { BulletSpawner spawner = GetBulletSpawner(point.X); GameObject fallingBullet = spawner.SpawnBullet(bullet); FallingBullet group = this.GetBulletGroup(bullet); if (group != null) { fallingBullet.transform.parent = group.gameObject.transform; } FallingBullet fallingBulletScript = fallingBullet.GetComponent<FallingBullet>(); if (fallingBulletScript != null) { fallingBulletScript.MySpawner = spawner; this.AllBullets.Add(fallingBulletScript); } toSpawn.Enqueue(fallingBullet); }
private FallingBullet GetBulletGroup(JDBullet bulletType) { FallingBullet group = null; for (int i = 0; i < bulletGroups.Count; ++i) { if ((bulletGroups[i].BulletReference != null && bulletGroups[i].BulletReference.Name == bulletType.Name) || bulletGroups[i].ManualName == bulletType.Name) { group = bulletGroups[i]; break; } } return group; }
private bool DropBullet(JDBullet bullet) { FallingBullet b = this.AllBullets.Find(fb => bullet == fb.BulletReference); if (b != null) { this.AllBullets.Remove(b); this.toDrop.Add(b); return true; } return false; }
public Position2D GetBulletPosition(JDBullet bullet) { Position2D position = new Position2D(); StepThroughGrid( (i, j) => { if (grid[i, j] == bullet) { position.X = j; position.Y = i; } }); return position; }