예제 #1
0
        /// <summary>
        /// Return the first active SFXState in the given SimSet/SimGroup.
        /// </summary>
        /// <param name="group"></param>
        public static SFXState sfxGetActiveStateInGroup(SimGroup group)
        {
            for (uint i = 0; i < group.getCount(); i++)
            {
                SimObject obj = group.getObject(i);
                if (!obj.isMemberOfClass("SFXState"))
                {
                    continue;
                }

                SFXState state = obj.As <SFXState>();
                if (state.isActive())
                {
                    return(state);
                }
            }

            return(null);
        }
        public override void onActivate()
        {
            base.onActivate();

            SimGroup group = ParentGroup.As <SimGroup>();

            for (uint i = 0; i < group.getCount(); i++)
            {
                SimObject obj = group.getObject(i);

                if (obj.getId() == getId() || !obj.isMemberOfClass("SFXState"))
                {
                    continue;
                }

                SFXState state = obj.As <SFXState>();
                if (state.isActive())
                {
                    state.deactivate();
                }
            }
        }