예제 #1
0
    // Use this for initialization
    void Start()
    {
        currentResetIntervalCount = 0;
        maxGunChangeCount         = gunsStatus.getChangeWeaponTime;
        currentGunChangeCount     = maxGunChangeCount;
        audioSource = gameObject.GetComponent <AudioSource>();
        bulletDangerText.SetActive(false);

        guns = new BaseGun[NUM_GUN_TYPE];

        guns[0] = new HandGun();
        guns[1] = new SubmachineGun();
        guns[2] = new ShotGun();

        for (int i = 0; i < NUM_GUN_TYPE; i++)
        {
            guns[i].setGunStatus(gunsStatus.getGunsStatus[i]);
            guns[i].baseInit(i, gunImages[i], bullet, gunSound[i]);
            guns[i].init();
        }

        //ハンドガンに持ちかえる
        currentGunIndex = 0;
        chaneGunType(0);
        //audioSource.clip = gunSE;
    }
예제 #2
0
 public void SpawnWeapon()
 {
     //if our parameters exist spawn a weapon on our socket depending on the type of the weapon
     if (m_AssaultGunTemplate && m_ShotGunTemplate && m_SubMachineGunTemplate && m_PrimarySocket)
     {
         if (m_WhichWeapon == Weapon.Shotgun)
         {
             var gunObject = Instantiate(m_ShotGunTemplate, m_PrimarySocket.transform, true);
             gunObject.transform.localPosition = Vector3.zero;
             gunObject.transform.localRotation = Quaternion.identity;
             m_ShotGun = gunObject.GetComponent <ShotGun>();
         }
         if (m_WhichWeapon == Weapon.assaultGun)
         {
             var gunObject = Instantiate(m_AssaultGunTemplate, m_PrimarySocket.transform, true);
             gunObject.transform.localPosition = Vector3.zero;
             gunObject.transform.localRotation = Quaternion.identity;
             m_AssaultGun   = gunObject.GetComponent <AssaultGun>();
             m_IsAssaultGun = true;
         }
         if (m_WhichWeapon == Weapon.SMG)
         {
             var gunObject = Instantiate(m_SubMachineGunTemplate, m_PrimarySocket.transform, true);
             gunObject.transform.localPosition = Vector3.zero;
             gunObject.transform.localRotation = Quaternion.identity;
             m_SubmachineGun = gunObject.GetComponent <SubmachineGun>();
         }
     }
 }