void OnGUI() { GUILayout.Label("RGB to Hex:", EditorStyles.boldLabel); colorToConvert = EditorGUILayout.ColorField("RGB Color:", colorToConvert); outputRgbHex = DarkRef.RGBtoHex(colorToConvert); if (colorToConvert != oldColor) { EditorPrefs.SetFloat("ColConvertR", colorToConvert.r); EditorPrefs.SetFloat("ColConvertG", colorToConvert.g); EditorPrefs.SetFloat("ColConvertB", colorToConvert.b); oldColor = colorToConvert; } EditorGUILayout.TextField("Hex Code:", outputRgbHex); DarkRef.GUISeparator(); GUILayout.Label("Hex to RGB:", EditorStyles.boldLabel); inputHexRgb = inputHexRgb.Substring(0, Mathf.Min(inputHexRgb.Length, 6)); inputHexRgb = EditorGUILayout.TextField("Hex Code:", inputHexRgb); EditorGUILayout.ColorField("RGB Color:", DarkRef.HexToRGB(inputHexRgb)); }
public override void OnInspectorGUI() { MultiplayerMenu mpMenu = target as MultiplayerMenu; mpMenu.gameNameInput = (UIInput)EditorGUILayout.ObjectField("Game Name Input:", mpMenu.gameNameInput, typeof(UIInput), true); mpMenu.IPInput = (UIInput)EditorGUILayout.ObjectField("IP Input:", mpMenu.IPInput, typeof(UIInput), true); mpMenu.portInput = (UIInput)EditorGUILayout.ObjectField("Port Input:", mpMenu.portInput, typeof(UIInput), true); mpMenu.portForwardCheckbox = (UIToggle)EditorGUILayout.ObjectField("Port Forward Toggle:", mpMenu.portForwardCheckbox, typeof(UIToggle), true); mpMenu.hostPortInput = (UIInput)EditorGUILayout.ObjectField("Host Port Input:", mpMenu.hostPortInput, typeof(UIInput), true); mpMenu.hostLocalCheckbox = (UIToggle)EditorGUILayout.ObjectField("Host Local Toggle:", mpMenu.hostLocalCheckbox, typeof(UIToggle), true); mpMenu.maxPlayerSlider = (SliderAction)EditorGUILayout.ObjectField("Max Player Slider:", mpMenu.maxPlayerSlider, typeof(SliderAction), true); mpMenu.gameDurationSlider = (SliderAction)EditorGUILayout.ObjectField("Game Duration Slider:", mpMenu.gameDurationSlider, typeof(SliderAction), true); mpMenu.mapSelection = (GameObject)EditorGUILayout.ObjectField("Map Selection:", mpMenu.mapSelection, typeof(GameObject), true); DarkRef.GUISeparator(5); if (mpMenu.cachedNetworking == null) { mpMenu.cachedNetworking = (GameObject)EditorGUILayout.ObjectField("Cached Networking:", mpMenu.cachedNetworking, typeof(GameObject), true); DarkRef.GUISeparator(5); } EditorGUILayout.LabelField("HOST SERVER MENU", EditorStyles.boldLabel); EditorGUI.indentLevel += 1; EditorGUIUtility.labelWidth = 140f; mpMenu.mapSelectionBox = (UISprite)EditorGUILayout.ObjectField("Map Selection Box:", mpMenu.mapSelectionBox, typeof(UISprite), true); mpMenu.sliderStart = (Transform)EditorGUILayout.ObjectField("Selection Start:", mpMenu.sliderStart, typeof(Transform), true); mpMenu.mapSpacing = EditorGUILayout.FloatField("Selection Spacing:", mpMenu.mapSpacing); GUILayout.Space(5f); mpMenu.backButton = (GameObject)EditorGUILayout.ObjectField("Back Button:", mpMenu.backButton, typeof(GameObject), true); mpMenu.hostServerButton = (UIButton)EditorGUILayout.ObjectField("Host Server Button:", mpMenu.hostServerButton, typeof(UIButton), true); mpMenu.editServerButton = (UIButton)EditorGUILayout.ObjectField("Edit Server Button:", mpMenu.editServerButton, typeof(UIButton), true); mpMenu.moreInfoButton = (UIButton)EditorGUILayout.ObjectField("More Info Button:", mpMenu.moreInfoButton, typeof(UIButton), true); EditorGUI.indentLevel -= 1; EditorGUIUtility.LookLikeControls(); DarkRef.GUISeparator(5); mpMenu.mServerStatus = (UILabel)EditorGUILayout.ObjectField("Server Status:", mpMenu.mServerStatus, typeof(UILabel), true); mpMenu.mServerPing = (UILabel)EditorGUILayout.ObjectField("Server Ping:", mpMenu.mServerPing, typeof(UILabel), true); mpMenu.mCheckingIcon = (UISprite)EditorGUILayout.ObjectField("Checking Icon:", mpMenu.mCheckingIcon, typeof(UISprite), true); mpMenu.mServerPingButton = (UIButton)EditorGUILayout.ObjectField("Ping Button:", mpMenu.mServerPingButton, typeof(UIButton), true); mpMenu.mSettingControl = (GM_SettingsControl)EditorGUILayout.ObjectField("Settings Control:", mpMenu.mSettingControl, typeof(GM_SettingsControl), true); if (GUI.changed) { EditorUtility.SetDirty(mpMenu); } }
public override void OnInspectorGUI() { DecalObject dObj = (DecalObject)target; EditorGUIUtility.LookLikeControls(140f); GUILayout.Space(5f); dObj.material = (Material)EditorGUILayout.ObjectField("Material:", dObj.material, typeof(Material)); GUILayout.Space(5f); DarkRef.GUISeparator(); EditorGUILayout.LabelField("Sprite List:"); if (dObj.material != null && dObj.material.mainTexture != null) { dObj.curSprite = DrawSpriteList(dObj.curSprite, dObj.material.mainTexture); if (dObj.curSprite != null && dObj.curSprite.texture != dObj.material.mainTexture) { dObj.curSprite = null; } } DarkRef.GUISeparator(); GUILayout.Space(10f); dObj.maxAngle = EditorGUILayout.Slider("Max Angle:", dObj.maxAngle, 1f, 90f); dObj.pushOffset = EditorGUILayout.FloatField("Push Offset:", Mathf.Max(0f, dObj.pushOffset)); dObj.layersToAffect = LayerMaskField("Layers To Affect:", dObj.layersToAffect); dObj.optimized = EditorGUILayout.Toggle("Optimized Projection:", dObj.optimized); GUILayout.Space(10f); EditorGUILayout.ObjectField("Target Object:", dObj.targetObject, typeof(GameObject)); EditorGUILayout.FloatField("Projection Depth:", dObj.transform.lossyScale.z); GUILayout.Space(10f); EditorGUILayout.HelpBox("CTRL + Click to drag the reposition the decal on a surface", MessageType.None); EditorGUILayout.HelpBox("Z and X to decrease/increase decal dimensions", MessageType.None); if (GUI.changed) { EditorUtility.SetDirty(dObj); dObj.UpdateDecalMesh(); } }
public override void OnInspectorGUI() { Limb lb = target as Limb; if (lb.rootStats != null) { lb.limbType = (Limb.LimbType)EditorGUILayout.EnumPopup("Limb Type:", lb.limbType); } lb.rootStats = (BaseStats)EditorGUILayout.ObjectField("Root Stats:", lb.rootStats, typeof(BaseStats), true); if (lb.rootStats == null) { GUILayout.Box("Please assign a BaseStats component to 'Root Stats' in order to continue"); } if (lb.rootStats != null) { DarkRef.GUISeparator(5f); lb.overrideMultiplier = EditorGUILayout.Toggle("Override:", lb.overrideMultiplier); EditorGUI.indentLevel += 1; if (lb.overrideMultiplier) { EditorGUIUtility.labelWidth = 200f; lb.damageMultOverride = EditorGUILayout.FloatField("Damage Multiplier:", Mathf.Clamp(lb.damageMultOverride, 0f, 10f)); EditorGUIUtility.LookLikeControls(); } else { float readDisplayThing = 0f; if (lb.limbType == Limb.LimbType.Head) { lb.damageMultOverride = 4f; readDisplayThing = 4f; } else if (lb.limbType == Limb.LimbType.Chest) { lb.damageMultOverride = 1f; readDisplayThing = 1f; } else { lb.damageMultOverride = 0.7f; readDisplayThing = 0.7f; } EditorGUIUtility.labelWidth = 200f; GUI.color = Color.gray; readDisplayThing = EditorGUILayout.FloatField("Damage Multiplier:", readDisplayThing); GUI.color = Color.white; EditorGUIUtility.LookLikeControls(); } EditorGUI.indentLevel -= 1; } GUI.color = Color.red; if (lb.GetComponent <BaseStats>()) { GUILayout.Box("NOTE: This component is assigned to an object that already have BaseStats. Are you sure this is correct?"); } if (!lb.GetComponent <Collider>()) { GUILayout.Box("WARNING: This component is assigned to an object without a collider! You must have a collider in order for this to work!"); } if (GUI.changed) { EditorUtility.SetDirty(lb); } }
public override void OnInspectorGUI() { gcScript = target as GunController; GUILayout.Space(10); if (gcScript.firePos == null) { GUILayout.Box("IMPORTANT! Assign a fire position before continuing!"); } gcScript.firePos = (Transform)EditorGUILayout.ObjectField("Fire Position:", gcScript.firePos, typeof(Transform), true); if (gcScript.firePos == null) { return; } gcScript.leftHandTransform = (Transform)EditorGUILayout.ObjectField("Left Hand:", gcScript.leftHandTransform, typeof(Transform), true); GUILayout.Space(5); if (GUILayout.Button("Convert To Pickup")) { PrefabUtility.DisconnectPrefabInstance(gcScript.gameObject); GunVisuals gv = gcScript.GetComponent <GunVisuals>(); if (gv) { foreach (GameObject go in gv.activateOnUse) { DestroyImmediate(go); } foreach (GameObject go in gv.deactivateOnUse) { go.SetActive(true); } DestroyImmediate(gcScript.firePos.gameObject); DestroyImmediate(gv); } PistolAnim pa = gcScript.GetComponent <PistolAnim>(); if (pa) { DestroyImmediate(pa); } gcScript.gameObject.AddComponent <Rigidbody>().mass = 3f; UsableObject uo = gcScript.gameObject.AddComponent <UsableObject>(); uo.weaponPickup = new UsableObject.WeaponPickup(); uo.weaponPickup.enabled = true; uo.weaponPickup.ammoAmount = gcScript.currentAmmo; uo.objectName = gcScript.gunName; uo.weaponPickup.weaponID = gcScript.weaponID; gcScript.transform.parent = null; gcScript.transform.name += " (Pickup)"; AntiClipVariables acv = gcScript.GetComponent <AntiClipVariables>(); if (acv) { DestroyImmediate(acv); } DestroyImmediate(gcScript); return; } if (GUILayout.Button("Reset IDs")) { WeaponDatabase.RefreshIDs(); return; } DarkRef.GUISeparator(); if (GUILayout.Button("Set First Person Info")) { GunController toSetFirst = WeaponDatabase.GetWeaponByID(gcScript.weaponID); toSetFirst.firstPersonPosition = gcScript.transform.localPosition; toSetFirst.firstPersonRotation = gcScript.transform.localRotation; gcScript.firstPersonPosition = gcScript.transform.localPosition; gcScript.firstPersonRotation = gcScript.transform.localRotation; } GUILayout.Label("First Person Info:", EditorStyles.boldLabel); GUILayout.Label(" Position: " + DarkRef.PreciseStringVector3(gcScript.firstPersonPosition)); GUILayout.Label(" Rotation: " + gcScript.firstPersonRotation.eulerAngles); DarkRef.GUISeparator(); if (GUILayout.Button("Set Third Person Info")) { GunController toSetThird = WeaponDatabase.GetWeaponByID(gcScript.weaponID); toSetThird.thirdPersonPosition = gcScript.transform.localPosition; toSetThird.thirdPersonRotation = gcScript.transform.localRotation; gcScript.thirdPersonPosition = gcScript.transform.localPosition; gcScript.thirdPersonRotation = gcScript.transform.localRotation; } if ((gcScript.transform.parent != null && gcScript.transform.parent.name == "WeaponsParent") && GUILayout.Button("Pose Transform")) { gcScript.transform.localPosition = gcScript.thirdPersonPosition; gcScript.transform.localRotation = gcScript.thirdPersonRotation; } GUILayout.Label("Third Person Info:", EditorStyles.boldLabel); GUILayout.Label(" Position: " + DarkRef.PreciseStringVector3(gcScript.thirdPersonPosition)); GUILayout.Label(" Rotation: " + gcScript.thirdPersonRotation.eulerAngles); DarkRef.GUISeparator(); GUILayout.Label("GUI Properties", EditorStyles.boldLabel); GUILayout.BeginHorizontal(); GUILayout.Space(20); GUILayout.BeginVertical(); gcScript.iconTexture = (Texture2D)EditorGUILayout.ObjectField("Icon:", gcScript.iconTexture, typeof(Texture2D)); gcScript.iconScale = EditorGUILayout.Vector2Field("Icon Scale:", gcScript.iconScale); gcScript.iconOffset = EditorGUILayout.Vector2Field("Icon Offset:", gcScript.iconOffset); GUILayout.EndVertical(); GUILayout.EndHorizontal(); GUILayout.Space(10); gcScript.gunName = EditorGUILayout.TextField("Weapon Name:", gcScript.gunName); gcScript.weaponSlot = (WeaponSlot)EditorGUILayout.EnumPopup("Weapon Slot:", gcScript.weaponSlot); GUILayout.Space(5); GUILayout.Label("Fire Mode Settings", EditorStyles.boldLabel); GUILayout.BeginHorizontal(); GUILayout.Space(20); GUILayout.BeginVertical(); gcScript.firstMode = (GunController.FireMode)EditorGUILayout.EnumPopup("Fire Mode #1:", gcScript.firstMode); if (gcScript.firstMode != GunController.FireMode.None) { gcScript.firstRPM = EditorGUILayout.FloatField(" Fire Rate (RPM):", gcScript.firstRPM); } gcScript.secondMode = (GunController.FireMode)EditorGUILayout.EnumPopup("Fire Mode #2:", gcScript.secondMode); if (gcScript.secondMode != GunController.FireMode.None) { gcScript.secondRPM = EditorGUILayout.FloatField(" Fire Rate (RPM):", gcScript.secondRPM); GUI.enabled = false; } if (gcScript.secondMode == GunController.FireMode.None) { GUI.enabled = false; gcScript.thirdMode = GunController.FireMode.None; } else { GUI.enabled = true; } gcScript.thirdMode = (GunController.FireMode)EditorGUILayout.EnumPopup("Fire Mode #3:", gcScript.thirdMode); if (gcScript.thirdMode != GunController.FireMode.None && gcScript.secondMode != GunController.FireMode.None) { gcScript.thirdRPM = EditorGUILayout.FloatField(" Fire Rate (RPM):", gcScript.thirdRPM); } GUI.enabled = true; GUILayout.EndVertical(); GUILayout.EndHorizontal(); GUILayout.Space(5); BulletInfo.BulletType bulletType = gcScript.bulletInfo.bulletType; GUILayout.Label((bulletType == BulletInfo.BulletType.Bullet) ? "Bullet Properties" : "Projectile Properties", EditorStyles.boldLabel); GUILayout.BeginHorizontal(); GUILayout.Space(20); GUILayout.BeginVertical(); PoolingList poolList = (PoolingList)Resources.Load("Static Prefabs/PoolingList", typeof(PoolingList)); gcScript.bulletInfo.bulletType = (BulletInfo.BulletType)EditorGUILayout.EnumPopup("Bullet Type:", gcScript.bulletInfo.bulletType); GUI.color = new Color(1f, 0.8f, 0.8f); EditorGUILayout.ObjectField((bulletType == BulletInfo.BulletType.Bullet) ? "Bullet Prefab:" : "Projectile Prefab:", poolList.poolPrefabs[Mathf.Clamp(gcScript.bulletInfo.poolIndex, 0, poolList.poolPrefabs.Length - 1)], typeof(GameObject), true); GUI.color = Color.white; EditorGUI.indentLevel += 1; gcScript.bulletInfo.poolIndex = EditorGUILayout.IntField("Pool Index:", Mathf.Clamp(gcScript.bulletInfo.poolIndex, 0, poolList.poolPrefabs.Length - 1)); EditorGUI.indentLevel -= 1; GUILayout.Space(8f); gcScript.bulletInfo.damage = EditorGUILayout.IntField((bulletType == BulletInfo.BulletType.Rocket) ? "Explosion Damage" : "Damage:", gcScript.bulletInfo.damage); if (bulletType == BulletInfo.BulletType.Rocket) { gcScript.bulletInfo.explosionRadius = EditorGUILayout.FloatField("Explosion Radius:", gcScript.bulletInfo.explosionRadius); } else { gcScript.bulletInfo.force = EditorGUILayout.FloatField("Impact Force:", gcScript.bulletInfo.force); } gcScript.bulletInfo.muzzleVelocity = EditorGUILayout.FloatField("Base Velocity (m/s):", gcScript.bulletInfo.muzzleVelocity); gcScript.bulletInfo.gravityFactor = EditorGUILayout.Slider("Gravity (" + (-Physics.gravity.y * gcScript.bulletInfo.gravityFactor).ToString("F2") + " m/s)", gcScript.bulletInfo.gravityFactor, 0f, 5f); gcScript.bulletInfo.damageFalloff = EditorGUILayout.CurveField("Damage Falloff:", gcScript.bulletInfo.damageFalloff); for (int i = 0; i < gcScript.bulletInfo.damageFalloff.length; i++) { Keyframe modKey = gcScript.bulletInfo.damageFalloff.keys[i]; modKey.time = Mathf.RoundToInt(Mathf.Max(0f, modKey.time)); modKey.value = Mathf.Round(Mathf.Clamp(modKey.value, 0f, 1f) * 100f) / 100f; gcScript.bulletInfo.damageFalloff.MoveKey(i, modKey); } // if(gcScript.bulletInfo.penetrationDistance <= 0f) { gcScript.bulletInfo.ricochetLength = EditorGUILayout.IntField("Ricochet Amount:", Mathf.Max(gcScript.bulletInfo.ricochetLength, 0)); gcScript.bulletInfo.ricochetMaxAngle = EditorGUILayout.FloatField("Ricochet Max Angle:", Mathf.Clamp(gcScript.bulletInfo.ricochetMaxAngle, 0f, 90f)); /* * } * else { * EditorGUILayout.HelpBox("You must disable penetration to enable ricochet", MessageType.Info); * } * * gcScript.bulletInfo.penetrationDistance = EditorGUILayout.FloatField("Penetration Distance: ", Mathf.Clamp(gcScript.bulletInfo.penetrationDistance, 0f, 10000f)); * gcScript.bulletInfo.penetrationDamageReduction = EditorGUILayout.FloatField("Penetration Damage Reduction: ", Mathf.Clamp(gcScript.bulletInfo.penetrationDamageReduction, 0f, 100f)); * gcScript.bulletInfo.penetrationSpeedReduction = EditorGUILayout.FloatField("Penetration Speed Reduction: ", Mathf.Clamp(gcScript.bulletInfo.penetrationSpeedReduction, 0f, 100f)); */ GUILayout.EndVertical(); GUILayout.EndHorizontal(); GUILayout.Space(5); GUILayout.Label("Sound Settings", EditorStyles.boldLabel); GUILayout.BeginHorizontal(); GUILayout.Space(20); GUILayout.BeginVertical(); gcScript.fireSound = (AudioClip)EditorGUILayout.ObjectField("Fire Sound:", gcScript.fireSound, typeof(AudioClip), true); gcScript.emptySound = (AudioClip)EditorGUILayout.ObjectField("Empty Sound:", gcScript.emptySound, typeof(AudioClip), true); string reloadLabel = (gcScript.reloadMethod == GunController.ReloadMethod.Magazine) ? "Reload Sound:" : "Reload Sound (Loop):"; gcScript.reloadSound = (AudioClip)EditorGUILayout.ObjectField(reloadLabel, gcScript.reloadSound, typeof(AudioClip), true); if (gcScript.reloadMethod == GunController.ReloadMethod.Singular) { gcScript.reloadEnd = (AudioClip)EditorGUILayout.ObjectField("Reload End:", gcScript.reloadEnd, typeof(AudioClip), true); } else if (gcScript.reloadMethod == GunController.ReloadMethod.Magazine) { gcScript.reloadSoundEmpty = (AudioClip)EditorGUILayout.ObjectField("Reload Sound (empty):", gcScript.reloadSoundEmpty, typeof(AudioClip), true); } gcScript.switchSound = (AudioClip)EditorGUILayout.ObjectField("Switch Fire Mode:", gcScript.switchSound, typeof(AudioClip), true); GUILayout.EndVertical(); GUILayout.EndHorizontal(); GUILayout.Space(5); GUILayout.Label("Shoot Settings", EditorStyles.boldLabel); GUILayout.BeginHorizontal(); GUILayout.Space(20); GUILayout.BeginVertical(); gcScript.bulletsPerShot = EditorGUILayout.IntSlider("Bullets Per Shot:", gcScript.bulletsPerShot, 1, 50); gcScript.countsAsOneBullet = EditorGUILayout.Toggle("Subtract 1 Bullet:", gcScript.countsAsOneBullet); if (gcScript.firstMode == GunController.FireMode.BurstFire || gcScript.secondMode == GunController.FireMode.BurstFire || gcScript.thirdMode == GunController.FireMode.BurstFire) { gcScript.bulletsPerBurst = EditorGUILayout.IntSlider("Rounds Per Burst:", gcScript.bulletsPerBurst, 2, Mathf.Max(3, gcScript.clipSize)); gcScript.burstInterval = EditorGUILayout.Slider("Burst Interval:", gcScript.burstInterval, 0.01f, 1f); gcScript.burstCooldown = EditorGUILayout.Slider("Burst Cooldown:", gcScript.burstCooldown, 0.01f, 1f); } GUILayout.Space(10); gcScript.muzzleProbability = EditorGUILayout.Slider("Muzzle Probability:", gcScript.muzzleProbability, 0f, 1f); gcScript.muzzleFlash = (ParticleEmitter)EditorGUILayout.ObjectField("Muzzle Flash:", gcScript.muzzleFlash, typeof(ParticleEmitter), true); gcScript.muzzleLight = (Light)EditorGUILayout.ObjectField("Muzzle Light:", gcScript.muzzleLight, typeof(Light), true); EditorGUI.indentLevel += 1; EditorGUIUtility.labelWidth = 140f; gcScript.muzzleSpeed = EditorGUILayout.FloatField("Light Fade Speed:", Mathf.Max(5f, gcScript.muzzleSpeed)); EditorGUIUtility.LookLikeControls(); EditorGUI.indentLevel -= 1; GUILayout.Space(5f); gcScript.shootParticle = (ParticleEmitter)EditorGUILayout.ObjectField("Shoot Smoke:", gcScript.shootParticle, typeof(ParticleEmitter), true); GUILayout.Space(10); gcScript.ejectionEnabled = EditorGUILayout.Toggle("Shell Ejection:", gcScript.ejectionEnabled); if (gcScript.ejectionEnabled) { gcScript.ejectionPos = (Transform)EditorGUILayout.ObjectField(" Ejection Position:", gcScript.ejectionPos, typeof(Transform), true); gcScript.bulletShellIndex = EditorGUILayout.IntField(" Bullet Shell Index:", gcScript.bulletShellIndex); gcScript.ejectionDelay = EditorGUILayout.FloatField(" Ejection Delay:", gcScript.ejectionDelay); gcScript.ejectionMinForce = EditorGUILayout.Vector3Field(" Minimum Force:", gcScript.ejectionMinForce); gcScript.ejectionMaxForce = EditorGUILayout.Vector3Field(" Maximum Force:", gcScript.ejectionMaxForce); gcScript.ejectionRotation = EditorGUILayout.FloatField(" Rotation Force:", gcScript.ejectionRotation); } GUILayout.EndVertical(); GUILayout.EndHorizontal(); GUILayout.Space(5); GUILayout.Label("Ammo Settings", EditorStyles.boldLabel); GUILayout.BeginHorizontal(); GUILayout.Space(20); GUILayout.BeginVertical(); gcScript.currentAmmo = EditorGUILayout.IntSlider("Current Ammo:", gcScript.currentAmmo, 0, gcScript.clipSize); gcScript.clipSize = EditorGUILayout.IntField(" Magazine Size:", gcScript.clipSize); GUILayout.Space(5f); gcScript.ammoLeft = EditorGUILayout.IntSlider("Reserve Ammo:", gcScript.ammoLeft, 0, gcScript.ammoLeftCap); gcScript.ammoLeftCap = EditorGUILayout.IntField(" Reserve Limit:", gcScript.ammoLeftCap); DarkRef.GUISeparator(7f); gcScript.reloadMethod = (GunController.ReloadMethod)EditorGUILayout.EnumPopup("Reload Method:", gcScript.reloadMethod); EditorGUI.indentLevel += 1; EditorGUIUtility.labelWidth = 140f; gcScript.reloadOnMouseClick = EditorGUILayout.Toggle("Reload On Click:", gcScript.reloadOnMouseClick); EditorGUIUtility.LookLikeControls(); if (gcScript.reloadMethod == GunController.ReloadMethod.Magazine) { EditorGUIUtility.labelWidth = 140f; gcScript.reloadLength = EditorGUILayout.FloatField("Reload Duration:", Mathf.Clamp(gcScript.reloadLength, 0f, 30f)); if (gcScript.reloadSoundEmpty != null) { gcScript.reloadLengthEmpty = EditorGUILayout.FloatField(" Empty Duration:", Mathf.Clamp(gcScript.reloadLengthEmpty, 0f, 30f)); } gcScript.includeChamberRound = EditorGUILayout.Toggle("Chamber Round:", gcScript.includeChamberRound); EditorGUIUtility.LookLikeControls(); } else if (gcScript.reloadMethod == GunController.ReloadMethod.Singular) { EditorGUIUtility.labelWidth = 135f; gcScript.reloadDelay = EditorGUILayout.FloatField("Reload Delay:", Mathf.Clamp(gcScript.reloadDelay, 0f, 5f)); gcScript.reloadInterval = EditorGUILayout.FloatField("Reload Interval:", Mathf.Clamp(gcScript.reloadInterval, 0f, 5f)); gcScript.reloadAmount = EditorGUILayout.IntField("Reload Amount:", Mathf.Clamp(gcScript.reloadAmount, 1, gcScript.clipSize)); GUILayout.Box("Reload sound will now loop, make sure that the sound can loop seamlessly."); EditorGUIUtility.LookLikeControls(); } EditorGUI.indentLevel -= 1; GUILayout.EndVertical(); GUILayout.EndHorizontal(); EditorGUIUtility.labelWidth = 165f; GUILayout.Space(5); GUILayout.Label("Aim Settings", EditorStyles.boldLabel); gcScript.sniperAimEffect = EditorGUILayout.Toggle(" Sniper Aim Effect:", gcScript.sniperAimEffect); gcScript.playerSpeedAim = EditorGUILayout.Slider(" Player Speed Aim:", gcScript.playerSpeedAim, 0.1f, 1f); gcScript.mouseSensitivityAim = EditorGUILayout.Slider(" Mouse Sensitivity Aim:", gcScript.mouseSensitivityAim, 0.01f, 1.0f); gcScript.aimPos = EditorGUILayout.Vector3Field(" Aim Position:", gcScript.aimPos); gcScript.aimSpeedFactor = EditorGUILayout.FloatField(" Aim Speed Factor:", gcScript.aimSpeedFactor); gcScript.addZoomFOV = EditorGUILayout.FloatField(" Additional Zoom (FOV):", Mathf.Clamp(gcScript.addZoomFOV, -15f, 75f)); gcScript.aimSwayFactor = EditorGUILayout.Slider(" Sniper Sway Factor:", gcScript.aimSwayFactor, 0f, 5f); GUILayout.Space(5); GUILayout.Label("Crosshair Settings", EditorStyles.boldLabel); gcScript.crosshairsEnabled = EditorGUILayout.Toggle(" Enabled:", gcScript.crosshairsEnabled); GUILayout.Space(5); GUILayout.Label("Accuracy and Recoil Settings", EditorStyles.boldLabel); gcScript.baseSpreadAmount = EditorGUILayout.FloatField(" Base Bullet Spread:", gcScript.baseSpreadAmount); gcScript.spreadSpeed = EditorGUILayout.FloatField(" Bullet Spread Speed:", gcScript.spreadSpeed); gcScript.spreadAimFactor = EditorGUILayout.Slider(" Spread Aim Factor:", gcScript.spreadAimFactor, 0f, 1f); gcScript.recoverSpeed = EditorGUILayout.FloatField(" Recover Spread Speed:", gcScript.recoverSpeed); gcScript.movementSpreadAmount = EditorGUILayout.FloatField(" Movement Spread Amount:", gcScript.movementSpreadAmount); gcScript.maxSpreadAmount = EditorGUILayout.FloatField(" Max Bullet Spread:", gcScript.maxSpreadAmount); gcScript.aimSpreadModifier = EditorGUILayout.Slider(" Aim Spread Mod:", gcScript.aimSpreadModifier, 0f, 1f); gcScript.crouchWalkModifier = EditorGUILayout.Slider(" Crouch/Walk Mod:", gcScript.crouchWalkModifier, 0f, 1f); GUILayout.Space(10); gcScript.recoilAmount = EditorGUILayout.FloatField(" Offset Recoil:", gcScript.recoilAmount); GUILayout.Space(6); gcScript.upKickAmount = EditorGUILayout.FloatField(" Up-kick Amount:", gcScript.upKickAmount); gcScript.autoReturn = EditorGUILayout.FloatField(" Auto Return:", gcScript.autoReturn); GUILayout.Space(5f); gcScript.sideKickAmount = EditorGUILayout.FloatField(" Side-kick Amount:", gcScript.sideKickAmount); gcScript.aimUpkickModifier = EditorGUILayout.Slider(" Aim Kick Modifier:", gcScript.aimUpkickModifier, 0f, 1f); gcScript.crouchUpkickModifier = EditorGUILayout.Slider(" Crouch Kick Modifier:", gcScript.crouchUpkickModifier, 0f, 1f); gcScript.kickInfluence = EditorGUILayout.Vector2Field(" Kick Influence", gcScript.kickInfluence); GUILayout.Space(5); EditorGUIUtility.LookLikeControls(200f); gcScript.extraRecoilThreshold = EditorGUILayout.IntField(" Extra Recoil Threshold:", gcScript.extraRecoilThreshold); gcScript.extraRecoilAmount = EditorGUILayout.FloatField(" Extra Recoil Amount (" + (gcScript.extraRecoilAmount * 100f).ToString() + "%):", Mathf.Max(0f, gcScript.extraRecoilAmount)); gcScript.maxExtraRecoil = EditorGUILayout.FloatField(" Extra Recoil Limit (+" + (gcScript.maxExtraRecoil * 100f).ToString() + "%):", Mathf.Max(0f, gcScript.maxExtraRecoil)); EditorGUIUtility.LookLikeControls(150f); GUILayout.Space(10f); gcScript.kickCameraTilt = EditorGUILayout.FloatField(" Camera Recoil Tilt:", gcScript.kickCameraTilt); gcScript.kickGunTilt = EditorGUILayout.FloatField(" Gun Recoil Tilt:", gcScript.kickGunTilt); gcScript.camShakeAnim = EditorGUILayout.FloatField(" Camera Animation:", gcScript.camShakeAnim); GUILayout.Space(5f); gcScript.kickBackAmount = EditorGUILayout.FloatField(" Kickback Amount:", gcScript.kickBackAmount); gcScript.kickSpeedFactor = EditorGUILayout.FloatField(" Kickback Speed:", gcScript.kickSpeedFactor); gcScript.kickbackAimFactor = EditorGUILayout.Slider(" Kickback Aim Factor:", gcScript.kickbackAimFactor, 0f, 1f); GUILayout.Space(5); GUILayout.Label("Animation Settings", EditorStyles.boldLabel); gcScript.reloadAnim = EditorGUILayout.TextField(" Reload Name:", gcScript.reloadAnim); GUILayout.Space(5); GUILayout.Label("Miscellaneous Settings", EditorStyles.boldLabel); gcScript.flashlight = (Light)EditorGUILayout.ObjectField(" Flashlight:", gcScript.flashlight, typeof(Light), true); gcScript.flashlightClick = (AudioClip)EditorGUILayout.ObjectField(" Flashlight Click:", gcScript.flashlightClick, typeof(AudioClip), true); GUILayout.Space(10f); gcScript.weaponWeight = EditorGUILayout.FloatField(" Weapon Weight (kg):", Mathf.Clamp(gcScript.weaponWeight, 0f, 100f)); gcScript.aimBobFactor = EditorGUILayout.Slider(" Aim Bob Factor:", gcScript.aimBobFactor, 0.01f, 1f); GUILayout.Space(10f); GUILayout.Label(" DoF Settings"); gcScript.dofBlurAmount = EditorGUILayout.FloatField(" Blur Amount:", Mathf.Clamp(gcScript.dofBlurAmount, 0f, 50f)); gcScript.dofBlurDistance = EditorGUILayout.FloatField(" Blur Distance:", Mathf.Clamp(gcScript.dofBlurDistance, 0f, 25f)); gcScript.dofBlurAperture = EditorGUILayout.FloatField(" Blur Aperture:", Mathf.Clamp(gcScript.dofBlurAperture, 0f, 40f)); gcScript.dofBlurFocalSize = EditorGUILayout.FloatField(" Focal Size:", Mathf.Clamp(gcScript.dofBlurFocalSize, 0f, 10f)); gcScript.dofBlendBlur = EditorGUILayout.FloatField(" Blend Blur:", Mathf.Clamp(gcScript.dofBlendBlur, 0f, 50f)); GUILayout.Space(10); gcScript.weaponID = EditorGUILayout.IntField("Weapon ID", Mathf.Clamp(gcScript.weaponID, -1, 2000)); if (GUI.changed) { EditorUtility.SetDirty(gcScript); } }
public override void OnInspectorGUI() { DestroyAfterTime dat = target as DestroyAfterTime; EditorGUILayout.LabelField("General Settings", EditorStyles.boldLabel); EditorGUI.indentLevel += 1; dat.destroyTime = EditorGUILayout.FloatField("Destroy Time:", Mathf.Clamp(dat.destroyTime, 0f, 1000f)); dat.randomness = EditorGUILayout.FloatField("Randomness:", dat.randomness); if (dat.randomness > 0f) { EditorGUILayout.LabelField(" Final Value: [" + dat.destroyTime + " - " + (dat.destroyTime + dat.randomness) + "]"); } else { EditorGUILayout.LabelField(" Final Value: [" + dat.destroyTime + "]"); } EditorGUI.indentLevel -= 1; GUILayout.Space(5f); dat.poolObject = EditorGUILayout.Toggle("Pool Object:", dat.poolObject); DarkRef.GUISeparator(5); dat.fadeOut = EditorGUILayout.Toggle(" Fade Out:", dat.fadeOut); if (dat.fadeOut) { EditorGUI.indentLevel += 1; dat.colorName = EditorGUILayout.TextField("Color Name (Shader)", dat.colorName); dat.fadeSpeed = EditorGUILayout.FloatField("Fade Speed", Mathf.Clamp(dat.fadeSpeed, 0.01f, 15f)); isOpen2 = EditorGUILayout.Foldout(isOpen2, " Renderers"); if (isOpen2) { GUI.color = new Color(1f, 0.5f, 0.2f, 1f); EditorGUI.indentLevel += 1; if (GUILayout.Button("Auto-fill", GUILayout.MaxWidth(80))) { //Could have just used GetComponentInChildren, but it wouldn't work on prefabs. List <Renderer> r = new List <Renderer>(); if (dat.GetComponent <Renderer>()) { r.Add(dat.GetComponent <Renderer>()); } foreach (Transform t in dat.transform) { if (t.GetComponent <Renderer>()) { r.Add(t.GetComponent <Renderer>()); } } dat.renderers = new Renderer[r.Count]; for (int i = 0; i < r.Count; i++) { dat.renderers[i] = r[i]; } } GUI.color = Color.white; int length = dat.renderers.Length; Renderer[] tempStorage = dat.renderers; length = EditorGUILayout.IntField("Length:", length); if (length != dat.renderers.Length) { dat.renderers = new Renderer[length]; for (int i = 0; i < tempStorage.Length; i++) { if (i < dat.renderers.Length) { dat.renderers[i] = tempStorage[i]; } } } EditorGUI.indentLevel += 1; EditorGUIUtility.labelWidth = 110f; for (int i = 0; i < length; i++) { dat.renderers[i] = (Renderer)EditorGUILayout.ObjectField(" Element " + i.ToString(), dat.renderers[i], typeof(Renderer), true); } EditorGUIUtility.LookLikeControls(); EditorGUI.indentLevel -= 1; EditorGUI.indentLevel -= 1; } EditorGUI.indentLevel -= 1; } DarkRef.GUISeparator(); dat.isParticle = EditorGUILayout.Toggle(" Is Particle:", dat.isParticle); if (dat.isParticle) { EditorGUI.indentLevel += 1; isOpen = EditorGUILayout.Foldout(isOpen, " Particle Systems"); if (isOpen) { GUI.color = new Color(1f, 0.5f, 0.2f, 1f); EditorGUI.indentLevel += 1; if (GUILayout.Button("Auto-fill", GUILayout.MaxWidth(80))) { //Could have just used GetComponentInChildren, but it wouldn't work on prefabs. List <ParticleEmitter> pe = new List <ParticleEmitter>(); if (dat.GetComponent <ParticleEmitter>()) { pe.Add(dat.GetComponent <ParticleEmitter>()); } foreach (Transform t in dat.transform) { if (t.GetComponent <ParticleEmitter>()) { pe.Add(t.GetComponent <ParticleEmitter>()); } } dat.emitters = new ParticleEmitter[pe.Count]; for (int i = 0; i < pe.Count; i++) { dat.emitters[i] = pe[i]; } } GUI.color = Color.white; int length = dat.emitters.Length; ParticleEmitter[] tempStorage = dat.emitters; length = EditorGUILayout.IntField("Length:", length); if (length != dat.emitters.Length) { dat.emitters = new ParticleEmitter[length]; for (int i = 0; i < tempStorage.Length; i++) { if (i < dat.emitters.Length) { dat.emitters[i] = tempStorage[i]; } } } EditorGUI.indentLevel += 1; EditorGUIUtility.labelWidth = 110f; for (int i = 0; i < length; i++) { dat.emitters[i] = (ParticleEmitter)EditorGUILayout.ObjectField(" Element " + i.ToString(), dat.emitters[i], typeof(ParticleEmitter), true); } EditorGUIUtility.LookLikeControls(); EditorGUI.indentLevel -= 1; EditorGUI.indentLevel -= 1; } EditorGUI.indentLevel -= 1; } if (GUI.changed) { EditorUtility.SetDirty(dat); } }
public override void OnInspectorGUI() { GrenadeAmmoManager gam = target as GrenadeAmmoManager; GUILayout.Space(5); if (GrenadeDatabase.publicGrenadeControllers.Length <= 0) { GUILayout.Box("You must have at least 1 grenade in the database to enable this manager!"); gam.grenadeTypeOne = -1; gam.grenadeTypeTwo = -1; return; } int typeOneValue = Mathf.Clamp(gam.grenadeTypeOne, -1, GrenadeDatabase.publicGrenadeControllers.Length - 1); EditorGUILayout.LabelField("Grenade Slot #1 (" + ((typeOneValue == -1) ? "None" : GrenadeDatabase.GetGrenadeByID(typeOneValue).name) + ")", EditorStyles.boldLabel); EditorGUI.indentLevel += 1; gam.grenadeTypeOne = EditorGUILayout.IntField("Grenade ID:", typeOneValue); if (gam.grenadeTypeOne == -1) { GUI.enabled = false; } gam.typeOneGrenades = EditorGUILayout.IntSlider(" Grenade Amount:", gam.typeOneGrenades, 0, gam.typeOneMaxGrenades); gam.typeOneMaxGrenades = EditorGUILayout.IntField(" Max Grenades:", gam.typeOneMaxGrenades); GUI.enabled = true; EditorGUI.indentLevel -= 1; DarkRef.GUISeparator(); int typeTwoValue = Mathf.Clamp(gam.grenadeTypeTwo, -1, GrenadeDatabase.publicGrenadeControllers.Length - 1); if (typeTwoValue == typeOneValue && typeOneValue > -1) { if (typeTwoValue < GrenadeDatabase.publicGrenadeControllers.Length - 1) { typeTwoValue++; } else { typeTwoValue--; } } if (GrenadeDatabase.publicGrenadeControllers.Length < 2) { GUILayout.Box("You must have at least 2 grenades in the database in order to enable the second slot!"); GUI.enabled = false; } else { EditorGUILayout.LabelField("Grenade Slot #2 (" + ((typeTwoValue == -1) ? "None" : GrenadeDatabase.GetGrenadeByID(typeTwoValue).name) + ")", EditorStyles.boldLabel); EditorGUI.indentLevel += 1; gam.grenadeTypeTwo = EditorGUILayout.IntField("Grenade ID:", typeTwoValue); if (gam.grenadeTypeTwo == -1) { GUI.enabled = false; } gam.typeTwoGrenades = EditorGUILayout.IntSlider(" Grenade Amount:", gam.typeTwoGrenades, 0, gam.typeTwoMaxGrenades); gam.typeTwoMaxGrenades = EditorGUILayout.IntField(" Max Grenades:", gam.typeTwoMaxGrenades); EditorGUI.indentLevel -= 1; } if (GUI.changed) { EditorUtility.SetDirty(gam); } }
public override void OnInspectorGUI() { GrenadeController gc = target as GrenadeController; GUI.color = new Color(1f, 0.8f, 0.6f, 1f); gc.grenadeName = EditorGUILayout.TextField("Grenade Name:", gc.grenadeName); GUI.color = new Color(0.8f, 0.8f, 0.8f, 1f); EditorGUIUtility.labelWidth = 140f; gc.grenadeIcon = (Texture2D)EditorGUILayout.ObjectField(" Icon Texture:", gc.grenadeIcon, typeof(Texture2D)); EditorGUIUtility.LookLikeControls(); GUI.color = Color.white; GUILayout.Space(10); gc.isDetonatable = EditorGUILayout.Toggle(" Is Detonatable:", gc.isDetonatable); if (gc.isDetonatable) { gc.baseDelay = EditorGUILayout.FloatField(" Initial Delay:", Mathf.Clamp(gc.baseDelay, 0f, 5f)); gc.detonationDelay = EditorGUILayout.FloatField(" Detonation Interval:", Mathf.Clamp(gc.detonationDelay, 0f, 5f)); } GUILayout.Space(10); gc.throwPos = (Transform)EditorGUILayout.ObjectField(" Throw Position:", gc.throwPos, typeof(Transform), true); gc.grenadePrefab = (Rigidbody)EditorGUILayout.ObjectField((gc.isDetonatable) ? " Explosive Prefab:" : " Grenade Prefab:", gc.grenadePrefab, typeof(Rigidbody), true); gc.displayMesh = (MeshRenderer)EditorGUILayout.ObjectField(" Display Mesh:", gc.displayMesh, typeof(MeshRenderer), true); GUILayout.Space(10); EditorGUIUtility.labelWidth = 150f; gc.throwThreshold = EditorGUILayout.FloatField(" Throw Threshold:", Mathf.Clamp(gc.throwThreshold, 0f, 5f)); gc.cookingThreshold = EditorGUILayout.FloatField(" Cooking Threshold:", Mathf.Clamp(gc.cookingThreshold, 0f, 10f)); GUILayout.Space(5); gc.throwStrength = EditorGUILayout.FloatField(" Throw Strength:", Mathf.Clamp(gc.throwStrength, 0f, 1000f)); if (!gc.isDetonatable) { gc.tossStrength = EditorGUILayout.FloatField(" Toss Strength:", Mathf.Clamp(gc.tossStrength, 0f, 1000f)); } EditorGUIUtility.LookLikeControls(); GUILayout.Space(10); EditorGUILayout.LabelField("Sounds", EditorStyles.boldLabel); EditorGUI.indentLevel += 1; gc.pullPinSound = (AudioClip)EditorGUILayout.ObjectField((gc.isDetonatable) ? "Detonation Sound:" : "Pull Pin Sound:", gc.pullPinSound, typeof(AudioClip), true); gc.throwSound = (AudioClip)EditorGUILayout.ObjectField("Throw Sound:", gc.throwSound, typeof(AudioClip), true); EditorGUI.indentLevel -= 1; GUILayout.Space(6); EditorGUILayout.LabelField("Third Person Variables (MP)", EditorStyles.boldLabel); EditorGUI.indentLevel += 1; EditorGUILayout.LabelField("Local Position: " + DarkRef.PreciseStringVector3(gc.thirdPersonPosition)); EditorGUILayout.LabelField("Local Rotation: " + DarkRef.PreciseStringVector3(gc.thirdPersonRotation.eulerAngles)); GUILayout.Space(8f); if (gc.transform.parent != null && gc.transform.parent.name == "WeaponsParent" && GUILayout.Button("Preview Transform Info")) { gc.transform.localPosition = gc.thirdPersonPosition; gc.transform.localRotation = gc.thirdPersonRotation; } if (GUILayout.Button("Set Transform Info")) { GrenadeController prefab = GrenadeDatabase.GetGrenadeByID(gc.grenadeID); prefab.thirdPersonPosition = gc.transform.localPosition; prefab.thirdPersonRotation = gc.transform.localRotation; gc.thirdPersonPosition = gc.transform.localPosition; gc.thirdPersonRotation = gc.transform.localRotation; } EditorGUI.indentLevel -= 1; DarkRef.GUISeparator(8f); GUI.color = new Color(0.7f, 0.7f, 0.7f, 1f); EditorGUIUtility.labelWidth = 210f; EditorGUILayout.IntField("Grenade ID:", gc.grenadeID); EditorGUIUtility.LookLikeControls(); if (GUI.changed) { EditorUtility.SetDirty(gc); } }
public override void OnInspectorGUI() { WeaponManager wm = target as WeaponManager; if (wm.wepList == null) { WeaponList savedWL = (WeaponList)Resources.Load("Static Prefabs/Weapon List", typeof(WeaponList)); if (savedWL) { wm.wepList = savedWL; EditorUtility.SetDirty(wm); } wm.wepList = (WeaponList)EditorGUILayout.ObjectField("Weapon List Prefab:", wm.wepList, typeof(WeaponList), true); EditorGUILayout.HelpBox("Note that leaving this empty will have a HUGE performance impact at the start!", MessageType.Warning); } if (wm.poolList == null) { PoolingList savedPL = (PoolingList)Resources.Load("Static Prefabs/PoolingList", typeof(PoolingList)); if (savedPL) { wm.poolList = savedPL; EditorUtility.SetDirty(wm); } wm.poolList = (PoolingList)EditorGUILayout.ObjectField("Pool List Prefab:", wm.poolList, typeof(PoolingList), true); EditorGUILayout.HelpBox("Note that leaving this empty will have a HUGE performance impact at the start!", MessageType.Warning); } GUILayout.Space(5); EditorGUILayout.LabelField("Starting Weapons", EditorStyles.boldLabel); EditorGUI.indentLevel += 1; int pValue = Mathf.Clamp(wm.startingPrimary, 0, WeaponDatabase.publicGunControllers.Length - 1); int sValue = Mathf.Clamp(wm.startingSecondary, 0, WeaponDatabase.publicGunControllers.Length - 1); EditorGUIUtility.labelWidth = 210f; wm.startingPrimary = EditorGUILayout.IntField("Primary Weapon (" + WeaponDatabase.GetWeaponByID(pValue).gunName + "):", pValue); wm.startingSecondary = EditorGUILayout.IntField("Secondary Weapon: (" + WeaponDatabase.GetWeaponByID(sValue).gunName + "):", sValue); EditorGUIUtility.LookLikeControls(); EditorGUI.indentLevel -= 1; DarkRef.GUISeparator(); wm.meleeController = (MeleeController)EditorGUILayout.ObjectField("Melee Controller:", wm.meleeController, typeof(MeleeController), true); wm.grenadeManager = (GrenadeManager)EditorGUILayout.ObjectField("Grenade Manager:", wm.grenadeManager, typeof(GrenadeManager), true); wm.hands = (GameObject)EditorGUILayout.ObjectField("Hands:", wm.hands, typeof(GameObject), true); GUILayout.Space(10); wm.drawTime = EditorGUILayout.FloatField("Base Draw Time:", wm.drawTime); wm.drawSound = (AudioClip)EditorGUILayout.ObjectField("Draw Sound:", wm.drawSound, typeof(AudioClip), true); wm.dropSound = (AudioClip)EditorGUILayout.ObjectField("Drop Sound:", wm.dropSound, typeof(AudioClip), true); if (GUI.changed) { EditorUtility.SetDirty(wm); } }
public override void OnInspectorGUI() { UIController uic = target as UIController; uic.guiCamera = (Camera)EditorGUILayout.ObjectField("Main GUI Camera:", uic.guiCamera, typeof(Camera), true); uic.guiRoot = (Transform)EditorGUILayout.ObjectField("Main GUI ROOT:", uic.guiRoot, typeof(Transform), true); GUILayout.Space(5f); EditorGUILayout.LabelField("Vitals GUI", EditorStyles.boldLabel); EditorGUI.indentLevel += 1; uic.healthBar = (UISlider)EditorGUILayout.ObjectField("Health-bar", uic.healthBar, typeof(UISlider), true); uic.healthText = (UILabel)EditorGUILayout.ObjectField("Health-text", uic.healthText, typeof(UILabel), true); uic.shieldBar = (UISlider)EditorGUILayout.ObjectField("Shield-bar", uic.shieldBar, typeof(UISlider), true); uic.shieldText = (UILabel)EditorGUILayout.ObjectField("Shield-text", uic.shieldText, typeof(UILabel), true); uic.staminaBar = (UISlider)EditorGUILayout.ObjectField("Stamina-bar", uic.staminaBar, typeof(UISlider), true); DarkRef.GUISeparator(); uic.bloodyScreen = (MeshRenderer)EditorGUILayout.ObjectField("Blood Screen", uic.bloodyScreen, typeof(MeshRenderer), true); uic.shieldTexture = (UITexture)EditorGUILayout.ObjectField("Shield Texture", uic.shieldTexture, typeof(UITexture), true); uic.muzzleHelmetGlow = (Renderer)EditorGUILayout.ObjectField("Muzzle Helmet Glow", uic.muzzleHelmetGlow, typeof(Renderer), true); EditorGUI.indentLevel -= 1; DarkRef.GUISeparator(); EditorGUILayout.LabelField("Weapon GUI", EditorStyles.boldLabel); EditorGUI.indentLevel += 1; uic.weaponName = (UILabel)EditorGUILayout.ObjectField("Weapon Name:", uic.weaponName, typeof(UILabel), true); uic.curAmmoDisplay = (UILabel)EditorGUILayout.ObjectField("Cur Ammo:", uic.curAmmoDisplay, typeof(UILabel), true); uic.ammoLeftDisplay = (UILabel)EditorGUILayout.ObjectField("Ammo Left:", uic.ammoLeftDisplay, typeof(UILabel), true); uic.ammoBar = (UISlider)EditorGUILayout.ObjectField("Ammo Bar:", uic.ammoBar, typeof(UISlider), true); uic.weaponIcon = (UITexture)EditorGUILayout.ObjectField("Weapon Icon:", uic.weaponIcon, typeof(UITexture), true); uic.weaponSlot = (UILabel)EditorGUILayout.ObjectField("Weapon Slot:", uic.weaponSlot, typeof(UILabel), true); uic.fireModeLabel = (UILabel)EditorGUILayout.ObjectField("Fire-mode:", uic.fireModeLabel, typeof(UILabel), true); uic.reloadIndicatorLabel = (UILabel)EditorGUILayout.ObjectField("Reload Indicator:", uic.reloadIndicatorLabel, typeof(UILabel), true); uic.crosshairs = (CrosshairGUI)EditorGUILayout.ObjectField("Crosshairs:", uic.crosshairs, typeof(CrosshairGUI), true); DarkRef.GUISeparator(4f); uic.grenadeSelectionSprite = (UISprite)EditorGUILayout.ObjectField("Grenade Selection:", uic.grenadeSelectionSprite, typeof(UISprite), true); uic.grenadeSelectionLabel = (UILabel)EditorGUILayout.ObjectField("Grenade Selection Label:", uic.grenadeSelectionLabel, typeof(UILabel), true); uic.grenadeOneLabel = (UILabel)EditorGUILayout.ObjectField("Grenade Label #1:", uic.grenadeOneLabel, typeof(UILabel), true); uic.grenadeTwoLabel = (UILabel)EditorGUILayout.ObjectField("Grenade Label #2:", uic.grenadeTwoLabel, typeof(UILabel), true); GUILayout.Space(5); uic.grenadeOneIcon = (UITexture)EditorGUILayout.ObjectField("Grenade Icon #1:", uic.grenadeOneIcon, typeof(UITexture), true); uic.grenadeTwoIcon = (UITexture)EditorGUILayout.ObjectField("Grenade Icon #2:", uic.grenadeTwoIcon, typeof(UITexture), true); EditorGUI.indentLevel -= 1; DarkRef.GUISeparator(); EditorGUILayout.LabelField("Miscellaneous GUI", EditorStyles.boldLabel); EditorGUI.indentLevel += 1; uic.useGUI = (UILabel)EditorGUILayout.ObjectField("Use GUI:", uic.useGUI, typeof(UILabel), true); uic.parentOfObjectives = (Transform)EditorGUILayout.ObjectField("Parent of Objectives:", uic.parentOfObjectives, typeof(Transform), true); uic.grabText = (UILabel)EditorGUILayout.ObjectField("Grab Text Label:", uic.grabText, typeof(UILabel), true); uic.mpGUI = (MultiplayerGUI)EditorGUILayout.ObjectField("Multiplayer GUI (Control):", uic.mpGUI, typeof(MultiplayerGUI), true); uic.teamMarkerSystem = (TeamMarkingSystem)EditorGUILayout.ObjectField("Team Marking System:", uic.teamMarkerSystem, typeof(TeamMarkingSystem), true); uic.rainFX = (ParticleSystem)EditorGUILayout.ObjectField("Rain FX:", uic.rainFX, typeof(ParticleSystem), true); uic.fadeFromBlack = (UISprite)EditorGUILayout.ObjectField("Fade From Black:", uic.fadeFromBlack, typeof(UISprite), true); uic.hitIndicatorRoot = (Transform)EditorGUILayout.ObjectField("Hit Indicator Root:", uic.hitIndicatorRoot, typeof(Transform), true); uic.empRecalibrate = (UILabel)EditorGUILayout.ObjectField("Recalibrate EMP:", uic.empRecalibrate, typeof(UILabel), true); GUILayout.Space(5f); isOpen = EditorGUILayout.Foldout(isOpen, "Flickering Panels"); if (isOpen) { int length = uic.flickeringPanels.Length; FlickeringGUI[] tempStorage = uic.flickeringPanels; EditorGUI.indentLevel += 1; length = EditorGUILayout.IntField("Length:", length); if (length != uic.flickeringPanels.Length) { uic.flickeringPanels = new FlickeringGUI[length]; for (int i = 0; i < tempStorage.Length; i++) { if (i < uic.flickeringPanels.Length) { uic.flickeringPanels[i] = tempStorage[i]; } } } EditorGUI.indentLevel += 1; for (int i = 0; i < length; i++) { uic.flickeringPanels[i] = (FlickeringGUI)EditorGUILayout.ObjectField("Element " + i.ToString(), uic.flickeringPanels[i], typeof(FlickeringGUI), true); } EditorGUI.indentLevel -= 1; EditorGUI.indentLevel -= 1; } DarkRef.GUISeparator(); uic.pauseMenu = (GameObject)EditorGUILayout.ObjectField("Pause Menu:", uic.pauseMenu, typeof(GameObject), true); uic.pauseBlur = (BlurEffect)EditorGUILayout.ObjectField("Pause Blur (Normal):", uic.pauseBlur, typeof(BlurEffect), true); uic.pauseBlur2 = (BlurEffect)EditorGUILayout.ObjectField("Pause Blur (Settings):", uic.pauseBlur2, typeof(BlurEffect), true); uic.settingsPanel = (UIPanel)EditorGUILayout.ObjectField("Settings Panel:", uic.settingsPanel, typeof(UIPanel), true); DarkRef.GUISeparator(); uic.waveCounter = (UILabel)EditorGUILayout.ObjectField("Wave Counter:", uic.waveCounter, typeof(UILabel), true); uic.enemiesLeftCounter = (UILabel)EditorGUILayout.ObjectField("Enemies Left Counter:", uic.enemiesLeftCounter, typeof(UILabel), true); EditorGUI.indentLevel -= 1; if (GUI.changed) { EditorUtility.SetDirty(uic); } }
public override void OnInspectorGUI() { ObjectiveMarker marker = target as ObjectiveMarker; marker.enabled = EditorGUILayout.Toggle("GUI Enabled:", marker.enabled); if (!marker.enabled) { return; } GUILayout.Label("General Settings", EditorStyles.boldLabel); marker.target = (Transform)EditorGUILayout.ObjectField(" Target:", marker.target, typeof(Transform), true); EditorGUI.indentLevel += 1; marker.baseScale = EditorGUILayout.Vector2Field("Base Scale:", marker.baseScale); EditorGUI.indentLevel -= 1; marker.markerTexture = (UITexture)EditorGUILayout.ObjectField(" Marker Texture", marker.markerTexture, typeof(UITexture), true); marker.distanceLabel = (UILabel)EditorGUILayout.ObjectField(" Distance Label", marker.distanceLabel, typeof(UILabel), true); marker.descriptionLabel = (UILabel)EditorGUILayout.ObjectField(" Description Label", marker.descriptionLabel, typeof(UILabel), true); marker.distanceRefreshRate = EditorGUILayout.FloatField(" Distance Refresh Rate:", marker.distanceRefreshRate); EditorGUI.indentLevel += 1; marker.edgeOffset = EditorGUILayout.Vector2Field("Edge Offset:", marker.edgeOffset); EditorGUI.indentLevel -= 1; DarkRef.GUISeparator(); GUILayout.Label("Effect Settings", EditorStyles.boldLabel); marker.scalingEnabled = EditorGUILayout.Toggle(" Scaling Enabled:", marker.scalingEnabled); if (marker.scalingEnabled) { marker.nearDistance = EditorGUILayout.FloatField(" Near Distance:", marker.nearDistance); marker.nearScale = EditorGUILayout.FloatField(" Near Scale:", marker.nearScale); EditorGUI.indentLevel += 2; DarkRef.GUISeparator(); EditorGUI.indentLevel -= 2; marker.farDistance = EditorGUILayout.FloatField(" Far Distance:", marker.farDistance); marker.farScale = EditorGUILayout.FloatField(" Far Scale:", marker.farScale); GUILayout.Space(10f); EditorGUI.indentLevel += 1; marker.textBorder = EditorGUILayout.Vector3Field("Text Border:", marker.textBorder); EditorGUI.indentLevel -= 1; } DarkRef.GUISeparator(); GUILayout.Label("GUI Settings", EditorStyles.boldLabel); if (marker.GUITextures.Length < 5) { marker.GUITextures = new Texture2D[5]; } EditorGUI.indentLevel += 1; marker.GUITextures[0] = (Texture2D)EditorGUILayout.ObjectField("On-Screen Indicator: ", marker.GUITextures[0], typeof(Texture2D), false); marker.GUITextures[1] = (Texture2D)EditorGUILayout.ObjectField("Left Indicator: ", marker.GUITextures[1], typeof(Texture2D), false); marker.GUITextures[2] = (Texture2D)EditorGUILayout.ObjectField("Right Indicator: ", marker.GUITextures[2], typeof(Texture2D), false); marker.GUITextures[3] = (Texture2D)EditorGUILayout.ObjectField("Up Indicator: ", marker.GUITextures[3], typeof(Texture2D), false); marker.GUITextures[4] = (Texture2D)EditorGUILayout.ObjectField("Down Indicator: ", marker.GUITextures[4], typeof(Texture2D), false); EditorGUI.indentLevel -= 1; EditorUtility.SetDirty(marker); }
void OnGUI() { if (settingsPrefab == null) { GUI.enabled = false; } if (GUILayout.Button("Initialize Assignment of Weapon IDs")) { WeaponDatabase.Initialize(); } if (GUILayout.Button("Clear Weapon IDs")) { WeaponDatabase.customWeaponList = new GunController[0]; WeaponList temp = (WeaponList)Instantiate(settingsPrefab); temp.savedWeapons = new GunController[0]; WeaponDatabase.RefreshIDs(); PrefabUtility.ReplacePrefab(temp.gameObject, settingsPrefab, ReplacePrefabOptions.Default); DestroyImmediate(temp.gameObject); WeaponDatabase.Initialize(); } if (GUILayout.Button("Auto-fill Weapon IDs")) { Object[] resourcesGC = Resources.LoadAll("Weapons", typeof(GunController)); WeaponDatabase.customWeaponList = new GunController[resourcesGC.Length]; WeaponList temp = (WeaponList)Instantiate(settingsPrefab); temp.savedWeapons = new GunController[resourcesGC.Length]; for (int i = 0; i < resourcesGC.Length; i++) { temp.savedWeapons[i] = (GunController)resourcesGC[i]; } WeaponDatabase.RefreshIDs(); PrefabUtility.ReplacePrefab(temp.gameObject, settingsPrefab, ReplacePrefabOptions.Default); DestroyImmediate(temp.gameObject); WeaponDatabase.Initialize(); } GUI.enabled = true; GUILayout.Space(10); EditorGUIUtility.labelWidth = 120f; GUILayout.Box("Prefab Directory: MAIN - Blackraze/Resources/Static Prefabs", GUILayout.MaxWidth(500), GUILayout.Height(20)); if (settingsPrefab) { EditorGUILayout.ObjectField("Settings Prefab:", settingsPrefab, typeof(WeaponList), false, GUILayout.MaxWidth(350)); } else { WeaponList savedWL = (WeaponList)Resources.Load("Static Prefabs/Weapon List", typeof(WeaponList)); if (savedWL) { settingsPrefab = savedWL; WeaponDatabase.customWeaponList = savedWL.savedWeapons; } else { GUI.color = new Color(1f, 0.2f, 0f, 1f); if (GUILayout.Button("Generate Prefab", GUILayout.MaxWidth(120))) { if (settingsPrefab == null) { GameObject go = new GameObject("Weapon List"); go.AddComponent <WeaponList>(); settingsPrefab = PrefabUtility.CreatePrefab("Assets/MAIN - Blackraze/Resources/Static Prefabs/Weapon List.prefab", go, ReplacePrefabOptions.ConnectToPrefab).GetComponent <WeaponList>(); DestroyImmediate(go); } } GUI.color = Color.white; } } EditorGUIUtility.LookLikeControls(); if (settingsPrefab == null) { GUI.color = Color.gray; GUI.enabled = false; } else if (!settingsPrefab.GetComponent <WeaponList>()) { GUI.color = Color.gray; GUI.enabled = false; } DarkRef.GUISeparator(10f); if (GUILayout.Button((inEditMode) ? "DONE" : "EDIT", GUILayout.MaxWidth(80))) { inEditMode = !inEditMode; if (!inEditMode) { WeaponDatabase.RefreshIDs(); WeaponDatabase.Initialize(); if (settingsPrefab != null) { WeaponList temp = (WeaponList)Instantiate(settingsPrefab); PrefabUtility.ReplacePrefab(temp.gameObject, settingsPrefab, ReplacePrefabOptions.Default); DestroyImmediate(temp.gameObject); } } else { displayLength = WeaponDatabase.customWeaponList.Length; } } EditorGUILayout.LabelField("Weapon ID List", EditorStyles.boldLabel); EditorGUILayout.BeginHorizontal(); EditorGUI.indentLevel += 1; if (inEditMode) { GunController[] tempStorage = WeaponDatabase.customWeaponList; EditorGUIUtility.labelWidth = 90f; displayLength = EditorGUILayout.IntField("Length:", Mathf.Clamp(displayLength, 0, 100), GUILayout.MaxWidth(150)); EditorGUIUtility.LookLikeControls(); if (displayLength != WeaponDatabase.customWeaponList.Length && (Event.current.isKey && Event.current.keyCode == KeyCode.Return)) { WeaponDatabase.customWeaponList = new GunController[displayLength]; for (int i = 0; i < tempStorage.Length; i++) { if (i < WeaponDatabase.customWeaponList.Length) { WeaponDatabase.customWeaponList[i] = tempStorage[i]; } } Event.current.Use(); } scrollPos = EditorGUILayout.BeginScrollView(scrollPos, GUILayout.Width(Screen.width - 10), GUILayout.Height(Mathf.Clamp(Screen.height - 210, 1, Screen.height))); EditorGUI.indentLevel += 1; for (int i = 0; i < WeaponDatabase.customWeaponList.Length; i++) { EditorGUIUtility.labelWidth = 90f; WeaponDatabase.customWeaponList[i] = (GunController)EditorGUILayout.ObjectField("Element #" + i.ToString(), WeaponDatabase.customWeaponList[i], typeof(GunController), false, GUILayout.MaxWidth(330)); EditorGUIUtility.LookLikeControls(); } EditorGUI.indentLevel -= 1; EditorGUILayout.EndScrollView(); if (WeaponDatabase.customWeaponList != settingsPrefab.savedWeapons || GUI.changed) { settingsPrefab.savedWeapons = WeaponDatabase.customWeaponList; } } else { if (WeaponDatabase.publicGunControllers.Length <= 0) { EditorGUILayout.LabelField("[Press the 'EDIT' button above to get started]"); } else { scrollPos = EditorGUILayout.BeginScrollView(scrollPos, GUILayout.Width(Screen.width - 10), GUILayout.Height(Mathf.Clamp(Screen.height - 210, 1, Screen.height))); for (int i = 0; i < WeaponDatabase.publicGunControllers.Length; i++) { GunController gc = WeaponDatabase.publicGunControllers[i]; if (gc != null) { if (gc.weaponID <= -1) { EditorGUILayout.LabelField(i + " - (UNASSIGNED)"); } else { EditorGUILayout.LabelField(i + " - " + gc.name); } } else { EditorGUILayout.LabelField(i + " - (NULL)"); } } EditorGUILayout.EndScrollView(); } } EditorGUI.indentLevel -= 1; EditorGUILayout.EndHorizontal(); }
public override void OnInspectorGUI() { AreaDamage ad = target as AreaDamage; ad.lifetime = EditorGUILayout.FloatField("Lifetime:", Mathf.Clamp(ad.lifetime, 0f, 1000f)); GUILayout.Space(8); ad.damageOnce = EditorGUILayout.Toggle("Damage Once:", ad.damageOnce); if (!ad.damageOnce) { EditorGUI.indentLevel += 1; GUI.color = new Color(0.9f, 0.9f, 0.9f, 1f); ad.damageRate = EditorGUILayout.FloatField("Damage Rate:", Mathf.Clamp(ad.damageRate, 0f, ad.lifetime)); GUI.color = Color.white; EditorGUI.indentLevel -= 1; } DarkRef.GUISeparator(); ad.raycastCheck = EditorGUILayout.Toggle("Raycast Check:", ad.raycastCheck); if (ad.raycastCheck) { EditorGUI.indentLevel += 1; GUI.color = new Color(0.9f, 0.9f, 0.9f, 1f); ad.raycastOffset = EditorGUILayout.Vector3Field("Raycast Offset:", ad.raycastOffset); GUI.color = Color.white; EditorGUI.indentLevel -= 1; } DarkRef.GUISeparator(); ad.isEMP = EditorGUILayout.Toggle("Is EMP:", ad.isEMP); GUILayout.Space(5f); ad.shakeCamera = EditorGUILayout.Toggle("Shake Camera:", ad.shakeCamera); if (ad.shakeCamera) { EditorGUI.indentLevel += 1; GUI.color = new Color(0.9f, 0.9f, 0.9f, 1f); ad.shakeRadius = EditorGUILayout.FloatField("Shake Radius:", Mathf.Clamp(ad.shakeRadius, 0f, ad.damageFalloff.keys[ad.damageFalloff.keys.Length - 1].time * 100f)); ad.shakeLength = EditorGUILayout.FloatField("Shake Duration:", ad.shakeLength); ad.shakeSpeed = EditorGUILayout.FloatField("Shake Speed:", ad.shakeSpeed); ad.shakeIntensity = EditorGUILayout.FloatField("Shake Intensity:", ad.shakeIntensity); GUI.color = Color.white; EditorGUI.indentLevel -= 1; } GUILayout.Space(5f); EditorGUIUtility.labelWidth = 165f; ad.explosionCameraEffect = EditorGUILayout.Toggle("Explosion Camera Effect:", ad.explosionCameraEffect); EditorGUIUtility.labelWidth = 0f; DarkRef.GUISeparator(); EditorGUILayout.PropertyField(layersToAffect, new GUIContent("Layers to Affect:")); if (GUILayout.Button("Copy Layer Mask", GUILayout.MaxWidth(250f))) { isReadyToPaste = true; copyPasteMask = ad.layersToDamage; } if (isReadyToPaste && GUILayout.Button("Paste Layer Mask", GUILayout.MaxWidth(250f))) { ad.layersToDamage = copyPasteMask; serializedObject.Update(); } GUILayout.Space(10f); ad.damageFalloff = EditorGUILayout.CurveField("Damage Falloff", ad.damageFalloff); for (int i = 0; i < ad.damageFalloff.length; i++) { Keyframe modKey = ad.damageFalloff.keys[i]; modKey.time = Mathf.Round(Mathf.Max(0f, ad.damageFalloff.keys[i].time) * 100f) / 100f; modKey.value = Mathf.RoundToInt(Mathf.Max(0f, ad.damageFalloff.keys[i].value)); ad.damageFalloff.MoveKey(i, modKey); } EditorGUI.indentLevel += 1; GUI.color = new Color(0.6f, 0.6f, 0.6f, 1f); float maxRange = ad.damageFalloff.keys[ad.damageFalloff.keys.Length - 1].time; EditorGUIUtility.labelWidth = 160f; rangeValue = EditorGUILayout.FloatField("[Input] Range (0 - " + maxRange.ToString("F1") + "):", Mathf.Clamp(rangeValue, 0, maxRange)); EditorGUIUtility.labelWidth = 0f; EditorGUILayout.LabelField("[Output] Damage: " + ((int)ad.damageFalloff.Evaluate(rangeValue))); GUI.color = Color.white; EditorGUI.indentLevel -= 1; ad.damageForce = EditorGUILayout.FloatField("Damage Force", Mathf.Clamp(ad.damageForce, 0, 1000)); ad.forceUpwards = EditorGUILayout.FloatField("Upward Force", Mathf.Clamp(ad.forceUpwards, 0, 100)); if (GUI.changed) { EditorUtility.SetDirty(ad); serializedObject.ApplyModifiedProperties(); } }