示例#1
0
 void Start()
 {
     gameManager = GameObject.FindGameObjectWithTag("GameController").GetComponent <GameManager>();
     player      = GameObject.FindGameObjectWithTag("Player").GetComponentInChildren <FirstPersonGunController>();
     ScifiGun    = player.ScifiGun;
     rb          = GetComponent <Rigidbody>();
     rb.velocity = transform.forward.normalized * speed;
 }
 // Start is called before the first frame update
 void Start()
 {
     player      = GameObject.FindGameObjectWithTag("Player").GetComponentInChildren <FirstPersonGunController>();
     weaponBox   = GameObject.FindGameObjectWithTag("WeaponBox").GetComponentInChildren <WeaponBoxController>();
     discription = GameObject.Find("Discription").GetComponent <Text>();
     if (weaponBox.choosedIndex == 0)
     {
         M4A1 = player.M4A1;
     }
     if (weaponBox.choosedIndex == 1)
     {
         LMG = player.LMG;
     }
     if (weaponBox.choosedIndex == 2)
     {
         ScifiGun = player.ScifiGun;
     }
     audioSource = GetComponent <AudioSource>();
 }