示例#1
0
文件: Npc.php 项目: reillo/ninjawars
 public function __construct($content)
 {
     if (is_string($content) && trim($content)) {
         NpcFactory::fleshOut($content, $this);
     } else {
         NpcFactory::fleshOutFromData($content, $this);
     }
 }
示例#2
0
 /**
  * Pass the npc in and use the reference to flesh out it's data, from an identity if nothing else
  **/
 public static function fleshOut($identity, $npc)
 {
     $npcs_data = NpcFactory::npcsData();
     if (array_key_exists($identity, $npcs_data) && !empty($npcs_data[$identity])) {
         NpcFactory::fleshOutFromData($npcs_data[$identity], $npc);
     } else {
         throw new InvalidNpcException('No such npc [' . $identity . '] found to create!');
     }
 }