Ejemplo n.º 1
0
        //F272_xxxx_SENSOR_TriggerEffect
        protected async void TriggerEffect(ILeader theron, ActuatorX actuator, SensorEffect effect)
        {
            if (LocalEffect)
            {
                TriggerLocalEffect(theron, actuator);
            }
            else
            {
                MessageAction action;
                switch (effect)
                {
                case SensorEffect.C00_EFFECT_SET:
                    action = MessageAction.Set;
                    break;

                case SensorEffect.C01_EFFECT_CLEAR:
                    action = MessageAction.Clear;
                    break;

                case SensorEffect.C02_EFFECT_TOGGLE:
                    action = MessageAction.Toggle;
                    break;

                default:
                    throw new ArgumentOutOfRangeException(nameof(effect), effect, null);
                }

                //TODO send B,A,TargetCell only to wall tiles, floor tiles has set this flag NORTHWEST
                //TODO time delay await Task.Delay(A.Value);
                await Task.Delay(TimeDelay);

                TargetTile.AcceptMessageBase(new Message(action, Specifier));
            }
        }
Ejemplo n.º 2
0
 //F270_xxxx_SENSOR_TriggerLocalEffect
 protected void TriggerLocalEffect(ILeader theron, ActuatorX actuator, bool?rotate = null)
 {
     if (ExperienceGain)
     {
         //TODO on floor tiles add skill to all party members
         AddExperience(theron, SkillFactory <StealSkill> .Instance, 300, true /*P574_i_SensorLocalEffectCell != CM1_CELL_ANY*/);
     }
     else if (rotate ?? Rotate)
     {
         actuator.Rotate = Rotate;
     }
 }
Ejemplo n.º 3
0
        public bool TryTrigger(ActuatorX actuator, object obj, bool entering, bool alreadyContainsParty, bool alreadyContainsCreature, bool alreadyContainsGrabable,
                               bool alreadyContainsThingOfSameType, bool alreadyContainsThingOfDifferentType)
        {
            if (Disabled)
            {
                return(false);
            }

            bool L0768_B_TriggerSensor = entering;

            if (!TryInteract(ref L0768_B_TriggerSensor, obj, entering, alreadyContainsParty, alreadyContainsCreature, alreadyContainsThingOfSameType, alreadyContainsThingOfDifferentType, alreadyContainsGrabable))
            {
                return(false);
            }


            L0768_B_TriggerSensor ^= RevertEffect;
            var finalEffect = Effect;

            if (Effect == SensorEffect.C03_EFFECT_HOLD)
            {
                finalEffect = L0768_B_TriggerSensor ? SensorEffect.C00_EFFECT_SET : SensorEffect.C01_EFFECT_CLEAR;
            }
            else
            {
                if (!L0768_B_TriggerSensor)
                {
                    return(false);
                }
            }

            if (Audible)
            {
                //TODO sound
                //F064_aadz_SOUND_RequestPlay_COPYPROTECTIOND(C01_SOUND_SWITCH, P588_ui_MapX, P589_ui_MapY, C01_MODE_PLAY_IF_PRIORITIZED);
            }
            TriggerEffect(obj as ILeader, actuator, finalEffect);
            return(true);
        }