Weapos Rejiggered
Modified weapon scripts to eliminate specialized projectile behavior - allows charged weapons to have projectiles and modify weapon stats when charged Added machine gun weapon & VFX Moved third party code to Plugins folder to improve compile times
This commit is contained in:
parent
2a0fe34611
commit
dbc522a224
2105 changed files with 7033 additions and 1141 deletions
|
|
@ -0,0 +1,37 @@
|
|||
using System.Reflection;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace NaughtyAttributes.Editor
|
||||
{
|
||||
[PropertyDrawCondition(typeof(HideIfAttribute))]
|
||||
public class HideIfPropertyDrawCondition : PropertyDrawCondition
|
||||
{
|
||||
public override bool CanDrawProperty(SerializedProperty property)
|
||||
{
|
||||
HideIfAttribute hideIfAttribute = PropertyUtility.GetAttributes<HideIfAttribute>(property)[0];
|
||||
UnityEngine.Object target = PropertyUtility.GetTargetObject(property);
|
||||
|
||||
FieldInfo conditionField = target.GetType().GetField(hideIfAttribute.ConditionName, BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);
|
||||
if (conditionField != null &&
|
||||
conditionField.FieldType == typeof(bool))
|
||||
{
|
||||
return !(bool)conditionField.GetValue(target);
|
||||
}
|
||||
|
||||
MethodInfo conditionMethod = target.GetType().GetMethod(hideIfAttribute.ConditionName, BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);
|
||||
if (conditionMethod != null &&
|
||||
conditionMethod.ReturnType == typeof(bool) &&
|
||||
conditionMethod.GetParameters().Length == 0)
|
||||
{
|
||||
return !(bool)conditionMethod.Invoke(target, null);
|
||||
}
|
||||
|
||||
string warning = hideIfAttribute.GetType().Name + " needs a valid boolean condition field or method name to work";
|
||||
EditorGUILayout.HelpBox(warning, MessageType.Warning);
|
||||
Debug.LogWarning(warning, target);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
fileFormatVersion: 2
|
||||
guid: f7e60d80f0231654ab13cfb1178e6eb8
|
||||
timeCreated: 1508414568
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
using UnityEditor;
|
||||
|
||||
namespace NaughtyAttributes.Editor
|
||||
{
|
||||
public abstract class PropertyDrawCondition
|
||||
{
|
||||
public abstract bool CanDrawProperty(SerializedProperty property);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
fileFormatVersion: 2
|
||||
guid: ce2d1d9afa04cae43a18bd01ec9447eb
|
||||
timeCreated: 1508414568
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
using System.Reflection;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace NaughtyAttributes.Editor
|
||||
{
|
||||
[PropertyDrawCondition(typeof(ShowIfAttribute))]
|
||||
public class ShowIfPropertyDrawCondition : PropertyDrawCondition
|
||||
{
|
||||
public override bool CanDrawProperty(SerializedProperty property)
|
||||
{
|
||||
ShowIfAttribute showIfAttribute = PropertyUtility.GetAttributes<ShowIfAttribute>(property)[0];
|
||||
UnityEngine.Object target = PropertyUtility.GetTargetObject(property);
|
||||
|
||||
FieldInfo conditionField = target.GetType().GetField(showIfAttribute.ConditionName, BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);
|
||||
if (conditionField != null &&
|
||||
conditionField.FieldType == typeof(bool))
|
||||
{
|
||||
return (bool)conditionField.GetValue(target);
|
||||
}
|
||||
|
||||
MethodInfo conditionMethod = target.GetType().GetMethod(showIfAttribute.ConditionName, BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);
|
||||
if (conditionMethod != null &&
|
||||
conditionMethod.ReturnType == typeof(bool) &&
|
||||
conditionMethod.GetParameters().Length == 0)
|
||||
{
|
||||
return (bool)conditionMethod.Invoke(target, null);
|
||||
}
|
||||
|
||||
string warning = showIfAttribute.GetType().Name + " needs a valid boolean condition field or method name to work";
|
||||
EditorGUILayout.HelpBox(warning, MessageType.Warning);
|
||||
Debug.LogWarning(warning, target);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
fileFormatVersion: 2
|
||||
guid: fce0c8241476ad94cbbcdd6faae90700
|
||||
timeCreated: 1508414568
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Loading…
Reference in a new issue