This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var classes = "(Input|KeyCode|Time|KeyCode|Vector3|Color|MonoBehaviour|Mathf)"; | |
Prism.languages.unity = Prism.languages.extend('java', { | |
'docs-static': new RegExp("(" + classes + "\\.[A-Z][a-zA-Z0-9]+)", "g"), | |
'docs-instance': new RegExp("(" + classes + "\\.[a-z][a-zA-Z0-9]+)", "g"), | |
'punctuation': false | |
}); | |
// Unity Languages | |
Prism.languages.csharp = Prism.languages.extend('unity', { | |
'keyword': /\b(abstract|event|new|struct|as|explicit|null|switch|base|extern|object|this|bool|false|operator|throw|break|finally|out|true|byte|fixed|override|try|case|float|params|typeof|catch|for|private|uint|char|foreach|protected|ulong|checked|goto|public|unchecked|class|if|readonly|unsafe|const|implicit|ref|ushort|continue|in|return|using|decimal|int|sbyte|virtual|default|interface|sealed|volatile|delegate|internal|short|void|do|is|sizeof|while|double|lock|stackalloc|else|long|static|enum|namespace|string)\b/g |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$engine = new EntityEngine(); | |
$entity = new SimpleEntity($engine); | |
$entity->setComponent(new CollisionComponent()); | |
foreach($engine->getAll('Collision') as $comp) { | |
$comp->update(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$engine = new EntityEngine(); | |
$entity = new SimpleEntity($engine); | |
$entity->setComponent(new DialogComponent()); | |
$entity->getComponent('Dialog')->talk(); | |
// or just | |
$engine->getComponent($entity, 'Dialog')->talk(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class EntityEngine | |
{ | |
private $components = array(); | |
/** | |
* @param Entity $entity | |
* @param string $componentName | |
* @return Component | |
*/ |