///<summary> Adds the given Effect to cullList if inputList contains it. </summary> public void FlagForRemoval(EnvironOutput effect) { if (inputList.Contains(effect)) { cullList.Add(effect); } }
///<summary> Finds all Effects in the inputList matching the given Output. If there are none, the Effect will be added to inputList, otherwise the matching Effects are refreshed. </summary> public void Add(EnvironOutput effect, EnvironObject targetEO, EnvironObject lastSourceEO) { List <EnvironOutput> effectList = inputList.FindAll(e => e == effect); if (effectList.Count > 0) { foreach (EnvironOutput eOut in effectList) { eOut.Refresh(); } return; } EnvironOutput newEffect = UnityEngine.Object.Instantiate(effect); newEffect.Setup(targetEO, lastSourceEO); if (newEffect.appearanceI) { if (inputList.Count == 0 || IsPriority(newEffect.appearanceI)) //If the given Effect has a valid material Appearance that takes priority { newEffect.appearanceI.SetRendererMaterial(); //The material will be added to the Effect's set AppearanceI MeshRenderer. } } inputList.Add(newEffect); }
///<summary> Adds the given Effect to cullList if inputList contains it and the given Boolean is true. </summary> public void ConditionalFlagForRemoval(bool value, EnvironOutput effect) { if (value && inputList.Contains(effect)) { cullList.Add(effect); } }
///<summary> Determines the priority material AppearanceInfo in the inputList and applies it to the target MeshRenderer. </summary> private void SetMaterialAppearance(EnvironObject targetEO) { if (inputList.Count > 0) { EnvironOutput output = inputList.Find(eOut => eOut.appearanceI && eOut.appearanceI.canUseMaterial); if (output.appearanceI) //Sets the meshRenderer material of targetEO to: { output.appearanceI.SetRendererMaterial(); //apInfo material (from Effect in inputList) } else { targetEO.appearance.SetRendererMaterial(); //TargetEO's appearance material (reset) } } else { targetEO.appearance.SetRendererMaterial(); } }