Esempio n. 1
0
        public void checkFire()
        {
            if (InputManager.IsMouseDown())
            {
                BulletPoolObject3d g = BulletPoolObject3d.Initialize();

                g.transform.LocalPosition = transform.LocalPosition;

                (g.GetBehavior <Bullet3d>() as Bullet3d).Init(bulletMesh, bulletSpeed, transform.Right, Vector3.One, Color.White, false);


                GameConstants.score -= GameConstants.ShotPenalty;
                // sound
                MainGameScreen.soundInstance = MainGameScreen.gunSound.CreateInstance();
                MainGameScreen.soundInstance.Play();
            }
        }
Esempio n. 2
0
        new public static BulletPoolObject3d Initialize()
        {
            BulletPoolObject3d g;

            if (pool.Count > 0)
            {
                g = pool.FirstOrDefault();
                pool.Remove(g);
            }
            else
            {
                g = new BulletPoolObject3d();
            }

            activeGameObjects.Add(g);

            return(g);
        }