コード例 #1
0
        protected async Task <TInitializer> SetupInitializer <TInitializer>(TInitializer initializer, ActuatorItemData data) where TInitializer : SensorInitializerX
        {
            var local  = data.ActionLocation as LocalTarget;
            var remote = data.ActionLocation as RemoteTarget;

            initializer.Audible        = data.HasSoundEffect;
            initializer.Effect         = (SensorEffect)data.Action;
            initializer.LocalEffect    = data.IsLocal;
            initializer.ExperienceGain = local?.ExperienceGain ?? false;
            initializer.Rotate         = local?.RotateAutors ?? false;
            initializer.OnceOnly       = data.IsOnceOnly;
            initializer.RevertEffect   = data.IsRevertable;
            initializer.TimeDelay      = 1000 / 6 * data.ActionDelay;

            initializer.Specifer = remote?.Position.Direction.ToMapDirection() ?? MapDirection.North;

            var tileResult = await builder.GetTargetTile(remote?.Position.Position.ToAbsolutePosition(builder.CurrentMap), initializer.Specifer);

            initializer.TargetTile = tileResult?.Item1;
            if (tileResult != null) //invertDirection
            {
                initializer.Specifer = tileResult.Item2;
            }


            return(initializer);
        }
コード例 #2
0
        private async void GetTeleportTarget(TeleprotInitializer teleportInitializer)
        {
            if (teleportInitializer.NextLevelIndex != builder.CurrentLevelIndex)
            {
                return;
            }

            teleportInitializer.NextLevelEnter = (await builder.GetTargetTile(teleportInitializer.TargetTilePosition, MapDirection.North)).Item1;
        }
コード例 #3
0
ファイル: ButtonFactory.cs プロジェクト: ggrrin/DungeonMaster
 public override Actuator CreateItem(LegacyMapBuilder context, Tile currentTile, IReadOnlyList<ActuatorItemData> matchedSequence)
 {
     return new Button(
         context.GetWallPosition(matchedSequence[0].TilePosition, currentTile),
         context.GetTargetTile(matchedSequence[0]),
         matchedSequence[0].GetActionStateX())
     {
         Texture = context.WallTextures[matchedSequence[0].Decoration - 1],
     };
 }
コード例 #4
0
 public override Actuator CreateItem(LegacyMapBuilder context, Tile currentTile, IReadOnlyList <ActuatorItemData> matchedSequence)
 {
     return(new Button(
                context.GetWallPosition(matchedSequence[0].TilePosition, currentTile),
                context.GetTargetTile(matchedSequence[0]),
                matchedSequence[0].GetActionStateX())
     {
         Texture = context.WallTextures[matchedSequence[0].Decoration - 1],
     });
 }
コード例 #5
0
 public override Actuator CreateItem(LegacyMapBuilder context, Tile currentTile, IReadOnlyList<ActuatorItemData> matchedSequence)
 {
     var leverDown = matchedSequence[1];
     return new LeverActuator(
         context.GetWallPosition(matchedSequence[0].TilePosition, context.WallActuatorCreator.CurrentTile),
         context.GetTargetTile(matchedSequence[0]),
         false,//TODO onceOnlyy flag ???
         matchedSequence[0].GetActionStateX())
     {
         UpTexture = context.WallTextures[matchedSequence[0].Decoration - 1],
         DownTexture = context.WallTextures[leverDown.Decoration - 1]
     };
 }
コード例 #6
0
        public override Actuator CreateItem(LegacyMapBuilder context, Tile currentTile, IReadOnlyList <ActuatorItemData> matchedSequence)
        {
            var leverDown = matchedSequence[1];

            return(new LeverActuator(
                       context.GetWallPosition(matchedSequence[0].TilePosition, context.WallActuatorCreator.CurrentTile),
                       context.GetTargetTile(matchedSequence[0]),
                       false,//TODO onceOnlyy flag ???
                       matchedSequence[0].GetActionStateX())
            {
                UpTexture = context.WallTextures[matchedSequence[0].Decoration - 1],
                DownTexture = context.WallTextures[leverDown.Decoration - 1]
            });
        }