public override void Save(GameObject obj) { GunBase g = obj.GetComponent <GunBase> (); this.gunName = g.gunName; this.reloadDelay = g.reloadDelay; this.primaryFireCooldown = g.primaryFireCooldown; this.secondaryFireCooldown = g.secondaryFireCooldown; this.maxAmmo = g.maxAmmo; this.curAmmo = g.curAmmo; this.magSize = g.magSize; this.ammo = g.ammo; this.primaryFireAmmoCost = g.primaryFireAmmoCost; this.secondaryFireAmmoCost = g.secondaryFireAmmoCost; this.switchBusyTime = g.switchBusyTime; this.busy = g.busy; this.reloading = g.reloading; this.autoReload = g.autoReload; this.autoFire = g.autoFire; this.equipped = g.equipped; this.rot = g.transform.rotation; this.pos = g.transform.position; this.layer = g.gameObject.layer; /*switch (g.GetType ()) { // C# doesn't support switches on types :v * case RocketLauncher: * type = GunType.RocketLauncher; * break; * case TractorGrapple: * type = GunType.TractorGrapple; * break; * case RecoilGun: * type = GunType.RecoilGun; * }*/ if (g.GetType() == typeof(RocketLauncher)) { type = GunType.RocketLauncher; } else if (g.GetType() == typeof(TractorGrapple)) { type = GunType.TractorGrapple; } else if (g.GetType() == typeof(RecoilGun)) { type = GunType.RecoilGun; } }