void Mod_Weapon(GameObject target) { if (target.GetComponent <vShooterWeapon>()) { vShooterWeapon org = target.GetComponent <vShooterWeapon>(); target.AddComponent <PUN_ShooterWeapon>(); PUN_Helpers.CopyComponentTo(org, target.GetComponent <PUN_ShooterWeapon>()); DestroyImmediate(org, true); // ------------------------------------------- // } }
void Setup_MeleeManager(GameObject prefab) { if (prefab.GetComponent <vMeleeManager>()) { vMeleeManager org = prefab.GetComponent <vMeleeManager>(); if (!prefab.GetComponent <PUN_MeleeManager>()) { prefab.AddComponent <PUN_MeleeManager>(); PUN_MeleeManager newComp = prefab.GetComponent <PUN_MeleeManager>(); PUN_Helpers.CopyComponentTo(org, newComp); DestroyImmediate(prefab.GetComponent <vMeleeManager>()); } } }
void Setup_GenericAction(GameObject prefab) { if (prefab.GetComponent <vGenericAction>() || prefab.GetComponent <PUN_GenericAction>()) { vGenericAction org = prefab.GetComponent <vGenericAction>(); if (!prefab.GetComponent <PUN_GenericAction>()) { prefab.AddComponent <PUN_GenericAction>(); PUN_GenericAction newComp = prefab.GetComponent <PUN_GenericAction>(); PUN_Helpers.CopyComponentTo(org, newComp); } prefab.GetComponent <PUN_GenericAction>().enabled = false; } }
void Setup_ShooterMeleeInput(GameObject prefab) { if (prefab.GetComponent <vShooterMeleeInput>() || prefab.GetComponent <PUN_ShooterMeleeInput>()) { vShooterMeleeInput org = prefab.GetComponent <vShooterMeleeInput>(); if (!prefab.GetComponent <PUN_ShooterMeleeInput>()) { prefab.AddComponent <PUN_ShooterMeleeInput>(); PUN_ShooterMeleeInput newComp = prefab.GetComponent <PUN_ShooterMeleeInput>(); PUN_Helpers.CopyComponentTo(org, newComp); } prefab.GetComponent <PUN_ShooterMeleeInput>().enabled = false; } }
void Setup_ThirdPersonController(GameObject prefab) { if (prefab.GetComponent <vThirdPersonController>() || prefab.GetComponent <PUN_ThirdPersonController>()) { vThirdPersonController org = prefab.GetComponent <vThirdPersonController>(); if (!prefab.GetComponent <PUN_ThirdPersonController>()) { prefab.AddComponent <PUN_ThirdPersonController>(); PUN_ThirdPersonController newComp = prefab.GetComponent <PUN_ThirdPersonController>(); PUN_Helpers.CopyComponentTo(org, newComp); } prefab.GetComponent <PUN_ThirdPersonController>().enabled = true; prefab.GetComponent <PUN_ThirdPersonController>().useInstance = false; } }
private void PUN_ConvertControlAimCanvas(GameObject obj) { if (obj.GetComponent <vControlAimCanvas>() || obj.GetComponent <PUN_ControlAimCanvas>()) { vControlAimCanvas org = obj.GetComponent <vControlAimCanvas>(); if (!obj.GetComponent <PUN_ControlAimCanvas>()) { obj.AddComponent <PUN_ControlAimCanvas>(); PUN_ControlAimCanvas newComp = obj.GetComponent <PUN_ControlAimCanvas>(); PUN_Helpers.CopyComponentTo(org, newComp); DestroyImmediate(org); } obj.GetComponent <PUN_ControlAimCanvas>().enabled = true; modified.Add(obj); } }
void Setup_WeaponHolders(GameObject prefab) { vWeaponHolder[] holders = prefab.GetComponentsInChildren <vWeaponHolder>(); List <vWeaponHolder> PUN_holders = new List <vWeaponHolder>(); foreach (vWeaponHolder holder in holders) { GameObject holderGO = holder.gameObject; holderGO.AddComponent <PUN_WeaponHolder>(); PUN_WeaponHolder newComp = holderGO.GetComponent <PUN_WeaponHolder>(); PUN_Helpers.CopyComponentTo(holder, newComp); DestroyImmediate(holder); PUN_holders.Add(newComp); } if (prefab.GetComponent <vWeaponHolderManager>()) { prefab.GetComponent <vWeaponHolderManager>().holders = PUN_holders.ToArray(); } }