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,13 @@
|
|||
using UnityEditor;
|
||||
|
||||
namespace NaughtyAttributes.Editor
|
||||
{
|
||||
[PropertyMeta(typeof(BlankSpaceAttribute))]
|
||||
public class BlankSpacePropertyMeta : PropertyMeta
|
||||
{
|
||||
public override void ApplyPropertyMeta(SerializedProperty property, MetaAttribute metaAttribute)
|
||||
{
|
||||
EditorGUILayout.Space();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 22c72d3d1259d7c40afa38e9fcccbc4b
|
||||
timeCreated: 1508500060
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,70 @@
|
|||
using System.Reflection;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace NaughtyAttributes.Editor
|
||||
{
|
||||
[PropertyMeta(typeof(InfoBoxAttribute))]
|
||||
public class InfoBoxPropertyMeta : PropertyMeta
|
||||
{
|
||||
public override void ApplyPropertyMeta(SerializedProperty property, MetaAttribute metaAttribute)
|
||||
{
|
||||
InfoBoxAttribute infoBoxAttribute = (InfoBoxAttribute)metaAttribute;
|
||||
UnityEngine.Object target = PropertyUtility.GetTargetObject(property);
|
||||
|
||||
if (!string.IsNullOrEmpty(infoBoxAttribute.VisibleIf))
|
||||
{
|
||||
FieldInfo conditionField = target.GetType().GetField(infoBoxAttribute.VisibleIf, BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);
|
||||
if (conditionField != null &&
|
||||
conditionField.FieldType == typeof(bool))
|
||||
{
|
||||
if ((bool)conditionField.GetValue(target))
|
||||
{
|
||||
this.DrawInfoBox(infoBoxAttribute.Text, infoBoxAttribute.Type);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
MethodInfo conditionMethod = target.GetType().GetMethod(infoBoxAttribute.VisibleIf, BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);
|
||||
if (conditionMethod != null &&
|
||||
conditionMethod.ReturnType == typeof(bool) &&
|
||||
conditionMethod.GetParameters().Length == 0)
|
||||
{
|
||||
if ((bool)conditionMethod.Invoke(target, null))
|
||||
{
|
||||
this.DrawInfoBox(infoBoxAttribute.Text, infoBoxAttribute.Type);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
string warning = infoBoxAttribute.GetType().Name + " needs a valid boolean condition field or method name to work";
|
||||
EditorGUILayout.HelpBox(warning, MessageType.Warning);
|
||||
Debug.LogWarning(warning, PropertyUtility.GetTargetObject(property));
|
||||
}
|
||||
else
|
||||
{
|
||||
this.DrawInfoBox(infoBoxAttribute.Text, infoBoxAttribute.Type);
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawInfoBox(string infoText, InfoBoxType infoBoxType)
|
||||
{
|
||||
switch (infoBoxType)
|
||||
{
|
||||
case InfoBoxType.Normal:
|
||||
EditorGUILayout.HelpBox(infoText, MessageType.Info);
|
||||
break;
|
||||
|
||||
case InfoBoxType.Warning:
|
||||
EditorGUILayout.HelpBox(infoText, MessageType.Warning);
|
||||
break;
|
||||
|
||||
case InfoBoxType.Error:
|
||||
EditorGUILayout.HelpBox(infoText, MessageType.Error);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 998d996265069854eae8d1241df0c8aa
|
||||
timeCreated: 1508607449
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
using System.Reflection;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace NaughtyAttributes.Editor
|
||||
{
|
||||
[PropertyMeta(typeof(OnValueChangedAttribute))]
|
||||
public class OnValueChangedPropertyMeta : PropertyMeta
|
||||
{
|
||||
public override void ApplyPropertyMeta(SerializedProperty property, MetaAttribute metaAttribute)
|
||||
{
|
||||
OnValueChangedAttribute onValueChangedAttribute = (OnValueChangedAttribute)metaAttribute;
|
||||
UnityEngine.Object target = PropertyUtility.GetTargetObject(property);
|
||||
|
||||
MethodInfo callbackMethod = target.GetType().GetMethod(onValueChangedAttribute.CallbackName, BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);
|
||||
if (callbackMethod != null &&
|
||||
callbackMethod.ReturnType == typeof(void) &&
|
||||
callbackMethod.GetParameters().Length == 0)
|
||||
{
|
||||
property.serializedObject.ApplyModifiedProperties(); // We must apply modifications so that the callback can be invoked with up-to-date data
|
||||
|
||||
callbackMethod.Invoke(target, null);
|
||||
}
|
||||
else
|
||||
{
|
||||
string warning = onValueChangedAttribute.GetType().Name + " can invoke only action methods - with void return type and no parameters";
|
||||
Debug.LogWarning(warning, target);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
fileFormatVersion: 2
|
||||
guid: a55050bf047356c49b1598f431d277e9
|
||||
timeCreated: 1508612140
|
||||
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 PropertyMeta
|
||||
{
|
||||
public abstract void ApplyPropertyMeta(SerializedProperty property, MetaAttribute metaAttribute);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 87cd72b1f8ad36840a07e1128f77ec5b
|
||||
timeCreated: 1508497398
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
using UnityEditor;
|
||||
|
||||
namespace NaughtyAttributes.Editor
|
||||
{
|
||||
[PropertyMeta(typeof(SectionAttribute))]
|
||||
public class SectionPropertyMeta : PropertyMeta
|
||||
{
|
||||
public override void ApplyPropertyMeta(SerializedProperty property, MetaAttribute metaAttribute)
|
||||
{
|
||||
SectionAttribute sectionAttribute = (SectionAttribute)metaAttribute;
|
||||
|
||||
EditorGUILayout.Space();
|
||||
EditorGUILayout.LabelField(sectionAttribute.SectionLabel, EditorStyles.boldLabel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 5f3a9dbc599c2e14db4966237f3ec394
|
||||
timeCreated: 1508497398
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Loading…
Reference in a new issue