void Start() { var defaultPickupInstance = Instantiate(DefaultWeaponPickup); DefaultWeaponUpgradePath = defaultPickupInstance.weaponUpgradePathInitial(); Destroy(defaultPickupInstance.gameObject); AttachWeapon(defaultWeaponPrefab, DefaultWeaponUpgradePath); }
public void AttachWeapon(Weapon weaponPrefab, WeaponUpgradePath upgradePath) { var weaponInstance = Instantiate(weaponPrefab, transform); weaponInstance.bulletColor = settings.color; weaponInstance.PlayerNumber = settings.playerNumber; if (activeWeaponInstance != null) { Destroy(activeWeaponInstance.gameObject); } activeWeaponInstance = weaponInstance; ActiveWeaponUpgradePath = upgradePath; AFEventManager.INSTANCE.PostEvent(AFEvents.WeaponUpgrade( settings.playerNumber, upgradePath.UpgradeProgress, upgradePath.UpgradeColor )); }