Exemple #1
0
        public GunBase InstantiateGun(int ID)
        {
            GunInfo    gunInfo = GameController.GetGun(ID);
            GameObject go      = Instantiate(gunInfo.viewmodel) as GameObject;

            go.name = string.Format("VM_{0}", gunInfo.Name);

            go.transform.SetParent(mainGunsScript.transform, false);
            go.transform.localPosition = Vector3.zero;
            go.transform.localRotation = Quaternion.identity;
            go.transform.localScale    = Vector3.one;

            GunBase gun = go.GetComponent <GunBase>();

            gun.info = gunInfo;
            gun.main = mainGunsScript;

            CharacterCustomization customization = go.GetComponent <CharacterCustomization>();

            customization.StartUp();

            return(gun);
        }
Exemple #2
0
        public WorldModelGun InstantiateGun(int ID)
        {
            GunInfo    gunInfo = GameController.GetGun(ID);
            GameObject go      = Instantiate(gunInfo.worldmodel) as GameObject;

            go.name = string.Format("WM_{0}", gunInfo.Name);

            go.transform.SetParent(gunsParent.transform, false);
            go.transform.localPosition = Vector3.zero;
            go.transform.localRotation = Quaternion.identity;
            go.transform.localScale    = Vector3.one;

            WorldModelGun gun = go.GetComponent <WorldModelGun>();

            gun.info = gunInfo;
            gun.leftArmCharacterJoint.connectedBody  = torsoRigidbody;
            gun.rightArmCharacterJoint.connectedBody = torsoRigidbody;

            CharacterCustomization customization = go.GetComponent <CharacterCustomization>();

            customization.StartUp();

            return(gun);
        }