示例#1
0
 public FloorSensorC06(SensorInitializer <IActuatorX> initializer) : base(initializer)
 {
 }
示例#2
0
        protected virtual async Task <WallSensor> ParseSensor(ActuatorItemData data, List <IGrabableItem> items, Point pos)
        {
            SensorInitializer <IActuatorX> initializer = new SensorInitializer <IActuatorX>();

            switch (data.ActuatorType)
            {
            case 10:
            //TODO

            case 0:
                await SetupInitializer(initializer, data);

                initializer.Graphics = CreateWallDecoration(data.Decoration - 1, items);
                return(new Sensor0(initializer));

            case 1:
                var wallDecoration = CreateWallDecoration(data.Decoration - 1, items);
                if (data.Action == ActionType.Hold && wallDecoration is Alcove)
                {
                    var alcInitializer = new SensorInitializer <Alcove>();
                    await SetupInitializer(alcInitializer, data);

                    alcInitializer.Graphics = (Alcove)wallDecoration;
                    return(new Sensor1HoldAlcove(alcInitializer));
                }
                else
                {
                    await SetupInitializer(initializer, data);

                    initializer.Graphics = wallDecoration;
                    return(new Sensor1(initializer));
                }

            case 2:
                var sensor2initalizer = new ItemConstrainSensorInitalizer <IActuatorX> {
                    Data = builder.GetItemFactory(data.Data)
                };
                await SetupInitializer(sensor2initalizer, data);

                sensor2initalizer.Graphics = CreateWallDecoration(data.Decoration - 1, items);
                return(new Sensor2(sensor2initalizer));

            case 3:
                var sensor3initalizer = new ItemConstrainSensorInitalizer <IActuatorX> {
                    Data = builder.GetItemFactory(data.Data)
                };
                await SetupInitializer(sensor3initalizer, data);

                sensor3initalizer.Graphics = CreateWallDecoration(data.Decoration - 1, items);
                return(new Sensor3(sensor3initalizer));

            case 4:
                var sensor4initalizer = new ItemConstrainSensorInitalizer <IActuatorX> {
                    Data = builder.GetItemFactory(data.Data)
                };
                await SetupInitializer(sensor4initalizer, data);

                sensor4initalizer.Graphics = CreateWallDecoration(data.Decoration - 1, items);
                return(new Sensor4(sensor4initalizer));

            case 11:
                var sensor11initalizer = new ItemConstrainSensorInitalizer <IActuatorX> {
                    Data = builder.GetItemFactory(data.Data)
                };
                await SetupInitializer(sensor11initalizer, data);

                sensor11initalizer.Graphics = CreateWallDecoration(data.Decoration - 1, items);
                return(new Sensor11(sensor11initalizer));

            case 12:
                var sensor12initalizer = new ItemConstrainSensorInitalizer <IActuatorX> {
                    Data = builder.GetItemFactory(data.Data)
                };
                await SetupInitializer(sensor12initalizer, data);

                sensor12initalizer.Graphics = CreateWallDecoration(data.Decoration - 1, items);
                return(new Sensor12(sensor12initalizer));

            case 13:
                var sensor13initalizer = new StorageSensorInitializer <IActuatorX> {
                    StoredItem = GetStoredObject(items, data.Data), Data = builder.GetItemFactory(data.Data)
                };
                await SetupInitializer(sensor13initalizer, data);

                sensor13initalizer.Graphics = CreateWallDecoration(data.Decoration - 1, items);
                return(new Sensor13(sensor13initalizer));

            case 16:
                var sensor16initalizer = new StorageSensorInitializer <IActuatorX> {
                    StoredItem = GetStoredObject(items, data.Data), Data = builder.GetItemFactory(data.Data)
                };
                await SetupInitializer(sensor16initalizer, data);

                sensor16initalizer.Graphics = CreateWallDecoration(data.Decoration - 1, items);
                return(new Sensor16(sensor16initalizer));

            case 17:
                var sensor17initalizer = new ItemConstrainSensorInitalizer <IActuatorX> {
                    Data = builder.GetItemFactory(data.Data)
                };
                await SetupInitializer(sensor17initalizer, data);

                sensor17initalizer.Graphics = CreateWallDecoration(data.Decoration - 1, items);
                return(new Sensor17(sensor17initalizer));

            case 127:
                return(await CreateChampionActuator(data, items, pos));

            default:
                throw new InvalidOperationException();
            }
        }