"use strict";exports.__esModule=!0,exports.createArea=exports.FenceType=exports.AreaEffectType=void 0;var _tool=require("../../../unity/tool"),_modelApi=require("../../../unity/model-api"),_lodash=require("lodash");const defaultFireSetting={size:1,density:1,color:(0,_tool.createUnityColor)("#ff0000ff")};let FenceType=exports.FenceType=function(a){return a.HoneycombFence="HoneycombFence",a.WireFrameFence="WireFrameFence",a.LaserFence="LaserFence",a}({});const defaultFenceSetting={style:FenceType.HoneycombFence,color:(0,_tool.createUnityColor)("#ff0000ff"),intensity:1,height:40,speed:1,gap:1,size:1,wireThickness:.25};let AreaEffectType=exports.AreaEffectType=function(a){return a.AreaFire="AreaFire",a.AreaFence="AreaFence",a}({});const createArea=async(a,b)=>{var c,d;let e;if(a.effectType===AreaEffectType.AreaFire)e=(0,_lodash.merge)(defaultFireSetting,a.setting?a.setting:{});else if(a.effectType===AreaEffectType.AreaFence)e=(0,_lodash.merge)(defaultFenceSetting,a.setting?a.setting:{});else throw new Error("\u672A\u77E5 `\u9762\u7279\u6548` \u7C7B\u578B\uFF1A"+a.effectType);let f=a.positions.map(a=>({X:a.x,Y:a.y,Z:a.z}));if(0===f.length)throw new Error("Positions \u4E3A\u7A7A");const{ID:g}=await b.unity.invoke(_modelApi.REQUEST_TYPE.CreatAreaEffect,{EffectType:a.effectType,SpaceID:a.spaceID,Positions:f,Setting:{Size:e.size,Density:e.density,Style:e.style,Intensity:e.intensity,Height:e.height,Speed:e.speed,Gap:e.gap,WireThickness:e.wireThickness,Color:null!==(c=a.setting)&&void 0!==c&&c.color?(0,_tool.createUnityColor)(null===(d=a.setting)||void 0===d?void 0:d.color):e.color}});return{id:g,remove:()=>{b.unity.invoke(_modelApi.REQUEST_TYPE.RemoveAreaEffect,{Ids:[g]})}}};exports.createArea=createArea;