private Vector2 GetVector(ShotVelocityOptions option) { switch (option) { case ShotVelocityOptions.Up: return(Vector2.up); case ShotVelocityOptions.Down: return(-Vector2.up); default: return(Vector2.zero); } }
public override void OnInspectorGUI() { gunSerialized.Update(); EditorGUILayout.Space(); EditorGUILayout.BeginVertical(); EditorGUILayout.PropertyField(fireRateProperty); velocity = (ShotVelocityOptions)EditorGUILayout.EnumPopup("Shot Velocity", ShotVelocity(gun.shotVelocity)); shotVelocityProperty.vector2Value = GetVector(velocity); bulletPoolProperty.objectReferenceValue = EditorGUILayout.ObjectField("Bullet pool", bulletPoolProperty.objectReferenceValue, typeof(ObjectPool), false); EditorGUILayout.EndVertical(); gunSerialized.ApplyModifiedProperties(); }