Beispiel #1
0
    public void Shot(GameObject bulletPrefab)
    {
        GameObject       bullet   = Instantiate(bulletPrefab, transform.position, transform.rotation) as GameObject;
        Rigidbody        bulletRb = bullet.GetComponent <Rigidbody>();
        BulletController bc       = bullet.GetComponent <BulletController>();

        bc.SetShooter(this.gameObject);
        bc.SetShooterTank(this.transform.parent.transform.parent.gameObject);
        bulletRb.AddForce(transform.forward * bc.getBulletSpeed() * shotSpeedMagni);
        SEManager.PlayShotBulletSound();
        tm.SetAbleMove(false);

        bulletText.text = (ableBeBulletNum - bulletNum).ToString();
        StartCoroutine(DelayMethod(0.2f, () =>
        {
            tm.SetAbleMove(true);
        }));
    }