コード例 #1
0
        public void Shoot(Transform gunTip)
        {
            if (isLookingToTheRight)
            {
                StartCoroutine(shooter.ShootBullets(Vector2.right, controller.GetPlayerHealthSystem().transform.position));
            }
            else
            {
                StartCoroutine(shooter.ShootBullets(Vector2.left, controller.GetPlayerHealthSystem().transform.position));
            }

            /*
             * var bullet = Instantiate(weaponBeingHeld.GetBulletPrefab(), gunTip.position, Quaternion.identity, gameObject.transform);
             * if (!(bullet is AOEBullet))
             * {
             *  bullet.gameObject.layer = (int)DefinedLayers.EnemyBullets;
             *  bullet.gameObject.AddComponent<EnemyBullet>();
             * }
             * else
             * {
             *  var bulletType = bullet.GetComponent<TypeOfBullet>();
             *  bulletType.SetDamage(weaponBeingHeld.GetBulletDamage());
             *  bulletType.SetSpeed(5);
             *
             * }
             * bullet.SetTarget(GameManager.instance.GetPlayerReference().transform.position);
             */
        }
コード例 #2
0
 void Shoot()
 {
     if (Input.GetMouseButton(0))
     {
         bulletSpawner.ShootBullets();
     }
 }