public override Actuator CreateItem(LegacyMapBuilder context, Tile currentTile, IReadOnlyList <ActuatorItemData> matchedSequence)
        {
            IConstrain constrain  = null;
            Tile       targetTile = null;
            Texture2D  decoration = null;

            context.PrepareActuatorData(matchedSequence[0], out targetTile, out constrain, out decoration, putOnWall: false);

            if (matchedSequence[0].Data == 0)
            {
                constrain = new PartyConstrain();
            }
            else
            {
                constrain = new PartDirectionConstrain((MapDirection)(matchedSequence[0].Data - 1));
            }

            var res = new FloorActuator(context.GetFloorPosition(matchedSequence[0].TilePosition, currentTile), currentTile, constrain, targetTile.ToEnumerable(),
                                        matchedSequence[0].GetActionStateX().ToEnumerable());

            res.Graphics = new CubeGraphic
            {
                Position  = res.Position,
                DrawFaces = CubeFaces.All,
                Outter    = true,
                Scale     = new Vector3(0.2f),
                Texture   = decoration
            };
            return(res);
        }
        public override Actuator CreateItem(LegacyMapBuilder context, Tile currentTile, IReadOnlyList <ActuatorItemData> matchedSequence)
        {
            IConstrain constrain = null;

            if (matchedSequence[0].Data == 0)
            {
                constrain = new PartyConstrain();
            }
            else
            {
                constrain = new PartDirectionConstrain((MapDirection)(matchedSequence[0].Data - 1));
            }

            var res = new FloorActuator(context.GetFloorPosition(matchedSequence[0].TilePosition, currentTile), currentTile, constrain,
                                        matchedSequence.Select(context.GetTargetTile), matchedSequence.Select(x => x.GetActionStateX()));

            res.Graphics = new CubeGraphic
            {
                Position  = res.Position,
                DrawFaces = CubeFaces.All,
                Outter    = true,
                Scale     = new Vector3(0.2f),
                Texture   = context.GetTexture(matchedSequence.First(), putOnWall: false)
            };
            return(res);
        }
Example #3
0
        public virtual async Task <FloorActuator> GetFloorActuator(IEnumerable <ActuatorItemData> actuators)
        {
            var floorSensors = await Task.WhenAll(actuators.Select(CreateSensor));

            var res = new FloorActuator(floorSensors);

            res.Renderer = builder.Factories.RenderersSource.GetFloorActuatorRenderer(res);
            return(res);
        }
Example #4
0
        public override Actuator CreateItem(LegacyMapBuilder context, Tile currentTile, IReadOnlyList <ActuatorItemData> matchedSequence)
        {
            IConstrain constrain  = null;
            Tile       targetTile = null;
            Texture2D  decoration = null;

            context.PrepareActuatorData(matchedSequence[0], out targetTile, out constrain, out decoration, putOnWall: false);

            var res = new FloorActuator(context.GetFloorPosition(matchedSequence[0].TilePosition, currentTile), currentTile,
                                        new OrConstrain(new IConstrain[] { new PartyConstrain(), new TypeConstrain(typeof(Creature)), new TypeConstrain(typeof(GrabableItem)) }),
                                        targetTile.ToEnumerable(), matchedSequence[0].GetActionStateX().ToEnumerable());

            //TODO 14 28 actuator sends Clear message to pit(which open the pit => should be close)
            res.Graphics = new CubeGraphic
            {
                Position  = res.Position,
                DrawFaces = CubeFaces.All,
                Outter    = true,
                Scale     = new Vector3(0.2f),
                Texture   = decoration
            };
            return(res);
        }
 public virtual IRenderer GetFloorActuatorRenderer(FloorActuator res)
 {
     return(new ActuatorRenderer <FloorActuator>(res));
 }
Example #6
0
 public ActuatorFloorTileSide(FloorActuator actuator, bool randomDecoration, MapDirection face, IEnumerable <IGrabableItem> topLeftItems, IEnumerable <IGrabableItem> topRightItems, IEnumerable <IGrabableItem> bottomLeftItems, IEnumerable <IGrabableItem> bottomRightItems) : base(randomDecoration, face, topLeftItems, topRightItems, bottomLeftItems, bottomRightItems)
 {
     Actuator = actuator;
 }