Testhostplaycanvasmobile / 258.bundle.js
kwabs22
Added latest updates
3463977
"use strict";(self.webpackChunkplaycanvas_game=self.webpackChunkplaycanvas_game||[]).push([[258],{258:(e,t,o)=>{o.r(t),o.d(t,{default:()=>a});const a={name:"NPC System Test 19",description:"Focused scene to test NPC patrols, dialogue fallback, and proximity.",async build(e,t,o){console.log("[NPCSystemTest19] Building NPC system test scene...");const a=o.create("NPCSystemTest19Root",{position:[0,0,0],tags:["scene_root"]}),s=o.create("TestFloor",{components:{model:{type:"box"},collision:{type:"box",halfExtents:[20,.1,20]},rigidbody:{type:"static"}},position:[0,-.1,0],scale:[40,.2,40]});setTimeout(()=>{if(s.model){const e=new pc.StandardMaterial;e.diffuse=new pc.Color(.35,.35,.4),e.update(),s.model.material=e}},0),a.addChild(s);const n=new pc.Color(.6,.6,.7),i=(e,t,s)=>{const i=o.create(e,{components:{model:{type:"box"},collision:{type:"box",halfExtents:[s[0]/2,s[1]/2,s[2]/2]},rigidbody:{type:"static"}},position:t,scale:s});setTimeout(()=>{if(i.model){const e=new pc.StandardMaterial;e.diffuse=n,e.update(),i.model.material=e}},0),a.addChild(i)};i("NorthWall",[0,1,-20],[40,2,.4]),i("SouthWall",[0,1,20],[40,2,.4]),i("EastWall",[20,1,0],[.4,2,40]),i("WestWall",[-20,1,0],[.4,2,40]);const c=o.createLight("directional",{color:new pc.Color(1,.95,.8),intensity:1.1,castShadows:!0,position:[10,15,5],rotation:[45,-30,0]});a.addChild(c);const l=o.create("SpawnPoint",{position:[0,0,12]});a.addChild(l),[{name:"GuardA_Marker",pos:[-8,0,-8],col:[.2,.2,.9]},{name:"GuardB_Marker",pos:[8,0,-8],col:[.2,.2,.9]},{name:"Merchant_Marker",pos:[-10,0,6],col:[.2,.8,.2]},{name:"Questgiver_Marker",pos:[10,0,6],col:[.9,.9,.2]}].forEach(e=>{const t=o.create(e.name,{components:{model:{type:"box"}},position:e.pos,scale:[.6,2.2,.6]});setTimeout(()=>{if(t.model){const o=new pc.StandardMaterial;o.diffuse=new pc.Color(e.col[0],e.col[1],e.col[2]),o.update(),t.model.material=o}},0),a.addChild(t)});const r=e.core.getSystem("npcmanager");if(r&&r.spawnNPC)console.log("[NPCSystemTest19] Spawning NPCs via NPCManager..."),r.spawnNPC({template:"guard",id:"guard_patrol_A",position:[-8,0,-8],customData:{displayName:"Guard A",moveSpeed:2.2}}),r.spawnNPC({template:"guard",id:"guard_patrol_B",position:[8,0,-8],customData:{displayName:"Guard B",patrolPath:[{offset:[0,0,0],wait:2},{offset:[0,0,10],wait:2},{offset:[-10,0,10],wait:2},{offset:[-10,0,0],wait:2}],moveSpeed:1.8}}),r.spawnNPC({template:"merchant",id:"merchant_elli",position:[-10,0,6],customData:{displayName:"Elli the Merchant",interactionDistance:3}}),r.spawnNPC({template:"questgiver",id:"questgiver_rin",position:[10,0,6],customData:{displayName:"Rin the Questgiver",dialogue:null,interactionDistance:3.5}});else{console.warn("[NPCSystemTest19] NPCManager not available; attempting direct NPC creation");const e=o.createNPC("direct_npc_test",{position:[0,0,0],displayName:"Direct NPC Test",interactionDistance:3});a.addChild(e)}const d=o.create("InstructionSign",{components:{element:{type:pc.ELEMENTTYPE_TEXT,text:"NPC Test: Guards patrol with waits. Talk to Merchant/Questgiver. F to interact.",fontSize:28,color:new pc.Color(1,1,.2),fontAsset:e.fontManager.getFontAssetId(),anchor:[.5,.5,.5,.5],pivot:[.5,.5],width:900,height:60},screen:{referenceResolution:new pc.Vec2(900,60),scaleMode:pc.SCALEMODE_NONE,screenSpace:!1}},position:[0,3,0],scale:[.05,.05,.05],tags:["ui"]});return a.addChild(d),e.fire("ui:notification",{text:"Scene 19: NPC test loaded. Approach guards to observe patrols; interact with NPCs to test dialogue/proximity.",type:"info",duration:6e3}),a},onLoad(e,t){console.log("[NPCSystemTest19] onLoad")},onUnload(e,t){console.log("[NPCSystemTest19] onUnload")}}}}]);