/// <summary> /// Called when the object is selected in the editor /// </summary> private void OnEnable() { // Grab the serialized objects mTarget = (ActorCore)target; mTargetSO = new SerializedObject(target); // Update the effects so they can update with the definitions. if (!UnityEngine.Application.isPlaying) { mTarget.InstantiateStates(); mTarget.InstantiateReactors(); mTarget.InstantiateEffects(); } // Create the list of items to display InstantiateStateList(); // Generate the list to display Assembly lReactorAssembly = Assembly.GetAssembly(typeof(ReactorAction)); Type[] lReactorTypes = lReactorAssembly.GetTypes().OrderBy(x => x.Name).ToArray <Type>(); for (int i = 0; i < lReactorTypes.Length; i++) { Type lType = lReactorTypes[i]; if (lType.IsAbstract) { continue; } if (typeof(ReactorAction).IsAssignableFrom(lType)) { mReactorTypes.Add(lType); mReactorNames.Add(BaseNameAttribute.GetName(lType)); } } // Create the list of items to display InstantiateReactorList(); // Generate the list to display Assembly lEffectAssembly = Assembly.GetAssembly(typeof(ActorCoreEffect)); Type[] lEffectTypes = lEffectAssembly.GetTypes().OrderBy(x => x.Name).ToArray <Type>(); for (int i = 0; i < lEffectTypes.Length; i++) { Type lType = lEffectTypes[i]; if (lType.IsAbstract) { continue; } if (typeof(ActorCoreEffect).IsAssignableFrom(lType)) { mEffectTypes.Add(lType); mEffectNames.Add(BaseNameAttribute.GetName(lType)); } } // Create the list of items to display InstantiateEffectList(); }
/// <summary> /// Called when the object is selected in the editor /// </summary> private void OnEnable() { // Grab the serialized objects mTarget = (ActorCore)target; mTargetSO = new SerializedObject(target); // Update the effects so they can update with the definitions. if (!UnityEngine.Application.isPlaying) { mTarget.InstantiateStates(); mTarget.InstantiateReactors(); mTarget.InstantiateEffects(); } // Create the list of items to display InstantiateStateList(); // CDL 06 / 28 / 2018 - this only scans the assembly containing ReactorAction //// Generate the list to display //Assembly lReactorAssembly = Assembly.GetAssembly(typeof(ReactorAction)); //Type[] lReactorTypes = lReactorAssembly.GetTypes().OrderBy(x => x.Name).ToArray<Type>(); //for (int i = 0; i < lReactorTypes.Length; i++) //{ // Type lType = lReactorTypes[i]; // if (lType.IsAbstract) { continue; } // if (typeof(ReactorAction).IsAssignableFrom(lType)) // { // mReactorTypes.Add(lType); // mReactorNames.Add(BaseNameAttribute.GetName(lType)); // } //} // CDL 06 / 28 / 2018 - scan all assemblies for Reactors and Actor Core Effects List <Type> lFoundTypes = AssemblyHelper.FoundTypes; for (int i = 0; i < lFoundTypes.Count; i++) { Type lType = lFoundTypes[i]; if (lType.IsAbstract) { continue; } if (typeof(ReactorAction).IsAssignableFrom(lType)) { mReactorTypes.Add(lType); mReactorNames.Add(BaseNameAttribute.GetName(lType)); } else if (typeof(ActorCoreEffect).IsAssignableFrom(lType)) { mEffectTypes.Add(lType); mEffectNames.Add(BaseNameAttribute.GetName(lType)); } } // Create the list of items to display InstantiateReactorList(); // CDL 06 / 28 / 2018 - this only scans the assembly containing ActorCoreEffect //// Generate the list to display //Assembly lEffectAssembly = Assembly.GetAssembly(typeof(ActorCoreEffect)); //Type[] lEffectTypes = lEffectAssembly.GetTypes().OrderBy(x => x.Name).ToArray<Type>(); //for (int i = 0; i < lEffectTypes.Length; i++) //{ // Type lType = lEffectTypes[i]; // if (lType.IsAbstract) { continue; } // if (typeof(ActorCoreEffect).IsAssignableFrom(lType)) // { // mEffectTypes.Add(lType); // mEffectNames.Add(BaseNameAttribute.GetName(lType)); // } //} // Create the list of items to display InstantiateEffectList(); }