コード例 #1
0
ファイル: BulletSpawner.cs プロジェクト: jmdjr/jd-bacon
    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;
    }
コード例 #2
0
ファイル: EventDelegates.cs プロジェクト: jmdjr/jd-bacon
 public BulletActionEventArgs(Position2D point, JDBullet bulletSpawned)
 {
     this.point = point;
     this.bulletSpawned = bulletSpawned;
 }
コード例 #3
0
ファイル: BulletFactory.cs プロジェクト: jmdjr/jd-bacon
 public void DestroyBullet(JDBullet bulletReference)
 {
     if (this.BulletCollection.Contains(bulletReference))
     {
         bulletReference.ReportStatistics(JDIStatTypes.INDIVIDUALS, 1);
         this.BulletCollection.Remove(bulletReference);
     }
 }
コード例 #4
0
ファイル: Frame.cs プロジェクト: jmdjr/jd-bacon
    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);
    }
コード例 #5
0
ファイル: Frame.cs プロジェクト: jmdjr/jd-bacon
    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;
    }
コード例 #6
0
ファイル: Frame.cs プロジェクト: jmdjr/jd-bacon
    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;
    }
コード例 #7
0
ファイル: BulletMatrix.cs プロジェクト: jmdjr/jd-bacon
    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;
    }