puritandesigns/expotition

构建游戏书故事的类

v0.2 2019-03-03 15:47 UTC

This package is auto-updated.

Last update: 2024-09-06 09:40:28 UTC


README

PHP 类,用于构建游戏书故事。

查看 TrianglePHP Meetup 的幻灯片演示

入门

  1. 运行 composer require puritandesigns/expotition
  2. 需要 composer 的自动加载并创建一个冒险:$adventure = new Adventure();
  3. 创建具有动作的设置
$town = new Setting(
    $adventure,
    'Town',
    'You find yourself in a small town bustling with activity.',
);

$tavern = new Setting(
    $adventure,
    'Tavern',
    'You are in a single-room tavern.',
    new Actions(
        new SimpleResponseAction(
            'Talk to Bartender',
            $adventure,
            'The Bartender grunts, "Welcome to my pub."'
        ),
        new LeaveAction(
            'Head outside',
            $adventure,
            $town
        )
    )
);