-
Notifications
You must be signed in to change notification settings - Fork 0
/
WeaponDataEditor.cs
36 lines (30 loc) · 1.4 KB
/
WeaponDataEditor.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
[CustomEditor(typeof(WeaponData))]
public class WeaponDataEditor : Editor {
WeaponData data;
private void OnEnable() {
data = (WeaponData)target;
}
public override void OnInspectorGUI() {
DrawDefaultInspector();
if (!data.magReload) {
data.reloadReadyTime = EditorGUILayout.FloatField("Reload Ready Time", data.reloadReadyTime);
}
if (data.weaponType == WeaponData.WeaponType.projectile) {
data.ammo = EditorGUILayout.IntField("Ammo", data.ammo);
}
else if (data.weaponType == WeaponData.WeaponType.battery) {
data.ammo = EditorGUILayout.IntField("Shots Per Battery", data.ammo);
data.heatPerShot = EditorGUILayout.Slider("Heat Per Shot", data.heatPerShot, 0, 1);
data.heatDissipationRate = EditorGUILayout.Slider("Heat Dissipation Rate", data.heatDissipationRate, 0, 1);
}
else if (data.weaponType == WeaponData.WeaponType.energy) {
data.ammo = EditorGUILayout.IntField("Shots Per Canister", data.ammo);
data.numCanisters = EditorGUILayout.IntField("Num Canisters", data.numCanisters);
data.canisterReloadTime = EditorGUILayout.FloatField("Canister Reload Time", data.canisterReloadTime);
}
}
}