diff --git a/Assets/AssetSpace/draft.json b/Assets/AssetSpace/draft.json new file mode 100644 index 0000000..4caf398 --- /dev/null +++ b/Assets/AssetSpace/draft.json @@ -0,0 +1 @@ +{"vectors":[{"x":0.0,"y":0.0,"z":0.0},{"x":-0.30000001192092898,"y":-0.30000001192092898,"z":0.0},{"x":-0.30000001192092898,"y":0.30000001192092898,"z":0.0},{"x":0.30000001192092898,"y":-0.4300000071525574,"z":0.0},{"x":0.0,"y":0.0,"z":0.0}],"quads":[1,2,3]} \ No newline at end of file diff --git a/Assets/AssetSpace/draft.pixelgon.meta b/Assets/AssetSpace/draft.json.meta similarity index 62% rename from Assets/AssetSpace/draft.pixelgon.meta rename to Assets/AssetSpace/draft.json.meta index 4862663..905d98b 100644 --- a/Assets/AssetSpace/draft.pixelgon.meta +++ b/Assets/AssetSpace/draft.json.meta @@ -1,6 +1,6 @@ fileFormatVersion: 2 -guid: 4b2183ce9a640ce46990e3029a03496a -DefaultImporter: +guid: ef37452489748cc4ca4bc9672b6f40e0 +TextScriptImporter: externalObjects: {} userData: assetBundleName: diff --git a/Assets/AssetSpace/draft.pixelgon b/Assets/AssetSpace/draft.pixelgon deleted file mode 100644 index a279cea..0000000 Binary files a/Assets/AssetSpace/draft.pixelgon and /dev/null differ diff --git a/Assets/AssetSpace/missile.json b/Assets/AssetSpace/missile.json new file mode 100644 index 0000000..f0a478d --- /dev/null +++ b/Assets/AssetSpace/missile.json @@ -0,0 +1 @@ +{"vectors":[{"x":0.0,"y":0.0,"z":0.0},{"x":0.05999999865889549,"y":-0.30000001192092898,"z":0.27000001072883608},{"x":0.27000001072883608,"y":-0.4300000071525574,"z":0.15000000596046449},{"x":0.0,"y":0.0,"z":0.0},{"x":-0.05403856933116913,"y":-0.02751000225543976,"z":-0.03959837555885315},{"x":0.0008432269096374512,"y":0.0065498948097229,"z":-0.04520612955093384},{"x":0.0,"y":0.0,"z":0.0},{"x":0.0008432231843471527,"y":0.006549902260303497,"z":-0.04520612955093384},{"x":0.05348876118659973,"y":-0.02520585060119629,"z":-0.04313823580741882},{"x":0.0,"y":0.0,"z":0.0},{"x":0.0008432231843471527,"y":0.006549902260303497,"z":-0.04520612955093384},{"x":-0.005199342966079712,"y":-0.05542263388633728,"z":-0.21812577545642854},{"x":0.0,"y":0.0,"z":0.0},{"x":0.05348876118659973,"y":-0.02520585060119629,"z":-0.043138232082128528},{"x":-0.005150701850652695,"y":-0.05492377281188965,"z":-0.21673382818698884},{"x":0.0,"y":0.0,"z":0.0},{"x":-0.056995004415512088,"y":-0.030519425868988038,"z":-0.033794105052948},{"x":-0.0051912469789385799,"y":-0.05533958971500397,"z":-0.21789409220218659},{"x":0.0,"y":0.0,"z":0.0},{"x":0.0008432231843471527,"y":0.006549902260303497,"z":-0.04520612955093384},{"x":-0.10104374587535858,"y":0.018380463123321534,"z":0.03990456461906433},{"x":0.0,"y":0.0,"z":0.0},{"x":-0.05699501186609268,"y":-0.030519425868988038,"z":-0.0337941013276577},{"x":-0.10104375332593918,"y":0.018380463123321534,"z":0.03990456461906433},{"x":0.0,"y":0.0,"z":0.0},{"x":0.0006988160312175751,"y":0.006475575268268585,"z":-0.04521678015589714},{"x":0.10210980474948883,"y":0.03326445817947388,"z":0.028461337089538575},{"x":0.0,"y":0.0,"z":0.0},{"x":0.05348876118659973,"y":-0.02520585060119629,"z":-0.043138232082128528},{"x":0.10210980474948883,"y":0.03326445817947388,"z":0.02846134454011917},{"x":0.0,"y":0.0,"z":0.0},{"x":-0.05403857305645943,"y":-0.02751000225543976,"z":-0.03959836810827255},{"x":-0.21459364891052247,"y":-0.02726861834526062,"z":0.04327914118766785},{"x":0.0,"y":0.0,"z":0.0},{"x":-0.21459364891052247,"y":-0.02726861834526062,"z":0.04327912628650665},{"x":-0.10104375332593918,"y":0.018380463123321534,"z":0.03990456461906433},{"x":0.0,"y":0.0,"z":0.0},{"x":0.10210980474948883,"y":0.03326445817947388,"z":0.02846134454011917},{"x":0.21829774975776673,"y":-0.01855340600013733,"z":0.034032851457595828},{"x":0.0,"y":0.0,"z":0.0},{"x":0.2182977795600891,"y":-0.018553420901298524,"z":0.034032851457595828},{"x":0.05348876118659973,"y":-0.02520585060119629,"z":-0.043138232082128528},{"x":0.0,"y":0.0,"z":0.0},{"x":-0.00014511775225400925,"y":0.006041206419467926,"z":-0.04527900367975235},{"x":-0.0007897466421127319,"y":0.08485305309295654,"z":0.04726848006248474},{"x":0.0,"y":0.0,"z":0.0},{"x":-0.0007798299193382263,"y":0.08364059031009674,"z":0.045844681560993198},{"x":0.10171341150999069,"y":0.03315974771976471,"z":0.028173357248306276},{"x":0.0,"y":0.0,"z":0.0},{"x":-0.0007897466421127319,"y":0.08485306054353714,"z":0.047268472611904147},{"x":-0.10104375332593918,"y":0.018380463123321534,"z":0.03990456461906433},{"x":0.0,"y":0.0,"z":0.0},{"x":-0.025426581501960756,"y":-0.017098546028137208,"z":-0.07814061641693115},{"x":-0.00013269856572151184,"y":-0.003459148108959198,"z":-0.07313401252031326},{"x":0.0,"y":0.0,"z":0.0},{"x":-0.00020465441048145294,"y":-0.004197120666503906,"z":-0.07519315183162689},{"x":0.024516776204109193,"y":-0.015758514404296876,"z":-0.07573369145393372},{"x":0.0,"y":0.0,"z":0.0},{"x":0.024516776204109193,"y":-0.01575849950313568,"z":-0.07573369145393372},{"x":-0.0029567284509539606,"y":-0.03242237865924835,"z":-0.1539490520954132},{"x":0.0,"y":0.0,"z":0.0},{"x":-0.025426581501960756,"y":-0.017098546028137208,"z":-0.07814061641693115},{"x":-0.002943676896393299,"y":-0.03228852152824402,"z":-0.1535755693912506},{"x":0.0,"y":0.0,"z":0.0},{"x":0.04609294608235359,"y":0.06055441498756409,"z":0.03776314854621887},{"x":-0.0004383958876132965,"y":0.041897185146808627,"z":-0.003173910081386566},{"x":0.0,"y":0.0,"z":0.0},{"x":-0.00044347718358039856,"y":0.042518384754657748,"z":-0.002444446086883545},{"x":0.04885358363389969,"y":0.01919621229171753,"z":-0.0102308951318264},{"x":0.0,"y":0.0,"z":0.0},{"x":0.04750938341021538,"y":0.018841125071048738,"z":-0.011207494884729386},{"x":0.045133862644433978,"y":0.06102678179740906,"z":0.037928506731987},{"x":0.0,"y":0.0,"z":0.0},{"x":-0.04267757758498192,"y":0.057079680263996127,"z":0.04419170320034027},{"x":-0.0004306882619857788,"y":0.0409548282623291,"z":-0.004280507564544678},{"x":0.0,"y":0.0,"z":0.0},{"x":-0.0004457477480173111,"y":0.042796045541763309,"z":-0.0021183937788009645},{"x":-0.04506586864590645,"y":0.01188061386346817,"z":-0.006856240332126617},{"x":0.0,"y":0.0,"z":0.0},{"x":-0.046188950538635257,"y":0.012011021375656128,"z":-0.005918078124523163},{"x":-0.040936429053545,"y":0.05823413282632828,"z":0.044319599866867068},{"x":0.0,"y":0.0,"z":0.0},{"x":0.10062148422002793,"y":0.032871298491954806,"z":0.02738003432750702},{"x":0.24840965867042542,"y":-0.032889723777770999,"z":0.08850294351577759},{"x":0.0,"y":0.0,"z":0.0},{"x":0.2182977795600891,"y":-0.018553420901298524,"z":0.034032851457595828},{"x":0.2484097182750702,"y":-0.032889723777770999,"z":0.0885029137134552},{"x":0.0,"y":0.0,"z":0.0},{"x":-0.21459364891052247,"y":-0.02726861834526062,"z":0.04327912628650665},{"x":-0.250993013381958,"y":-0.03534713387489319,"z":0.0805206298828125},{"x":0.0,"y":0.0,"z":0.0},{"x":-0.25060856342315676,"y":-0.03526180982589722,"z":0.0801272839307785},{"x":-0.10104375332593918,"y":0.018380463123321534,"z":0.03990456461906433},{"x":0.0,"y":0.0,"z":0.0},{"x":-0.005081080831587315,"y":-0.054209738969802859,"z":-0.21474148333072663},{"x":0.0005459561944007874,"y":-0.03595799207687378,"z":0.07110866904258728},{"x":0.0,"y":0.0,"z":0.0},{"x":0.0005323765799403191,"y":-0.0360020250082016,"z":0.0704188346862793},{"x":-0.05517883226275444,"y":-0.031389594078063968,"z":-0.04024842754006386},{"x":0.0,"y":0.0,"z":0.0},{"x":0.0005326215177774429,"y":-0.036001235246658328,"z":0.07043129205703736},{"x":0.04667042940855026,"y":-0.021093040704727174,"z":-0.04340605437755585},{"x":0.0,"y":0.0,"z":0.0},{"x":0.0005459561944007874,"y":-0.035957977175712588,"z":0.07110866904258728},{"x":-0.24344155192375184,"y":-0.03367115557193756,"z":0.07279443740844727},{"x":0.0,"y":0.0,"z":0.0},{"x":0.0005459561944007874,"y":-0.035957977175712588,"z":0.07110866904258728},{"x":0.2404632270336151,"y":-0.02935376763343811,"z":0.08521635830402374},{"x":0.0,"y":0.0,"z":0.0},{"x":0.0005459561944007874,"y":-0.035957977175712588,"z":0.07110866904258728},{"x":-0.0004340317100286484,"y":0.04136357456445694,"z":-0.003800526261329651},{"x":0.0,"y":0.0,"z":0.0},{"x":0.00036709103733301163,"y":-0.03653813898563385,"z":0.062022432684898379},{"x":0.095561183989048,"y":0.03153456747531891,"z":0.023703575134277345},{"x":0.0,"y":0.0,"z":0.0},{"x":0.003829820081591606,"y":-0.034935832023620608,"z":0.062296062707901},{"x":-0.09553234279155731,"y":0.017740502953529359,"z":0.03530063480138779},{"x":0.0,"y":0.0,"z":0.0},{"x":0.07105491310358048,"y":-0.004081279039382935,"z":-0.01727023348212242},{"x":0.08769126236438751,"y":-0.023825272917747499,"z":-0.027123093605041505},{"x":0.0,"y":0.0,"z":0.0},{"x":0.08716960996389389,"y":-0.023846328258514406,"z":-0.027367353439331056},{"x":0.09361228346824646,"y":-0.023586273193359376,"z":-0.024350598454475404},{"x":0.0,"y":0.0,"z":0.0},{"x":0.08947950601577759,"y":-0.0237530916929245,"z":-0.026285752654075624},{"x":0.08497077971696854,"y":-0.023935094475746156,"z":-0.02839694544672966},{"x":0.0,"y":0.0,"z":0.0},{"x":0.08914437890052796,"y":-0.023766621947288514,"z":-0.026442676782608033},{"x":0.08045350760221482,"y":0.007221207022666931,"z":-0.003429822623729706},{"x":0.0,"y":0.0,"z":0.0},{"x":-0.06355540454387665,"y":-0.023236528038978578,"z":-0.022817794233560563},{"x":-0.06566004455089569,"y":-0.020900100469589235,"z":-0.01929648593068123},{"x":0.0,"y":0.0,"z":0.0},{"x":-0.07799988240003586,"y":-0.02747398614883423,"z":-0.02722969278693199},{"x":-0.07954763621091843,"y":-0.0054830461740493778,"z":0.003939077258110046},{"x":0.0,"y":0.0,"z":0.0},{"x":-0.07805376499891281,"y":-0.007141441106796265,"z":0.0014396458864212037},{"x":-0.10163511335849762,"y":-0.027438446879386903,"z":-0.015029337257146836},{"x":0.0,"y":0.0,"z":0.0},{"x":-0.0890495628118515,"y":-0.02745737135410309,"z":-0.021525919437408448},{"x":-0.09085507690906525,"y":0.011919260025024414,"z":-0.016333557665348054},{"x":0.0,"y":0.0,"z":0.0},{"x":-0.09077285975217819,"y":0.010126270353794098,"z":-0.01656997948884964},{"x":-0.07588404417037964,"y":-0.009550116956233979,"z":-0.0021905452013015749},{"x":0.0,"y":0.0,"z":0.0},{"x":0.07397150993347168,"y":-0.024379074573516847,"z":-0.033547308295965198},{"x":0.07456571608781815,"y":0.018776655197143556,"z":-0.031228158622980119},{"x":0.0,"y":0.0,"z":0.0},{"x":0.07456571608781815,"y":0.018776647746562959,"z":-0.03122815489768982},{"x":0.0706498995423317,"y":-0.004568338394165039,"z":-0.01786666363477707},{"x":0.0,"y":0.0,"z":0.0},{"x":-0.09085506945848465,"y":0.01191924512386322,"z":-0.016333550214767457},{"x":-0.05403859168291092,"y":-0.027510017156600953,"z":-0.039598360657691959},{"x":0.0,"y":0.0,"z":0.0},{"x":0.07456571608781815,"y":0.018776647746562959,"z":-0.03122815489768982},{"x":0.05348876118659973,"y":-0.02520585060119629,"z":-0.043138232082128528},{"x":0.0,"y":0.0,"z":0.0},{"x":-0.09021822363138199,"y":-0.001969866454601288,"z":-0.018165022134780885},{"x":-0.0800965204834938,"y":0.00039718300104141235,"z":-0.023132018744945527},{"x":0.0,"y":0.0,"z":0.0},{"x":-0.09033104032278061,"y":0.0004905536770820618,"z":-0.017840582877397538},{"x":-0.07722613960504532,"y":-0.02747514843940735,"z":-0.027629096060991288},{"x":0.0,"y":0.0,"z":0.0},{"x":-0.08041679114103317,"y":-0.02747035026550293,"z":-0.025982100516557695},{"x":-0.09061232209205628,"y":0.006625011563301086,"z":-0.01703166961669922},{"x":0.0,"y":0.0,"z":0.0},{"x":-0.0798664316534996,"y":0.00015076249837875366,"z":-0.023277416825294496},{"x":-0.07696595042943955,"y":-0.02747553586959839,"z":-0.027763403952121736},{"x":0.0,"y":0.0,"z":0.0},{"x":0.07097168266773224,"y":-0.004181370139122009,"z":-0.017392799258232118},{"x":0.06488632410764694,"y":-0.011499449610710144,"z":-0.026354126632213594},{"x":0.0,"y":0.0,"z":0.0},{"x":0.07431407272815705,"y":0.0005004182457923889,"z":-0.03221030533313751},{"x":0.06568332761526108,"y":0.00024124234914779663,"z":-0.036247383803129199},{"x":0.0,"y":0.0,"z":0.0},{"x":0.06554782390594483,"y":-0.00004152953624725342,"z":-0.03632395341992378},{"x":0.06680906563997269,"y":-0.024668172001838685,"z":-0.0369010865688324},{"x":0.0,"y":0.0,"z":0.0},{"x":0.06789325922727585,"y":-0.024624422192573549,"z":-0.0363934226334095},{"x":0.07437268644571305,"y":0.004757598042488098,"z":-0.03198152780532837},{"x":0.0,"y":0.0,"z":0.0},{"x":-0.05403856933116913,"y":-0.02751000225543976,"z":-0.03959837555885315},{"x":0.0008432269096374512,"y":0.0065498948097229,"z":-0.04520612955093384},{"x":0.0,"y":0.0,"z":0.0},{"x":0.0008432231843471527,"y":0.006549902260303497,"z":-0.04520612955093384},{"x":0.05348876118659973,"y":-0.02520585060119629,"z":-0.04313823580741882},{"x":0.0,"y":0.0,"z":0.0},{"x":0.0008432231843471527,"y":0.006549902260303497,"z":-0.04520612955093384},{"x":-0.005199342966079712,"y":-0.05542263388633728,"z":-0.21812577545642854},{"x":0.0,"y":0.0,"z":0.0},{"x":0.05348876118659973,"y":-0.02520585060119629,"z":-0.043138232082128528},{"x":-0.005150701850652695,"y":-0.05492377281188965,"z":-0.21673382818698884},{"x":0.0,"y":0.0,"z":0.0},{"x":-0.056995004415512088,"y":-0.030519425868988038,"z":-0.033794105052948},{"x":-0.0051912469789385799,"y":-0.05533958971500397,"z":-0.21789409220218659},{"x":0.0,"y":0.0,"z":0.0},{"x":0.0008432231843471527,"y":0.006549902260303497,"z":-0.04520612955093384},{"x":-0.10104374587535858,"y":0.018380463123321534,"z":0.03990456461906433},{"x":0.0,"y":0.0,"z":0.0},{"x":-0.05699501186609268,"y":-0.030519425868988038,"z":-0.0337941013276577},{"x":-0.10104375332593918,"y":0.018380463123321534,"z":0.03990456461906433},{"x":0.0,"y":0.0,"z":0.0},{"x":0.0006988160312175751,"y":0.006475575268268585,"z":-0.04521678015589714},{"x":0.10210980474948883,"y":0.03326445817947388,"z":0.028461337089538575},{"x":0.0,"y":0.0,"z":0.0},{"x":0.05348876118659973,"y":-0.02520585060119629,"z":-0.043138232082128528},{"x":0.10210980474948883,"y":0.03326445817947388,"z":0.02846134454011917},{"x":0.0,"y":0.0,"z":0.0},{"x":-0.05403857305645943,"y":-0.02751000225543976,"z":-0.03959836810827255},{"x":-0.21459364891052247,"y":-0.02726861834526062,"z":0.04327914118766785},{"x":0.0,"y":0.0,"z":0.0},{"x":-0.21459364891052247,"y":-0.02726861834526062,"z":0.04327912628650665},{"x":-0.10104375332593918,"y":0.018380463123321534,"z":0.03990456461906433},{"x":0.0,"y":0.0,"z":0.0},{"x":0.10210980474948883,"y":0.03326445817947388,"z":0.02846134454011917},{"x":0.21829774975776673,"y":-0.01855340600013733,"z":0.034032851457595828},{"x":0.0,"y":0.0,"z":0.0},{"x":0.2182977795600891,"y":-0.018553420901298524,"z":0.034032851457595828},{"x":0.05348876118659973,"y":-0.02520585060119629,"z":-0.043138232082128528},{"x":0.0,"y":0.0,"z":0.0},{"x":-0.00014511775225400925,"y":0.006041206419467926,"z":-0.04527900367975235},{"x":-0.0007897466421127319,"y":0.08485305309295654,"z":0.04726848006248474},{"x":0.0,"y":0.0,"z":0.0},{"x":-0.0007798299193382263,"y":0.08364059031009674,"z":0.045844681560993198},{"x":0.10171341150999069,"y":0.03315974771976471,"z":0.028173357248306276},{"x":0.0,"y":0.0,"z":0.0},{"x":-0.0007897466421127319,"y":0.08485306054353714,"z":0.047268472611904147},{"x":-0.10104375332593918,"y":0.018380463123321534,"z":0.03990456461906433},{"x":0.0,"y":0.0,"z":0.0},{"x":-0.025426581501960756,"y":-0.017098546028137208,"z":-0.07814061641693115},{"x":-0.00013269856572151184,"y":-0.003459148108959198,"z":-0.07313401252031326},{"x":0.0,"y":0.0,"z":0.0},{"x":-0.00020465441048145294,"y":-0.004197120666503906,"z":-0.07519315183162689},{"x":0.024516776204109193,"y":-0.015758514404296876,"z":-0.07573369145393372},{"x":0.0,"y":0.0,"z":0.0},{"x":0.024516776204109193,"y":-0.01575849950313568,"z":-0.07573369145393372},{"x":-0.0029567284509539606,"y":-0.03242237865924835,"z":-0.1539490520954132},{"x":0.0,"y":0.0,"z":0.0},{"x":-0.025426581501960756,"y":-0.017098546028137208,"z":-0.07814061641693115},{"x":-0.002943676896393299,"y":-0.03228852152824402,"z":-0.1535755693912506},{"x":0.0,"y":0.0,"z":0.0},{"x":0.04609294608235359,"y":0.06055441498756409,"z":0.03776314854621887},{"x":-0.0004383958876132965,"y":0.041897185146808627,"z":-0.003173910081386566},{"x":0.0,"y":0.0,"z":0.0},{"x":-0.00044347718358039856,"y":0.042518384754657748,"z":-0.002444446086883545},{"x":0.04885358363389969,"y":0.01919621229171753,"z":-0.0102308951318264},{"x":0.0,"y":0.0,"z":0.0},{"x":0.04750938341021538,"y":0.018841125071048738,"z":-0.011207494884729386},{"x":0.045133862644433978,"y":0.06102678179740906,"z":0.037928506731987},{"x":0.0,"y":0.0,"z":0.0},{"x":-0.04267757758498192,"y":0.057079680263996127,"z":0.04419170320034027},{"x":-0.0004306882619857788,"y":0.0409548282623291,"z":-0.004280507564544678},{"x":0.0,"y":0.0,"z":0.0},{"x":-0.0004457477480173111,"y":0.042796045541763309,"z":-0.0021183937788009645},{"x":-0.04506586864590645,"y":0.01188061386346817,"z":-0.006856240332126617},{"x":0.0,"y":0.0,"z":0.0},{"x":-0.046188950538635257,"y":0.012011021375656128,"z":-0.005918078124523163},{"x":-0.040936429053545,"y":0.05823413282632828,"z":0.044319599866867068},{"x":0.0,"y":0.0,"z":0.0},{"x":0.10062148422002793,"y":0.032871298491954806,"z":0.02738003432750702},{"x":0.24840965867042542,"y":-0.032889723777770999,"z":0.08850294351577759},{"x":0.0,"y":0.0,"z":0.0},{"x":0.2182977795600891,"y":-0.018553420901298524,"z":0.034032851457595828},{"x":0.2484097182750702,"y":-0.032889723777770999,"z":0.0885029137134552},{"x":0.0,"y":0.0,"z":0.0},{"x":-0.21459364891052247,"y":-0.02726861834526062,"z":0.04327912628650665},{"x":-0.250993013381958,"y":-0.03534713387489319,"z":0.0805206298828125},{"x":0.0,"y":0.0,"z":0.0},{"x":-0.25060856342315676,"y":-0.03526180982589722,"z":0.0801272839307785},{"x":-0.10104375332593918,"y":0.018380463123321534,"z":0.03990456461906433},{"x":0.0,"y":0.0,"z":0.0},{"x":-0.005081080831587315,"y":-0.054209738969802859,"z":-0.21474148333072663},{"x":0.0005459561944007874,"y":-0.03595799207687378,"z":0.07110866904258728},{"x":0.0,"y":0.0,"z":0.0},{"x":0.0005323765799403191,"y":-0.0360020250082016,"z":0.0704188346862793},{"x":-0.05517883226275444,"y":-0.031389594078063968,"z":-0.04024842754006386},{"x":0.0,"y":0.0,"z":0.0},{"x":0.0005326215177774429,"y":-0.036001235246658328,"z":0.07043129205703736},{"x":0.04667042940855026,"y":-0.021093040704727174,"z":-0.04340605437755585},{"x":0.0,"y":0.0,"z":0.0},{"x":0.0005459561944007874,"y":-0.035957977175712588,"z":0.07110866904258728},{"x":-0.24344155192375184,"y":-0.03367115557193756,"z":0.07279443740844727},{"x":0.0,"y":0.0,"z":0.0},{"x":0.0005459561944007874,"y":-0.035957977175712588,"z":0.07110866904258728},{"x":0.2404632270336151,"y":-0.02935376763343811,"z":0.08521635830402374},{"x":0.0,"y":0.0,"z":0.0},{"x":0.0005459561944007874,"y":-0.035957977175712588,"z":0.07110866904258728},{"x":-0.0004340317100286484,"y":0.04136357456445694,"z":-0.003800526261329651},{"x":0.0,"y":0.0,"z":0.0},{"x":0.00036709103733301163,"y":-0.03653813898563385,"z":0.062022432684898379},{"x":0.095561183989048,"y":0.03153456747531891,"z":0.023703575134277345},{"x":0.0,"y":0.0,"z":0.0},{"x":0.003829820081591606,"y":-0.034935832023620608,"z":0.062296062707901},{"x":-0.09553234279155731,"y":0.017740502953529359,"z":0.03530063480138779},{"x":0.0,"y":0.0,"z":0.0},{"x":0.07105491310358048,"y":-0.004081279039382935,"z":-0.01727023348212242},{"x":0.08769126236438751,"y":-0.023825272917747499,"z":-0.027123093605041505},{"x":0.0,"y":0.0,"z":0.0},{"x":0.08716960996389389,"y":-0.023846328258514406,"z":-0.027367353439331056},{"x":0.09361228346824646,"y":-0.023586273193359376,"z":-0.024350598454475404},{"x":0.0,"y":0.0,"z":0.0},{"x":0.08947950601577759,"y":-0.0237530916929245,"z":-0.026285752654075624},{"x":0.08497077971696854,"y":-0.023935094475746156,"z":-0.02839694544672966},{"x":0.0,"y":0.0,"z":0.0},{"x":0.08914437890052796,"y":-0.023766621947288514,"z":-0.026442676782608033},{"x":0.08045350760221482,"y":0.007221207022666931,"z":-0.003429822623729706},{"x":0.0,"y":0.0,"z":0.0},{"x":-0.06355540454387665,"y":-0.023236528038978578,"z":-0.022817794233560563},{"x":-0.06566004455089569,"y":-0.020900100469589235,"z":-0.01929648593068123},{"x":0.0,"y":0.0,"z":0.0},{"x":-0.07799988240003586,"y":-0.02747398614883423,"z":-0.02722969278693199},{"x":-0.07954763621091843,"y":-0.0054830461740493778,"z":0.003939077258110046},{"x":0.0,"y":0.0,"z":0.0},{"x":-0.07805376499891281,"y":-0.007141441106796265,"z":0.0014396458864212037},{"x":-0.10163511335849762,"y":-0.027438446879386903,"z":-0.015029337257146836},{"x":0.0,"y":0.0,"z":0.0},{"x":-0.0890495628118515,"y":-0.02745737135410309,"z":-0.021525919437408448},{"x":-0.09085507690906525,"y":0.011919260025024414,"z":-0.016333557665348054},{"x":0.0,"y":0.0,"z":0.0},{"x":-0.09077285975217819,"y":0.010126270353794098,"z":-0.01656997948884964},{"x":-0.07588404417037964,"y":-0.009550116956233979,"z":-0.0021905452013015749},{"x":0.0,"y":0.0,"z":0.0},{"x":0.07397150993347168,"y":-0.024379074573516847,"z":-0.033547308295965198},{"x":0.07456571608781815,"y":0.018776655197143556,"z":-0.031228158622980119},{"x":0.0,"y":0.0,"z":0.0},{"x":0.07456571608781815,"y":0.018776647746562959,"z":-0.03122815489768982},{"x":0.0706498995423317,"y":-0.004568338394165039,"z":-0.01786666363477707},{"x":0.0,"y":0.0,"z":0.0},{"x":-0.09085506945848465,"y":0.01191924512386322,"z":-0.016333550214767457},{"x":-0.05403859168291092,"y":-0.027510017156600953,"z":-0.039598360657691959},{"x":0.0,"y":0.0,"z":0.0},{"x":0.07456571608781815,"y":0.018776647746562959,"z":-0.03122815489768982},{"x":0.05348876118659973,"y":-0.02520585060119629,"z":-0.043138232082128528},{"x":0.0,"y":0.0,"z":0.0},{"x":-0.09021822363138199,"y":-0.001969866454601288,"z":-0.018165022134780885},{"x":-0.0800965204834938,"y":0.00039718300104141235,"z":-0.023132018744945527},{"x":0.0,"y":0.0,"z":0.0},{"x":-0.09033104032278061,"y":0.0004905536770820618,"z":-0.017840582877397538},{"x":-0.07722613960504532,"y":-0.02747514843940735,"z":-0.027629096060991288},{"x":0.0,"y":0.0,"z":0.0},{"x":-0.08041679114103317,"y":-0.02747035026550293,"z":-0.025982100516557695},{"x":-0.09061232209205628,"y":0.006625011563301086,"z":-0.01703166961669922},{"x":0.0,"y":0.0,"z":0.0},{"x":-0.0798664316534996,"y":0.00015076249837875366,"z":-0.023277416825294496},{"x":-0.07696595042943955,"y":-0.02747553586959839,"z":-0.027763403952121736},{"x":0.0,"y":0.0,"z":0.0},{"x":0.07097168266773224,"y":-0.004181370139122009,"z":-0.017392799258232118},{"x":0.06488632410764694,"y":-0.011499449610710144,"z":-0.026354126632213594},{"x":0.0,"y":0.0,"z":0.0},{"x":0.07431407272815705,"y":0.0005004182457923889,"z":-0.03221030533313751},{"x":0.06568332761526108,"y":0.00024124234914779663,"z":-0.036247383803129199},{"x":0.0,"y":0.0,"z":0.0},{"x":0.06554782390594483,"y":-0.00004152953624725342,"z":-0.03632395341992378},{"x":0.06680906563997269,"y":-0.024668172001838685,"z":-0.0369010865688324},{"x":0.0,"y":0.0,"z":0.0},{"x":0.06789325922727585,"y":-0.024624422192573549,"z":-0.0363934226334095},{"x":0.07437268644571305,"y":0.004757598042488098,"z":-0.03198152780532837},{"x":0.0,"y":0.0,"z":0.0},{"x":0.005781479179859161,"y":0.02087956666946411,"z":0.00654640793800354},{"x":0.016698352992534639,"y":0.06060445308685303,"z":0.008478164672851563},{"x":0.0,"y":0.0,"z":0.0},{"x":0.0165153369307518,"y":0.059938400983810428,"z":0.008445784449577332},{"x":0.028234712779521943,"y":0.03069669008255005,"z":0.01414555311203003},{"x":0.0,"y":0.0,"z":0.0},{"x":0.028090260922908784,"y":0.031057171523571016,"z":0.014075301587581635},{"x":0.005795486271381378,"y":0.02093043178319931,"z":0.006548896431922913},{"x":0.0,"y":0.0,"z":0.0},{"x":0.005781508982181549,"y":0.020879574120044709,"z":0.006546422839164734},{"x":-0.04262157529592514,"y":-0.0020103156566619875,"z":-0.00793735682964325},{"x":0.0,"y":0.0,"z":0.0},{"x":0.041909199208021167,"y":0.008892744779586792,"z":0.0024146735668182375},{"x":-0.017924807965755464,"y":-0.020367830991744996,"z":-0.020185798406600953},{"x":0.0,"y":0.0,"z":0.0},{"x":0.030613310635089875,"y":0.013039886951446534,"z":0.031695783138275149},{"x":-0.0331449881196022,"y":-0.01736605167388916,"z":0.006085023283958435},{"x":0.0,"y":0.0,"z":0.0},{"x":-0.042621515691280368,"y":-0.002010304480791092,"z":-0.007937334477901459},{"x":-0.017269648611545564,"y":-0.02004743367433548,"z":-0.019938331097364427},{"x":0.0,"y":0.0,"z":0.0},{"x":0.028234727680683137,"y":0.030696697533130647,"z":0.014145568013191224},{"x":0.041909169405698779,"y":0.008892744779586792,"z":0.0024146661162376405},{"x":0.0,"y":0.0,"z":0.0},{"x":0.0292857363820076,"y":0.012406773865222931,"z":0.03116251528263092},{"x":0.041046109050512317,"y":0.008470676839351654,"z":0.002088673412799835},{"x":0.0,"y":0.0,"z":0.0},{"x":-0.0331449881196022,"y":-0.01736605539917946,"z":0.006085023283958435},{"x":-0.017924822866916658,"y":-0.020367834717035295,"z":-0.02018580213189125},{"x":0.0,"y":0.0,"z":0.0},{"x":-0.042621515691280368,"y":-0.002010304480791092,"z":-0.007937334477901459},{"x":-0.0331449881196022,"y":-0.01736605539917946,"z":0.006085023283958435},{"x":0.0,"y":0.0,"z":0.0},{"x":0.013453103601932526,"y":-0.005023110657930374,"z":-0.00833374634385109},{"x":0.05823036655783653,"y":-0.016667485237121583,"z":-0.017071276903152467},{"x":0.0,"y":0.0,"z":0.0},{"x":0.041909169405698779,"y":0.008892744779586792,"z":0.0024146661162376405},{"x":0.05823039636015892,"y":-0.016667485237121583,"z":-0.017071276903152467},{"x":0.0,"y":0.0,"z":0.0},{"x":0.0297636017203331,"y":0.01263466477394104,"z":0.03135446459054947},{"x":0.026932530105113984,"y":-0.00761258602142334,"z":0.06628614664077759},{"x":0.0,"y":0.0,"z":0.0},{"x":0.026932530105113984,"y":-0.00761258602142334,"z":0.06628614664077759},{"x":0.008378855884075165,"y":0.002436414361000061,"z":0.022764533758163453},{"x":0.0,"y":0.0,"z":0.0},{"x":0.03061329573392868,"y":0.013039879500865937,"z":0.03169577568769455},{"x":0.028234727680683137,"y":0.030696697533130647,"z":0.014145568013191224},{"x":0.0,"y":0.0,"z":0.0},{"x":-0.042621515691280368,"y":-0.002010304480791092,"z":-0.007937334477901459},{"x":-0.056614235043525699,"y":-0.030898064374923707,"z":-0.022020235657691957},{"x":0.0,"y":0.0,"z":0.0},{"x":-0.05578266829252243,"y":-0.029181290417909623,"z":-0.021183308213949205},{"x":-0.017924822866916658,"y":-0.020367834717035295,"z":-0.02018580213189125},{"x":0.0,"y":0.0,"z":0.0},{"x":-0.0331449881196022,"y":-0.01736605539917946,"z":0.006085023283958435},{"x":-0.05661424249410629,"y":-0.030898060649633409,"z":-0.022020243108272554},{"x":0.0,"y":0.0,"z":0.0}],"quads":[]} \ No newline at end of file diff --git a/Assets/AssetSpace/missile.pixelgon.meta b/Assets/AssetSpace/missile.json.meta similarity index 62% rename from Assets/AssetSpace/missile.pixelgon.meta rename to Assets/AssetSpace/missile.json.meta index 1cd8d0b..3679222 100644 --- a/Assets/AssetSpace/missile.pixelgon.meta +++ b/Assets/AssetSpace/missile.json.meta @@ -1,6 +1,6 @@ fileFormatVersion: 2 -guid: 3fd529051a22f6343857011fec566d37 -DefaultImporter: +guid: c4d3e5cdfa0bf674d816bc9e2a0f9f8d +TextScriptImporter: externalObjects: {} userData: assetBundleName: diff --git a/Assets/AssetSpace/missile.pixelgon b/Assets/AssetSpace/missile.pixelgon deleted file mode 100644 index dc21bec..0000000 Binary files a/Assets/AssetSpace/missile.pixelgon and /dev/null differ diff --git a/Assets/AssetSpace/spaceship.json b/Assets/AssetSpace/spaceship.json new file mode 100644 index 0000000..51795b3 --- /dev/null +++ b/Assets/AssetSpace/spaceship.json @@ -0,0 +1 @@ +{"vectors":[{"x":0.0,"y":0.0,"z":0.0},{"x":0.05999999865889549,"y":-0.30000001192092898,"z":0.27000001072883608},{"x":0.27000001072883608,"y":-0.4300000071525574,"z":0.15000000596046449},{"x":0.0,"y":0.0,"z":0.0},{"x":-0.05403856933116913,"y":-0.02751000225543976,"z":-0.03959837555885315},{"x":0.0008432269096374512,"y":0.0065498948097229,"z":-0.04520612955093384},{"x":0.0,"y":0.0,"z":0.0},{"x":0.0008432231843471527,"y":0.006549902260303497,"z":-0.04520612955093384},{"x":0.05348876118659973,"y":-0.02520585060119629,"z":-0.04313823580741882},{"x":0.0,"y":0.0,"z":0.0},{"x":0.0008432231843471527,"y":0.006549902260303497,"z":-0.04520612955093384},{"x":-0.005199342966079712,"y":-0.05542263388633728,"z":-0.21812577545642854},{"x":0.0,"y":0.0,"z":0.0},{"x":0.05348876118659973,"y":-0.02520585060119629,"z":-0.043138232082128528},{"x":-0.005150701850652695,"y":-0.05492377281188965,"z":-0.21673382818698884},{"x":0.0,"y":0.0,"z":0.0},{"x":-0.056995004415512088,"y":-0.030519425868988038,"z":-0.033794105052948},{"x":-0.0051912469789385799,"y":-0.05533958971500397,"z":-0.21789409220218659},{"x":0.0,"y":0.0,"z":0.0},{"x":0.0008432231843471527,"y":0.006549902260303497,"z":-0.04520612955093384},{"x":-0.10104374587535858,"y":0.018380463123321534,"z":0.03990456461906433},{"x":0.0,"y":0.0,"z":0.0},{"x":-0.05699501186609268,"y":-0.030519425868988038,"z":-0.0337941013276577},{"x":-0.10104375332593918,"y":0.018380463123321534,"z":0.03990456461906433},{"x":0.0,"y":0.0,"z":0.0},{"x":0.0006988160312175751,"y":0.006475575268268585,"z":-0.04521678015589714},{"x":0.10210980474948883,"y":0.03326445817947388,"z":0.028461337089538575},{"x":0.0,"y":0.0,"z":0.0},{"x":0.05348876118659973,"y":-0.02520585060119629,"z":-0.043138232082128528},{"x":0.10210980474948883,"y":0.03326445817947388,"z":0.02846134454011917},{"x":0.0,"y":0.0,"z":0.0},{"x":-0.05403857305645943,"y":-0.02751000225543976,"z":-0.03959836810827255},{"x":-0.21459364891052247,"y":-0.02726861834526062,"z":0.04327914118766785},{"x":0.0,"y":0.0,"z":0.0},{"x":-0.21459364891052247,"y":-0.02726861834526062,"z":0.04327912628650665},{"x":-0.10104375332593918,"y":0.018380463123321534,"z":0.03990456461906433},{"x":0.0,"y":0.0,"z":0.0},{"x":0.10210980474948883,"y":0.03326445817947388,"z":0.02846134454011917},{"x":0.21829774975776673,"y":-0.01855340600013733,"z":0.034032851457595828},{"x":0.0,"y":0.0,"z":0.0},{"x":0.2182977795600891,"y":-0.018553420901298524,"z":0.034032851457595828},{"x":0.05348876118659973,"y":-0.02520585060119629,"z":-0.043138232082128528},{"x":0.0,"y":0.0,"z":0.0},{"x":-0.00014511775225400925,"y":0.006041206419467926,"z":-0.04527900367975235},{"x":-0.0007897466421127319,"y":0.08485305309295654,"z":0.04726848006248474},{"x":0.0,"y":0.0,"z":0.0},{"x":-0.0007798299193382263,"y":0.08364059031009674,"z":0.045844681560993198},{"x":0.10171341150999069,"y":0.03315974771976471,"z":0.028173357248306276},{"x":0.0,"y":0.0,"z":0.0},{"x":-0.0007897466421127319,"y":0.08485306054353714,"z":0.047268472611904147},{"x":-0.10104375332593918,"y":0.018380463123321534,"z":0.03990456461906433},{"x":0.0,"y":0.0,"z":0.0},{"x":-0.025426581501960756,"y":-0.017098546028137208,"z":-0.07814061641693115},{"x":-0.00013269856572151184,"y":-0.003459148108959198,"z":-0.07313401252031326},{"x":0.0,"y":0.0,"z":0.0},{"x":-0.00020465441048145294,"y":-0.004197120666503906,"z":-0.07519315183162689},{"x":0.024516776204109193,"y":-0.015758514404296876,"z":-0.07573369145393372},{"x":0.0,"y":0.0,"z":0.0},{"x":0.024516776204109193,"y":-0.01575849950313568,"z":-0.07573369145393372},{"x":-0.0029567284509539606,"y":-0.03242237865924835,"z":-0.1539490520954132},{"x":0.0,"y":0.0,"z":0.0},{"x":-0.025426581501960756,"y":-0.017098546028137208,"z":-0.07814061641693115},{"x":-0.002943676896393299,"y":-0.03228852152824402,"z":-0.1535755693912506},{"x":0.0,"y":0.0,"z":0.0},{"x":0.04609294608235359,"y":0.06055441498756409,"z":0.03776314854621887},{"x":-0.0004383958876132965,"y":0.041897185146808627,"z":-0.003173910081386566},{"x":0.0,"y":0.0,"z":0.0},{"x":-0.00044347718358039856,"y":0.042518384754657748,"z":-0.002444446086883545},{"x":0.04885358363389969,"y":0.01919621229171753,"z":-0.0102308951318264},{"x":0.0,"y":0.0,"z":0.0},{"x":0.04750938341021538,"y":0.018841125071048738,"z":-0.011207494884729386},{"x":0.045133862644433978,"y":0.06102678179740906,"z":0.037928506731987},{"x":0.0,"y":0.0,"z":0.0},{"x":-0.04267757758498192,"y":0.057079680263996127,"z":0.04419170320034027},{"x":-0.0004306882619857788,"y":0.0409548282623291,"z":-0.004280507564544678},{"x":0.0,"y":0.0,"z":0.0},{"x":-0.0004457477480173111,"y":0.042796045541763309,"z":-0.0021183937788009645},{"x":-0.04506586864590645,"y":0.01188061386346817,"z":-0.006856240332126617},{"x":0.0,"y":0.0,"z":0.0},{"x":-0.046188950538635257,"y":0.012011021375656128,"z":-0.005918078124523163},{"x":-0.040936429053545,"y":0.05823413282632828,"z":0.044319599866867068},{"x":0.0,"y":0.0,"z":0.0},{"x":0.10062148422002793,"y":0.032871298491954806,"z":0.02738003432750702},{"x":0.24840965867042542,"y":-0.032889723777770999,"z":0.08850294351577759},{"x":0.0,"y":0.0,"z":0.0},{"x":0.2182977795600891,"y":-0.018553420901298524,"z":0.034032851457595828},{"x":0.2484097182750702,"y":-0.032889723777770999,"z":0.0885029137134552},{"x":0.0,"y":0.0,"z":0.0},{"x":-0.21459364891052247,"y":-0.02726861834526062,"z":0.04327912628650665},{"x":-0.250993013381958,"y":-0.03534713387489319,"z":0.0805206298828125},{"x":0.0,"y":0.0,"z":0.0},{"x":-0.25060856342315676,"y":-0.03526180982589722,"z":0.0801272839307785},{"x":-0.10104375332593918,"y":0.018380463123321534,"z":0.03990456461906433},{"x":0.0,"y":0.0,"z":0.0},{"x":-0.005081080831587315,"y":-0.054209738969802859,"z":-0.21474148333072663},{"x":0.0005459561944007874,"y":-0.03595799207687378,"z":0.07110866904258728},{"x":0.0,"y":0.0,"z":0.0},{"x":0.0005323765799403191,"y":-0.0360020250082016,"z":0.0704188346862793},{"x":-0.05517883226275444,"y":-0.031389594078063968,"z":-0.04024842754006386},{"x":0.0,"y":0.0,"z":0.0},{"x":0.0005326215177774429,"y":-0.036001235246658328,"z":0.07043129205703736},{"x":0.04667042940855026,"y":-0.021093040704727174,"z":-0.04340605437755585},{"x":0.0,"y":0.0,"z":0.0},{"x":0.0005459561944007874,"y":-0.035957977175712588,"z":0.07110866904258728},{"x":-0.24344155192375184,"y":-0.03367115557193756,"z":0.07279443740844727},{"x":0.0,"y":0.0,"z":0.0},{"x":0.0005459561944007874,"y":-0.035957977175712588,"z":0.07110866904258728},{"x":0.2404632270336151,"y":-0.02935376763343811,"z":0.08521635830402374},{"x":0.0,"y":0.0,"z":0.0},{"x":0.0005459561944007874,"y":-0.035957977175712588,"z":0.07110866904258728},{"x":-0.0004340317100286484,"y":0.04136357456445694,"z":-0.003800526261329651},{"x":0.0,"y":0.0,"z":0.0},{"x":0.00036709103733301163,"y":-0.03653813898563385,"z":0.062022432684898379},{"x":0.095561183989048,"y":0.03153456747531891,"z":0.023703575134277345},{"x":0.0,"y":0.0,"z":0.0},{"x":0.003829820081591606,"y":-0.034935832023620608,"z":0.062296062707901},{"x":-0.09553234279155731,"y":0.017740502953529359,"z":0.03530063480138779},{"x":0.0,"y":0.0,"z":0.0},{"x":0.07105491310358048,"y":-0.004081279039382935,"z":-0.01727023348212242},{"x":0.08769126236438751,"y":-0.023825272917747499,"z":-0.027123093605041505},{"x":0.0,"y":0.0,"z":0.0},{"x":0.08716960996389389,"y":-0.023846328258514406,"z":-0.027367353439331056},{"x":0.09361228346824646,"y":-0.023586273193359376,"z":-0.024350598454475404},{"x":0.0,"y":0.0,"z":0.0},{"x":0.08947950601577759,"y":-0.0237530916929245,"z":-0.026285752654075624},{"x":0.08497077971696854,"y":-0.023935094475746156,"z":-0.02839694544672966},{"x":0.0,"y":0.0,"z":0.0},{"x":0.08914437890052796,"y":-0.023766621947288514,"z":-0.026442676782608033},{"x":0.08045350760221482,"y":0.007221207022666931,"z":-0.003429822623729706},{"x":0.0,"y":0.0,"z":0.0},{"x":-0.06355540454387665,"y":-0.023236528038978578,"z":-0.022817794233560563},{"x":-0.06566004455089569,"y":-0.020900100469589235,"z":-0.01929648593068123},{"x":0.0,"y":0.0,"z":0.0},{"x":-0.07799988240003586,"y":-0.02747398614883423,"z":-0.02722969278693199},{"x":-0.07954763621091843,"y":-0.0054830461740493778,"z":0.003939077258110046},{"x":0.0,"y":0.0,"z":0.0},{"x":-0.07805376499891281,"y":-0.007141441106796265,"z":0.0014396458864212037},{"x":-0.10163511335849762,"y":-0.027438446879386903,"z":-0.015029337257146836},{"x":0.0,"y":0.0,"z":0.0},{"x":-0.0890495628118515,"y":-0.02745737135410309,"z":-0.021525919437408448},{"x":-0.09085507690906525,"y":0.011919260025024414,"z":-0.016333557665348054},{"x":0.0,"y":0.0,"z":0.0},{"x":-0.09077285975217819,"y":0.010126270353794098,"z":-0.01656997948884964},{"x":-0.07588404417037964,"y":-0.009550116956233979,"z":-0.0021905452013015749},{"x":0.0,"y":0.0,"z":0.0},{"x":0.07397150993347168,"y":-0.024379074573516847,"z":-0.033547308295965198},{"x":0.07456571608781815,"y":0.018776655197143556,"z":-0.031228158622980119},{"x":0.0,"y":0.0,"z":0.0},{"x":0.07456571608781815,"y":0.018776647746562959,"z":-0.03122815489768982},{"x":0.0706498995423317,"y":-0.004568338394165039,"z":-0.01786666363477707},{"x":0.0,"y":0.0,"z":0.0},{"x":-0.09085506945848465,"y":0.01191924512386322,"z":-0.016333550214767457},{"x":-0.05403859168291092,"y":-0.027510017156600953,"z":-0.039598360657691959},{"x":0.0,"y":0.0,"z":0.0},{"x":0.07456571608781815,"y":0.018776647746562959,"z":-0.03122815489768982},{"x":0.05348876118659973,"y":-0.02520585060119629,"z":-0.043138232082128528},{"x":0.0,"y":0.0,"z":0.0},{"x":-0.09021822363138199,"y":-0.001969866454601288,"z":-0.018165022134780885},{"x":-0.0800965204834938,"y":0.00039718300104141235,"z":-0.023132018744945527},{"x":0.0,"y":0.0,"z":0.0},{"x":-0.09033104032278061,"y":0.0004905536770820618,"z":-0.017840582877397538},{"x":-0.07722613960504532,"y":-0.02747514843940735,"z":-0.027629096060991288},{"x":0.0,"y":0.0,"z":0.0},{"x":-0.08041679114103317,"y":-0.02747035026550293,"z":-0.025982100516557695},{"x":-0.09061232209205628,"y":0.006625011563301086,"z":-0.01703166961669922},{"x":0.0,"y":0.0,"z":0.0},{"x":-0.0798664316534996,"y":0.00015076249837875366,"z":-0.023277416825294496},{"x":-0.07696595042943955,"y":-0.02747553586959839,"z":-0.027763403952121736},{"x":0.0,"y":0.0,"z":0.0},{"x":0.07097168266773224,"y":-0.004181370139122009,"z":-0.017392799258232118},{"x":0.06488632410764694,"y":-0.011499449610710144,"z":-0.026354126632213594},{"x":0.0,"y":0.0,"z":0.0},{"x":0.07431407272815705,"y":0.0005004182457923889,"z":-0.03221030533313751},{"x":0.06568332761526108,"y":0.00024124234914779663,"z":-0.036247383803129199},{"x":0.0,"y":0.0,"z":0.0},{"x":0.06554782390594483,"y":-0.00004152953624725342,"z":-0.03632395341992378},{"x":0.06680906563997269,"y":-0.024668172001838685,"z":-0.0369010865688324},{"x":0.0,"y":0.0,"z":0.0},{"x":0.06789325922727585,"y":-0.024624422192573549,"z":-0.0363934226334095},{"x":0.07437268644571305,"y":0.004757598042488098,"z":-0.03198152780532837},{"x":0.0,"y":0.0,"z":0.0},{"x":-0.05403856933116913,"y":-0.02751000225543976,"z":-0.03959837555885315},{"x":0.0008432269096374512,"y":0.0065498948097229,"z":-0.04520612955093384},{"x":0.0,"y":0.0,"z":0.0},{"x":0.0008432231843471527,"y":0.006549902260303497,"z":-0.04520612955093384},{"x":0.05348876118659973,"y":-0.02520585060119629,"z":-0.04313823580741882},{"x":0.0,"y":0.0,"z":0.0},{"x":0.0008432231843471527,"y":0.006549902260303497,"z":-0.04520612955093384},{"x":-0.005199342966079712,"y":-0.05542263388633728,"z":-0.21812577545642854},{"x":0.0,"y":0.0,"z":0.0},{"x":0.05348876118659973,"y":-0.02520585060119629,"z":-0.043138232082128528},{"x":-0.005150701850652695,"y":-0.05492377281188965,"z":-0.21673382818698884},{"x":0.0,"y":0.0,"z":0.0},{"x":-0.056995004415512088,"y":-0.030519425868988038,"z":-0.033794105052948},{"x":-0.0051912469789385799,"y":-0.05533958971500397,"z":-0.21789409220218659},{"x":0.0,"y":0.0,"z":0.0},{"x":0.0008432231843471527,"y":0.006549902260303497,"z":-0.04520612955093384},{"x":-0.10104374587535858,"y":0.018380463123321534,"z":0.03990456461906433},{"x":0.0,"y":0.0,"z":0.0},{"x":-0.05699501186609268,"y":-0.030519425868988038,"z":-0.0337941013276577},{"x":-0.10104375332593918,"y":0.018380463123321534,"z":0.03990456461906433},{"x":0.0,"y":0.0,"z":0.0},{"x":0.0006988160312175751,"y":0.006475575268268585,"z":-0.04521678015589714},{"x":0.10210980474948883,"y":0.03326445817947388,"z":0.028461337089538575},{"x":0.0,"y":0.0,"z":0.0},{"x":0.05348876118659973,"y":-0.02520585060119629,"z":-0.043138232082128528},{"x":0.10210980474948883,"y":0.03326445817947388,"z":0.02846134454011917},{"x":0.0,"y":0.0,"z":0.0},{"x":-0.05403857305645943,"y":-0.02751000225543976,"z":-0.03959836810827255},{"x":-0.21459364891052247,"y":-0.02726861834526062,"z":0.04327914118766785},{"x":0.0,"y":0.0,"z":0.0},{"x":-0.21459364891052247,"y":-0.02726861834526062,"z":0.04327912628650665},{"x":-0.10104375332593918,"y":0.018380463123321534,"z":0.03990456461906433},{"x":0.0,"y":0.0,"z":0.0},{"x":0.10210980474948883,"y":0.03326445817947388,"z":0.02846134454011917},{"x":0.21829774975776673,"y":-0.01855340600013733,"z":0.034032851457595828},{"x":0.0,"y":0.0,"z":0.0},{"x":0.2182977795600891,"y":-0.018553420901298524,"z":0.034032851457595828},{"x":0.05348876118659973,"y":-0.02520585060119629,"z":-0.043138232082128528},{"x":0.0,"y":0.0,"z":0.0},{"x":-0.00014511775225400925,"y":0.006041206419467926,"z":-0.04527900367975235},{"x":-0.0007897466421127319,"y":0.08485305309295654,"z":0.04726848006248474},{"x":0.0,"y":0.0,"z":0.0},{"x":-0.0007798299193382263,"y":0.08364059031009674,"z":0.045844681560993198},{"x":0.10171341150999069,"y":0.03315974771976471,"z":0.028173357248306276},{"x":0.0,"y":0.0,"z":0.0},{"x":-0.0007897466421127319,"y":0.08485306054353714,"z":0.047268472611904147},{"x":-0.10104375332593918,"y":0.018380463123321534,"z":0.03990456461906433},{"x":0.0,"y":0.0,"z":0.0},{"x":-0.025426581501960756,"y":-0.017098546028137208,"z":-0.07814061641693115},{"x":-0.00013269856572151184,"y":-0.003459148108959198,"z":-0.07313401252031326},{"x":0.0,"y":0.0,"z":0.0},{"x":-0.00020465441048145294,"y":-0.004197120666503906,"z":-0.07519315183162689},{"x":0.024516776204109193,"y":-0.015758514404296876,"z":-0.07573369145393372},{"x":0.0,"y":0.0,"z":0.0},{"x":0.024516776204109193,"y":-0.01575849950313568,"z":-0.07573369145393372},{"x":-0.0029567284509539606,"y":-0.03242237865924835,"z":-0.1539490520954132},{"x":0.0,"y":0.0,"z":0.0},{"x":-0.025426581501960756,"y":-0.017098546028137208,"z":-0.07814061641693115},{"x":-0.002943676896393299,"y":-0.03228852152824402,"z":-0.1535755693912506},{"x":0.0,"y":0.0,"z":0.0},{"x":0.04609294608235359,"y":0.06055441498756409,"z":0.03776314854621887},{"x":-0.0004383958876132965,"y":0.041897185146808627,"z":-0.003173910081386566},{"x":0.0,"y":0.0,"z":0.0},{"x":-0.00044347718358039856,"y":0.042518384754657748,"z":-0.002444446086883545},{"x":0.04885358363389969,"y":0.01919621229171753,"z":-0.0102308951318264},{"x":0.0,"y":0.0,"z":0.0},{"x":0.04750938341021538,"y":0.018841125071048738,"z":-0.011207494884729386},{"x":0.045133862644433978,"y":0.06102678179740906,"z":0.037928506731987},{"x":0.0,"y":0.0,"z":0.0},{"x":-0.04267757758498192,"y":0.057079680263996127,"z":0.04419170320034027},{"x":-0.0004306882619857788,"y":0.0409548282623291,"z":-0.004280507564544678},{"x":0.0,"y":0.0,"z":0.0},{"x":-0.0004457477480173111,"y":0.042796045541763309,"z":-0.0021183937788009645},{"x":-0.04506586864590645,"y":0.01188061386346817,"z":-0.006856240332126617},{"x":0.0,"y":0.0,"z":0.0},{"x":-0.046188950538635257,"y":0.012011021375656128,"z":-0.005918078124523163},{"x":-0.040936429053545,"y":0.05823413282632828,"z":0.044319599866867068},{"x":0.0,"y":0.0,"z":0.0},{"x":0.10062148422002793,"y":0.032871298491954806,"z":0.02738003432750702},{"x":0.24840965867042542,"y":-0.032889723777770999,"z":0.08850294351577759},{"x":0.0,"y":0.0,"z":0.0},{"x":0.2182977795600891,"y":-0.018553420901298524,"z":0.034032851457595828},{"x":0.2484097182750702,"y":-0.032889723777770999,"z":0.0885029137134552},{"x":0.0,"y":0.0,"z":0.0},{"x":-0.21459364891052247,"y":-0.02726861834526062,"z":0.04327912628650665},{"x":-0.250993013381958,"y":-0.03534713387489319,"z":0.0805206298828125},{"x":0.0,"y":0.0,"z":0.0},{"x":-0.25060856342315676,"y":-0.03526180982589722,"z":0.0801272839307785},{"x":-0.10104375332593918,"y":0.018380463123321534,"z":0.03990456461906433},{"x":0.0,"y":0.0,"z":0.0},{"x":-0.005081080831587315,"y":-0.054209738969802859,"z":-0.21474148333072663},{"x":0.0005459561944007874,"y":-0.03595799207687378,"z":0.07110866904258728},{"x":0.0,"y":0.0,"z":0.0},{"x":0.0005323765799403191,"y":-0.0360020250082016,"z":0.0704188346862793},{"x":-0.05517883226275444,"y":-0.031389594078063968,"z":-0.04024842754006386},{"x":0.0,"y":0.0,"z":0.0},{"x":0.0005326215177774429,"y":-0.036001235246658328,"z":0.07043129205703736},{"x":0.04667042940855026,"y":-0.021093040704727174,"z":-0.04340605437755585},{"x":0.0,"y":0.0,"z":0.0},{"x":0.0005459561944007874,"y":-0.035957977175712588,"z":0.07110866904258728},{"x":-0.24344155192375184,"y":-0.03367115557193756,"z":0.07279443740844727},{"x":0.0,"y":0.0,"z":0.0},{"x":0.0005459561944007874,"y":-0.035957977175712588,"z":0.07110866904258728},{"x":0.2404632270336151,"y":-0.02935376763343811,"z":0.08521635830402374},{"x":0.0,"y":0.0,"z":0.0},{"x":0.0005459561944007874,"y":-0.035957977175712588,"z":0.07110866904258728},{"x":-0.0004340317100286484,"y":0.04136357456445694,"z":-0.003800526261329651},{"x":0.0,"y":0.0,"z":0.0},{"x":0.00036709103733301163,"y":-0.03653813898563385,"z":0.062022432684898379},{"x":0.095561183989048,"y":0.03153456747531891,"z":0.023703575134277345},{"x":0.0,"y":0.0,"z":0.0},{"x":0.003829820081591606,"y":-0.034935832023620608,"z":0.062296062707901},{"x":-0.09553234279155731,"y":0.017740502953529359,"z":0.03530063480138779},{"x":0.0,"y":0.0,"z":0.0},{"x":0.07105491310358048,"y":-0.004081279039382935,"z":-0.01727023348212242},{"x":0.08769126236438751,"y":-0.023825272917747499,"z":-0.027123093605041505},{"x":0.0,"y":0.0,"z":0.0},{"x":0.08716960996389389,"y":-0.023846328258514406,"z":-0.027367353439331056},{"x":0.09361228346824646,"y":-0.023586273193359376,"z":-0.024350598454475404},{"x":0.0,"y":0.0,"z":0.0},{"x":0.08947950601577759,"y":-0.0237530916929245,"z":-0.026285752654075624},{"x":0.08497077971696854,"y":-0.023935094475746156,"z":-0.02839694544672966},{"x":0.0,"y":0.0,"z":0.0},{"x":0.08914437890052796,"y":-0.023766621947288514,"z":-0.026442676782608033},{"x":0.08045350760221482,"y":0.007221207022666931,"z":-0.003429822623729706},{"x":0.0,"y":0.0,"z":0.0},{"x":-0.06355540454387665,"y":-0.023236528038978578,"z":-0.022817794233560563},{"x":-0.06566004455089569,"y":-0.020900100469589235,"z":-0.01929648593068123},{"x":0.0,"y":0.0,"z":0.0},{"x":-0.07799988240003586,"y":-0.02747398614883423,"z":-0.02722969278693199},{"x":-0.07954763621091843,"y":-0.0054830461740493778,"z":0.003939077258110046},{"x":0.0,"y":0.0,"z":0.0},{"x":-0.07805376499891281,"y":-0.007141441106796265,"z":0.0014396458864212037},{"x":-0.10163511335849762,"y":-0.027438446879386903,"z":-0.015029337257146836},{"x":0.0,"y":0.0,"z":0.0},{"x":-0.0890495628118515,"y":-0.02745737135410309,"z":-0.021525919437408448},{"x":-0.09085507690906525,"y":0.011919260025024414,"z":-0.016333557665348054},{"x":0.0,"y":0.0,"z":0.0},{"x":-0.09077285975217819,"y":0.010126270353794098,"z":-0.01656997948884964},{"x":-0.07588404417037964,"y":-0.009550116956233979,"z":-0.0021905452013015749},{"x":0.0,"y":0.0,"z":0.0},{"x":0.07397150993347168,"y":-0.024379074573516847,"z":-0.033547308295965198},{"x":0.07456571608781815,"y":0.018776655197143556,"z":-0.031228158622980119},{"x":0.0,"y":0.0,"z":0.0},{"x":0.07456571608781815,"y":0.018776647746562959,"z":-0.03122815489768982},{"x":0.0706498995423317,"y":-0.004568338394165039,"z":-0.01786666363477707},{"x":0.0,"y":0.0,"z":0.0},{"x":-0.09085506945848465,"y":0.01191924512386322,"z":-0.016333550214767457},{"x":-0.05403859168291092,"y":-0.027510017156600953,"z":-0.039598360657691959},{"x":0.0,"y":0.0,"z":0.0},{"x":0.07456571608781815,"y":0.018776647746562959,"z":-0.03122815489768982},{"x":0.05348876118659973,"y":-0.02520585060119629,"z":-0.043138232082128528},{"x":0.0,"y":0.0,"z":0.0},{"x":-0.09021822363138199,"y":-0.001969866454601288,"z":-0.018165022134780885},{"x":-0.0800965204834938,"y":0.00039718300104141235,"z":-0.023132018744945527},{"x":0.0,"y":0.0,"z":0.0},{"x":-0.09033104032278061,"y":0.0004905536770820618,"z":-0.017840582877397538},{"x":-0.07722613960504532,"y":-0.02747514843940735,"z":-0.027629096060991288},{"x":0.0,"y":0.0,"z":0.0},{"x":-0.08041679114103317,"y":-0.02747035026550293,"z":-0.025982100516557695},{"x":-0.09061232209205628,"y":0.006625011563301086,"z":-0.01703166961669922},{"x":0.0,"y":0.0,"z":0.0},{"x":-0.0798664316534996,"y":0.00015076249837875366,"z":-0.023277416825294496},{"x":-0.07696595042943955,"y":-0.02747553586959839,"z":-0.027763403952121736},{"x":0.0,"y":0.0,"z":0.0},{"x":0.07097168266773224,"y":-0.004181370139122009,"z":-0.017392799258232118},{"x":0.06488632410764694,"y":-0.011499449610710144,"z":-0.026354126632213594},{"x":0.0,"y":0.0,"z":0.0},{"x":0.07431407272815705,"y":0.0005004182457923889,"z":-0.03221030533313751},{"x":0.06568332761526108,"y":0.00024124234914779663,"z":-0.036247383803129199},{"x":0.0,"y":0.0,"z":0.0},{"x":0.06554782390594483,"y":-0.00004152953624725342,"z":-0.03632395341992378},{"x":0.06680906563997269,"y":-0.024668172001838685,"z":-0.0369010865688324},{"x":0.0,"y":0.0,"z":0.0},{"x":0.06789325922727585,"y":-0.024624422192573549,"z":-0.0363934226334095},{"x":0.07437268644571305,"y":0.004757598042488098,"z":-0.03198152780532837},{"x":0.0,"y":0.0,"z":0.0}],"quads":[]} \ No newline at end of file diff --git a/Assets/AssetSpace/spaceship.json.meta b/Assets/AssetSpace/spaceship.json.meta new file mode 100644 index 0000000..0989932 --- /dev/null +++ b/Assets/AssetSpace/spaceship.json.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 1b87da504c5a8f24a804874d52d004f8 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/SimpleJSON.cs b/Assets/Plugins/SimpleJSON.cs new file mode 100644 index 0000000..f0a4bb2 --- /dev/null +++ b/Assets/Plugins/SimpleJSON.cs @@ -0,0 +1,1317 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text; + +namespace SimpleJSON +{ + public enum JSONNodeType + { + Array = 1, + Object = 2, + String = 3, + Number = 4, + NullValue = 5, + Boolean = 6, + None = 7, + Custom = 0xFF, + } + public enum JSONTextMode + { + Compact, + Indent + } + + public abstract partial class JSONNode + { + #region Enumerators + public struct Enumerator + { + private enum Type { None, Array, Object } + private Type type; + private Dictionary.Enumerator m_Object; + private List.Enumerator m_Array; + public bool IsValid { get { return type != Type.None; } } + public Enumerator(List.Enumerator aArrayEnum) + { + type = Type.Array; + m_Object = default(Dictionary.Enumerator); + m_Array = aArrayEnum; + } + public Enumerator(Dictionary.Enumerator aDictEnum) + { + type = Type.Object; + m_Object = aDictEnum; + m_Array = default(List.Enumerator); + } + public KeyValuePair Current + { + get + { + if (type == Type.Array) + return new KeyValuePair(string.Empty, m_Array.Current); + else if (type == Type.Object) + return m_Object.Current; + return new KeyValuePair(string.Empty, null); + } + } + public bool MoveNext() + { + if (type == Type.Array) + return m_Array.MoveNext(); + else if (type == Type.Object) + return m_Object.MoveNext(); + return false; + } + } + public struct ValueEnumerator + { + private Enumerator m_Enumerator; + public ValueEnumerator(List.Enumerator aArrayEnum) : this(new Enumerator(aArrayEnum)) { } + public ValueEnumerator(Dictionary.Enumerator aDictEnum) : this(new Enumerator(aDictEnum)) { } + public ValueEnumerator(Enumerator aEnumerator) { m_Enumerator = aEnumerator; } + public JSONNode Current { get { return m_Enumerator.Current.Value; } } + public bool MoveNext() { return m_Enumerator.MoveNext(); } + public ValueEnumerator GetEnumerator() { return this; } + } + public struct KeyEnumerator + { + private Enumerator m_Enumerator; + public KeyEnumerator(List.Enumerator aArrayEnum) : this(new Enumerator(aArrayEnum)) { } + public KeyEnumerator(Dictionary.Enumerator aDictEnum) : this(new Enumerator(aDictEnum)) { } + public KeyEnumerator(Enumerator aEnumerator) { m_Enumerator = aEnumerator; } + public string Current { get { return m_Enumerator.Current.Key; } } + public bool MoveNext() { return m_Enumerator.MoveNext(); } + public KeyEnumerator GetEnumerator() { return this; } + } + + public class LinqEnumerator : IEnumerator>, IEnumerable> + { + private JSONNode m_Node; + private Enumerator m_Enumerator; + internal LinqEnumerator(JSONNode aNode) + { + m_Node = aNode; + if (m_Node != null) + m_Enumerator = m_Node.GetEnumerator(); + } + public KeyValuePair Current { get { return m_Enumerator.Current; } } + object IEnumerator.Current { get { return m_Enumerator.Current; } } + public bool MoveNext() { return m_Enumerator.MoveNext(); } + + public void Dispose() + { + m_Node = null; + m_Enumerator = new Enumerator(); + } + + public IEnumerator> GetEnumerator() + { + return new LinqEnumerator(m_Node); + } + + public void Reset() + { + if (m_Node != null) + m_Enumerator = m_Node.GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return new LinqEnumerator(m_Node); + } + } + + #endregion Enumerators + + #region common interface + + public static bool forceASCII = false; // Use Unicode by default + public static bool longAsString = false; // lazy creator creates a JSONString instead of JSONNumber + public static bool allowLineComments = true; // allow "//"-style comments at the end of a line + + public abstract JSONNodeType Tag { get; } + + public virtual JSONNode this[int aIndex] { get { return null; } set { } } + + public virtual JSONNode this[string aKey] { get { return null; } set { } } + + public virtual string Value { get { return ""; } set { } } + + public virtual int Count { get { return 0; } } + + public virtual bool IsNumber { get { return false; } } + public virtual bool IsString { get { return false; } } + public virtual bool IsBoolean { get { return false; } } + public virtual bool IsNull { get { return false; } } + public virtual bool IsArray { get { return false; } } + public virtual bool IsObject { get { return false; } } + + public virtual bool Inline { get { return false; } set { } } + + public virtual void Add(string aKey, JSONNode aItem) + { + } + public virtual void Add(JSONNode aItem) + { + Add("", aItem); + } + + public virtual JSONNode Remove(string aKey) + { + return null; + } + + public virtual JSONNode Remove(int aIndex) + { + return null; + } + + public virtual JSONNode Remove(JSONNode aNode) + { + return aNode; + } + + public virtual JSONNode Clone() + { + return null; + } + + public virtual IEnumerable Children + { + get + { + yield break; + } + } + + public IEnumerable DeepChildren + { + get + { + foreach (var C in Children) + foreach (var D in C.DeepChildren) + yield return D; + } + } + + public virtual bool HasKey(string aKey) + { + return false; + } + + public virtual JSONNode GetValueOrDefault(string aKey, JSONNode aDefault) + { + return aDefault; + } + + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + WriteToStringBuilder(sb, 0, 0, JSONTextMode.Compact); + return sb.ToString(); + } + + public virtual string ToString(int aIndent) + { + StringBuilder sb = new StringBuilder(); + WriteToStringBuilder(sb, 0, aIndent, JSONTextMode.Indent); + return sb.ToString(); + } + internal abstract void WriteToStringBuilder(StringBuilder aSB, int aIndent, int aIndentInc, JSONTextMode aMode); + + public abstract Enumerator GetEnumerator(); + public IEnumerable> Linq { get { return new LinqEnumerator(this); } } + public KeyEnumerator Keys { get { return new KeyEnumerator(GetEnumerator()); } } + public ValueEnumerator Values { get { return new ValueEnumerator(GetEnumerator()); } } + + #endregion common interface + + #region typecasting properties + + + public virtual double AsDouble + { + get + { + double v = 0.0; + if (double.TryParse(Value, NumberStyles.Float, CultureInfo.InvariantCulture, out v)) + return v; + return 0.0; + } + set + { + Value = value.ToString(CultureInfo.InvariantCulture); + } + } + + public virtual int AsInt + { + get { return (int)AsDouble; } + set { AsDouble = value; } + } + + public virtual float AsFloat + { + get { return (float)AsDouble; } + set { AsDouble = value; } + } + + public virtual bool AsBool + { + get + { + bool v = false; + if (bool.TryParse(Value, out v)) + return v; + return !string.IsNullOrEmpty(Value); + } + set + { + Value = (value) ? "true" : "false"; + } + } + + public virtual long AsLong + { + get + { + long val = 0; + if (long.TryParse(Value, out val)) + return val; + return 0L; + } + set + { + Value = value.ToString(); + } + } + + public virtual JSONArray AsArray + { + get + { + return this as JSONArray; + } + } + + public virtual JSONObject AsObject + { + get + { + return this as JSONObject; + } + } + + + #endregion typecasting properties + + #region operators + + public static implicit operator JSONNode(string s) + { + return new JSONString(s); + } + public static implicit operator string(JSONNode d) + { + return (d == null) ? null : d.Value; + } + + public static implicit operator JSONNode(double n) + { + return new JSONNumber(n); + } + public static implicit operator double(JSONNode d) + { + return (d == null) ? 0 : d.AsDouble; + } + + public static implicit operator JSONNode(float n) + { + return new JSONNumber(n); + } + public static implicit operator float(JSONNode d) + { + return (d == null) ? 0 : d.AsFloat; + } + + public static implicit operator JSONNode(int n) + { + return new JSONNumber(n); + } + public static implicit operator int(JSONNode d) + { + return (d == null) ? 0 : d.AsInt; + } + + public static implicit operator JSONNode(long n) + { + if (longAsString) + return new JSONString(n.ToString()); + return new JSONNumber(n); + } + public static implicit operator long(JSONNode d) + { + return (d == null) ? 0L : d.AsLong; + } + + public static implicit operator JSONNode(bool b) + { + return new JSONBool(b); + } + public static implicit operator bool(JSONNode d) + { + return (d == null) ? false : d.AsBool; + } + + public static implicit operator JSONNode(KeyValuePair aKeyValue) + { + return aKeyValue.Value; + } + + public static bool operator ==(JSONNode a, object b) + { + if (ReferenceEquals(a, b)) + return true; + bool aIsNull = a is JSONNull || ReferenceEquals(a, null) || a is JSONLazyCreator; + bool bIsNull = b is JSONNull || ReferenceEquals(b, null) || b is JSONLazyCreator; + if (aIsNull && bIsNull) + return true; + return !aIsNull && a.Equals(b); + } + + public static bool operator !=(JSONNode a, object b) + { + return !(a == b); + } + + public override bool Equals(object obj) + { + return ReferenceEquals(this, obj); + } + + public override int GetHashCode() + { + return base.GetHashCode(); + } + + #endregion operators + + [ThreadStatic] + private static StringBuilder m_EscapeBuilder; + internal static StringBuilder EscapeBuilder + { + get + { + if (m_EscapeBuilder == null) + m_EscapeBuilder = new StringBuilder(); + return m_EscapeBuilder; + } + } + internal static string Escape(string aText) + { + var sb = EscapeBuilder; + sb.Length = 0; + if (sb.Capacity < aText.Length + aText.Length / 10) + sb.Capacity = aText.Length + aText.Length / 10; + foreach (char c in aText) + { + switch (c) + { + case '\\': + sb.Append("\\\\"); + break; + case '\"': + sb.Append("\\\""); + break; + case '\n': + sb.Append("\\n"); + break; + case '\r': + sb.Append("\\r"); + break; + case '\t': + sb.Append("\\t"); + break; + case '\b': + sb.Append("\\b"); + break; + case '\f': + sb.Append("\\f"); + break; + default: + if (c < ' ' || (forceASCII && c > 127)) + { + ushort val = c; + sb.Append("\\u").Append(val.ToString("X4")); + } + else + sb.Append(c); + break; + } + } + string result = sb.ToString(); + sb.Length = 0; + return result; + } + + private static JSONNode ParseElement(string token, bool quoted) + { + if (quoted) + return token; + string tmp = token.ToLower(); + if (tmp == "false" || tmp == "true") + return tmp == "true"; + if (tmp == "null") + return JSONNull.CreateOrGet(); + double val; + if (double.TryParse(token, NumberStyles.Float, CultureInfo.InvariantCulture, out val)) + return val; + else + return token; + } + + public static JSONNode Parse(string aJSON) + { + Stack stack = new Stack(); + JSONNode ctx = null; + int i = 0; + StringBuilder Token = new StringBuilder(); + string TokenName = ""; + bool QuoteMode = false; + bool TokenIsQuoted = false; + while (i < aJSON.Length) + { + switch (aJSON[i]) + { + case '{': + if (QuoteMode) + { + Token.Append(aJSON[i]); + break; + } + stack.Push(new JSONObject()); + if (ctx != null) + { + ctx.Add(TokenName, stack.Peek()); + } + TokenName = ""; + Token.Length = 0; + ctx = stack.Peek(); + break; + + case '[': + if (QuoteMode) + { + Token.Append(aJSON[i]); + break; + } + + stack.Push(new JSONArray()); + if (ctx != null) + { + ctx.Add(TokenName, stack.Peek()); + } + TokenName = ""; + Token.Length = 0; + ctx = stack.Peek(); + break; + + case '}': + case ']': + if (QuoteMode) + { + + Token.Append(aJSON[i]); + break; + } + if (stack.Count == 0) + throw new Exception("JSON Parse: Too many closing brackets"); + + stack.Pop(); + if (Token.Length > 0 || TokenIsQuoted) + ctx.Add(TokenName, ParseElement(Token.ToString(), TokenIsQuoted)); + TokenIsQuoted = false; + TokenName = ""; + Token.Length = 0; + if (stack.Count > 0) + ctx = stack.Peek(); + break; + + case ':': + if (QuoteMode) + { + Token.Append(aJSON[i]); + break; + } + TokenName = Token.ToString(); + Token.Length = 0; + TokenIsQuoted = false; + break; + + case '"': + QuoteMode ^= true; + TokenIsQuoted |= QuoteMode; + break; + + case ',': + if (QuoteMode) + { + Token.Append(aJSON[i]); + break; + } + if (Token.Length > 0 || TokenIsQuoted) + ctx.Add(TokenName, ParseElement(Token.ToString(), TokenIsQuoted)); + TokenIsQuoted = false; + TokenName = ""; + Token.Length = 0; + TokenIsQuoted = false; + break; + + case '\r': + case '\n': + break; + + case ' ': + case '\t': + if (QuoteMode) + Token.Append(aJSON[i]); + break; + + case '\\': + ++i; + if (QuoteMode) + { + char C = aJSON[i]; + switch (C) + { + case 't': + Token.Append('\t'); + break; + case 'r': + Token.Append('\r'); + break; + case 'n': + Token.Append('\n'); + break; + case 'b': + Token.Append('\b'); + break; + case 'f': + Token.Append('\f'); + break; + case 'u': + { + string s = aJSON.Substring(i + 1, 4); + Token.Append((char)int.Parse( + s, + System.Globalization.NumberStyles.AllowHexSpecifier)); + i += 4; + break; + } + default: + Token.Append(C); + break; + } + } + break; + case '/': + if (allowLineComments && !QuoteMode && i + 1 < aJSON.Length && aJSON[i + 1] == '/') + { + while (++i < aJSON.Length && aJSON[i] != '\n' && aJSON[i] != '\r') ; + break; + } + Token.Append(aJSON[i]); + break; + case '\uFEFF': // remove / ignore BOM (Byte Order Mark) + break; + + default: + Token.Append(aJSON[i]); + break; + } + ++i; + } + if (QuoteMode) + { + throw new Exception("JSON Parse: Quotation marks seems to be messed up."); + } + if (ctx == null) + return ParseElement(Token.ToString(), TokenIsQuoted); + return ctx; + } + + } + // End of JSONNode + + public partial class JSONArray : JSONNode + { + private List m_List = new List(); + private bool inline = false; + public override bool Inline + { + get { return inline; } + set { inline = value; } + } + + public override JSONNodeType Tag { get { return JSONNodeType.Array; } } + public override bool IsArray { get { return true; } } + public override Enumerator GetEnumerator() { return new Enumerator(m_List.GetEnumerator()); } + + public override JSONNode this[int aIndex] + { + get + { + if (aIndex < 0 || aIndex >= m_List.Count) + return new JSONLazyCreator(this); + return m_List[aIndex]; + } + set + { + if (value == null) + value = JSONNull.CreateOrGet(); + if (aIndex < 0 || aIndex >= m_List.Count) + m_List.Add(value); + else + m_List[aIndex] = value; + } + } + + public override JSONNode this[string aKey] + { + get { return new JSONLazyCreator(this); } + set + { + if (value == null) + value = JSONNull.CreateOrGet(); + m_List.Add(value); + } + } + + public override int Count + { + get { return m_List.Count; } + } + + public override void Add(string aKey, JSONNode aItem) + { + if (aItem == null) + aItem = JSONNull.CreateOrGet(); + m_List.Add(aItem); + } + + public override JSONNode Remove(int aIndex) + { + if (aIndex < 0 || aIndex >= m_List.Count) + return null; + JSONNode tmp = m_List[aIndex]; + m_List.RemoveAt(aIndex); + return tmp; + } + + public override JSONNode Remove(JSONNode aNode) + { + m_List.Remove(aNode); + return aNode; + } + + public override JSONNode Clone() + { + var node = new JSONArray(); + node.m_List.Capacity = m_List.Capacity; + foreach(var n in m_List) + { + if (n != null) + node.Add(n.Clone()); + else + node.Add(null); + } + return node; + } + + public override IEnumerable Children + { + get + { + foreach (JSONNode N in m_List) + yield return N; + } + } + + + internal override void WriteToStringBuilder(StringBuilder aSB, int aIndent, int aIndentInc, JSONTextMode aMode) + { + aSB.Append('['); + int count = m_List.Count; + if (inline) + aMode = JSONTextMode.Compact; + for (int i = 0; i < count; i++) + { + if (i > 0) + aSB.Append(','); + if (aMode == JSONTextMode.Indent) + aSB.AppendLine(); + + if (aMode == JSONTextMode.Indent) + aSB.Append(' ', aIndent + aIndentInc); + m_List[i].WriteToStringBuilder(aSB, aIndent + aIndentInc, aIndentInc, aMode); + } + if (aMode == JSONTextMode.Indent) + aSB.AppendLine().Append(' ', aIndent); + aSB.Append(']'); + } + } + // End of JSONArray + + public partial class JSONObject : JSONNode + { + private Dictionary m_Dict = new Dictionary(); + + private bool inline = false; + public override bool Inline + { + get { return inline; } + set { inline = value; } + } + + public override JSONNodeType Tag { get { return JSONNodeType.Object; } } + public override bool IsObject { get { return true; } } + + public override Enumerator GetEnumerator() { return new Enumerator(m_Dict.GetEnumerator()); } + + + public override JSONNode this[string aKey] + { + get + { + if (m_Dict.ContainsKey(aKey)) + return m_Dict[aKey]; + else + return new JSONLazyCreator(this, aKey); + } + set + { + if (value == null) + value = JSONNull.CreateOrGet(); + if (m_Dict.ContainsKey(aKey)) + m_Dict[aKey] = value; + else + m_Dict.Add(aKey, value); + } + } + + public override JSONNode this[int aIndex] + { + get + { + if (aIndex < 0 || aIndex >= m_Dict.Count) + return null; + return m_Dict.ElementAt(aIndex).Value; + } + set + { + if (value == null) + value = JSONNull.CreateOrGet(); + if (aIndex < 0 || aIndex >= m_Dict.Count) + return; + string key = m_Dict.ElementAt(aIndex).Key; + m_Dict[key] = value; + } + } + + public override int Count + { + get { return m_Dict.Count; } + } + + public override void Add(string aKey, JSONNode aItem) + { + if (aItem == null) + aItem = JSONNull.CreateOrGet(); + + if (aKey != null) + { + if (m_Dict.ContainsKey(aKey)) + m_Dict[aKey] = aItem; + else + m_Dict.Add(aKey, aItem); + } + else + m_Dict.Add(Guid.NewGuid().ToString(), aItem); + } + + public override JSONNode Remove(string aKey) + { + if (!m_Dict.ContainsKey(aKey)) + return null; + JSONNode tmp = m_Dict[aKey]; + m_Dict.Remove(aKey); + return tmp; + } + + public override JSONNode Remove(int aIndex) + { + if (aIndex < 0 || aIndex >= m_Dict.Count) + return null; + var item = m_Dict.ElementAt(aIndex); + m_Dict.Remove(item.Key); + return item.Value; + } + + public override JSONNode Remove(JSONNode aNode) + { + try + { + var item = m_Dict.Where(k => k.Value == aNode).First(); + m_Dict.Remove(item.Key); + return aNode; + } + catch + { + return null; + } + } + + public override JSONNode Clone() + { + var node = new JSONObject(); + foreach (var n in m_Dict) + { + node.Add(n.Key, n.Value.Clone()); + } + return node; + } + + public override bool HasKey(string aKey) + { + return m_Dict.ContainsKey(aKey); + } + + public override JSONNode GetValueOrDefault(string aKey, JSONNode aDefault) + { + JSONNode res; + if (m_Dict.TryGetValue(aKey, out res)) + return res; + return aDefault; + } + + public override IEnumerable Children + { + get + { + foreach (KeyValuePair N in m_Dict) + yield return N.Value; + } + } + + internal override void WriteToStringBuilder(StringBuilder aSB, int aIndent, int aIndentInc, JSONTextMode aMode) + { + aSB.Append('{'); + bool first = true; + if (inline) + aMode = JSONTextMode.Compact; + foreach (var k in m_Dict) + { + if (!first) + aSB.Append(','); + first = false; + if (aMode == JSONTextMode.Indent) + aSB.AppendLine(); + if (aMode == JSONTextMode.Indent) + aSB.Append(' ', aIndent + aIndentInc); + aSB.Append('\"').Append(Escape(k.Key)).Append('\"'); + if (aMode == JSONTextMode.Compact) + aSB.Append(':'); + else + aSB.Append(" : "); + k.Value.WriteToStringBuilder(aSB, aIndent + aIndentInc, aIndentInc, aMode); + } + if (aMode == JSONTextMode.Indent) + aSB.AppendLine().Append(' ', aIndent); + aSB.Append('}'); + } + + } + // End of JSONObject + + public partial class JSONString : JSONNode + { + private string m_Data; + + public override JSONNodeType Tag { get { return JSONNodeType.String; } } + public override bool IsString { get { return true; } } + + public override Enumerator GetEnumerator() { return new Enumerator(); } + + + public override string Value + { + get { return m_Data; } + set + { + m_Data = value; + } + } + + public JSONString(string aData) + { + m_Data = aData; + } + public override JSONNode Clone() + { + return new JSONString(m_Data); + } + + internal override void WriteToStringBuilder(StringBuilder aSB, int aIndent, int aIndentInc, JSONTextMode aMode) + { + aSB.Append('\"').Append(Escape(m_Data)).Append('\"'); + } + public override bool Equals(object obj) + { + if (base.Equals(obj)) + return true; + string s = obj as string; + if (s != null) + return m_Data == s; + JSONString s2 = obj as JSONString; + if (s2 != null) + return m_Data == s2.m_Data; + return false; + } + public override int GetHashCode() + { + return m_Data.GetHashCode(); + } + } + // End of JSONString + + public partial class JSONNumber : JSONNode + { + private double m_Data; + + public override JSONNodeType Tag { get { return JSONNodeType.Number; } } + public override bool IsNumber { get { return true; } } + public override Enumerator GetEnumerator() { return new Enumerator(); } + + public override string Value + { + get { return m_Data.ToString(CultureInfo.InvariantCulture); } + set + { + double v; + if (double.TryParse(value, NumberStyles.Float, CultureInfo.InvariantCulture, out v)) + m_Data = v; + } + } + + public override double AsDouble + { + get { return m_Data; } + set { m_Data = value; } + } + public override long AsLong + { + get { return (long)m_Data; } + set { m_Data = value; } + } + + public JSONNumber(double aData) + { + m_Data = aData; + } + + public JSONNumber(string aData) + { + Value = aData; + } + + public override JSONNode Clone() + { + return new JSONNumber(m_Data); + } + + internal override void WriteToStringBuilder(StringBuilder aSB, int aIndent, int aIndentInc, JSONTextMode aMode) + { + aSB.Append(Value); + } + private static bool IsNumeric(object value) + { + return value is int || value is uint + || value is float || value is double + || value is decimal + || value is long || value is ulong + || value is short || value is ushort + || value is sbyte || value is byte; + } + public override bool Equals(object obj) + { + if (obj == null) + return false; + if (base.Equals(obj)) + return true; + JSONNumber s2 = obj as JSONNumber; + if (s2 != null) + return m_Data == s2.m_Data; + if (IsNumeric(obj)) + return Convert.ToDouble(obj) == m_Data; + return false; + } + public override int GetHashCode() + { + return m_Data.GetHashCode(); + } + } + // End of JSONNumber + + public partial class JSONBool : JSONNode + { + private bool m_Data; + + public override JSONNodeType Tag { get { return JSONNodeType.Boolean; } } + public override bool IsBoolean { get { return true; } } + public override Enumerator GetEnumerator() { return new Enumerator(); } + + public override string Value + { + get { return m_Data.ToString(); } + set + { + bool v; + if (bool.TryParse(value, out v)) + m_Data = v; + } + } + public override bool AsBool + { + get { return m_Data; } + set { m_Data = value; } + } + + public JSONBool(bool aData) + { + m_Data = aData; + } + + public JSONBool(string aData) + { + Value = aData; + } + + public override JSONNode Clone() + { + return new JSONBool(m_Data); + } + + internal override void WriteToStringBuilder(StringBuilder aSB, int aIndent, int aIndentInc, JSONTextMode aMode) + { + aSB.Append((m_Data) ? "true" : "false"); + } + public override bool Equals(object obj) + { + if (obj == null) + return false; + if (obj is bool) + return m_Data == (bool)obj; + return false; + } + public override int GetHashCode() + { + return m_Data.GetHashCode(); + } + } + // End of JSONBool + + public partial class JSONNull : JSONNode + { + static JSONNull m_StaticInstance = new JSONNull(); + public static bool reuseSameInstance = true; + public static JSONNull CreateOrGet() + { + if (reuseSameInstance) + return m_StaticInstance; + return new JSONNull(); + } + private JSONNull() { } + + public override JSONNodeType Tag { get { return JSONNodeType.NullValue; } } + public override bool IsNull { get { return true; } } + public override Enumerator GetEnumerator() { return new Enumerator(); } + + public override string Value + { + get { return "null"; } + set { } + } + public override bool AsBool + { + get { return false; } + set { } + } + + public override JSONNode Clone() + { + return CreateOrGet(); + } + + public override bool Equals(object obj) + { + if (object.ReferenceEquals(this, obj)) + return true; + return (obj is JSONNull); + } + public override int GetHashCode() + { + return 0; + } + + internal override void WriteToStringBuilder(StringBuilder aSB, int aIndent, int aIndentInc, JSONTextMode aMode) + { + aSB.Append("null"); + } + } + // End of JSONNull + + internal partial class JSONLazyCreator : JSONNode + { + private JSONNode m_Node = null; + private string m_Key = null; + public override JSONNodeType Tag { get { return JSONNodeType.None; } } + public override Enumerator GetEnumerator() { return new Enumerator(); } + + public JSONLazyCreator(JSONNode aNode) + { + m_Node = aNode; + m_Key = null; + } + + public JSONLazyCreator(JSONNode aNode, string aKey) + { + m_Node = aNode; + m_Key = aKey; + } + + private T Set(T aVal) where T : JSONNode + { + if (m_Key == null) + m_Node.Add(aVal); + else + m_Node.Add(m_Key, aVal); + m_Node = null; // Be GC friendly. + return aVal; + } + + public override JSONNode this[int aIndex] + { + get { return new JSONLazyCreator(this); } + set { Set(new JSONArray()).Add(value); } + } + + public override JSONNode this[string aKey] + { + get { return new JSONLazyCreator(this, aKey); } + set { Set(new JSONObject()).Add(aKey, value); } + } + + public override void Add(JSONNode aItem) + { + Set(new JSONArray()).Add(aItem); + } + + public override void Add(string aKey, JSONNode aItem) + { + Set(new JSONObject()).Add(aKey, aItem); + } + + public static bool operator ==(JSONLazyCreator a, object b) + { + if (b == null) + return true; + return System.Object.ReferenceEquals(a, b); + } + + public static bool operator !=(JSONLazyCreator a, object b) + { + return !(a == b); + } + + public override bool Equals(object obj) + { + if (obj == null) + return true; + return System.Object.ReferenceEquals(this, obj); + } + + public override int GetHashCode() + { + return 0; + } + + public override int AsInt + { + get { Set(new JSONNumber(0)); return 0; } + set { Set(new JSONNumber(value)); } + } + + public override float AsFloat + { + get { Set(new JSONNumber(0.0f)); return 0.0f; } + set { Set(new JSONNumber(value)); } + } + + public override double AsDouble + { + get { Set(new JSONNumber(0.0)); return 0.0; } + set { Set(new JSONNumber(value)); } + } + + public override long AsLong + { + get + { + if (longAsString) + Set(new JSONString("0")); + else + Set(new JSONNumber(0.0)); + return 0L; + } + set + { + if (longAsString) + Set(new JSONString(value.ToString())); + else + Set(new JSONNumber(value)); + } + } + + public override bool AsBool + { + get { Set(new JSONBool(false)); return false; } + set { Set(new JSONBool(value)); } + } + + public override JSONArray AsArray + { + get { return Set(new JSONArray()); } + } + + public override JSONObject AsObject + { + get { return Set(new JSONObject()); } + } + internal override void WriteToStringBuilder(StringBuilder aSB, int aIndent, int aIndentInc, JSONTextMode aMode) + { + aSB.Append("null"); + } + } + // End of JSONLazyCreator + + public static class JSON + { + public static JSONNode Parse(string aJSON) + { + return JSONNode.Parse(aJSON); + } + } +} diff --git a/Assets/Plugins/SimpleJSON.cs.meta b/Assets/Plugins/SimpleJSON.cs.meta new file mode 100644 index 0000000..f43bde5 --- /dev/null +++ b/Assets/Plugins/SimpleJSON.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 13180a8ebaa9dba4f8e4950ae8920385 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/SimpleJSONBinary.cs b/Assets/Plugins/SimpleJSONBinary.cs new file mode 100644 index 0000000..79b96e3 --- /dev/null +++ b/Assets/Plugins/SimpleJSONBinary.cs @@ -0,0 +1,301 @@ +//#define USE_SharpZipLib +/* * * * * + * This is an extension of the SimpleJSON framework to provide methods to + * serialize a JSON object tree into a compact binary format. Optionally the + * binary stream can be compressed with the SharpZipLib when using the define + * "USE_SharpZipLib" + * + * Those methods where originally part of the framework but since it's rarely + * used I've extracted this part into this seperate module file. + * + * You can use the define "SimpleJSON_ExcludeBinary" to selectively disable + * this extension without the need to remove the file from the project. + * + * If you want to use compression when saving to file / stream / B64 you have to include + * SharpZipLib ( http://www.icsharpcode.net/opensource/sharpziplib/ ) in your project and + * define "USE_SharpZipLib" at the top of the file + * + * + * The MIT License (MIT) + * + * Copyright (c) 2012-2017 Markus Göbel (Bunny83) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * * * * */ +using System; + +namespace SimpleJSON +{ +#if !SimpleJSON_ExcludeBinary + public abstract partial class JSONNode + { + public abstract void SerializeBinary(System.IO.BinaryWriter aWriter); + + public void SaveToBinaryStream(System.IO.Stream aData) + { + var W = new System.IO.BinaryWriter(aData); + SerializeBinary(W); + } + +#if USE_SharpZipLib + public void SaveToCompressedStream(System.IO.Stream aData) + { + using (var gzipOut = new ICSharpCode.SharpZipLib.BZip2.BZip2OutputStream(aData)) + { + gzipOut.IsStreamOwner = false; + SaveToBinaryStream(gzipOut); + gzipOut.Close(); + } + } + + public void SaveToCompressedFile(string aFileName) + { + + System.IO.Directory.CreateDirectory((new System.IO.FileInfo(aFileName)).Directory.FullName); + using(var F = System.IO.File.OpenWrite(aFileName)) + { + SaveToCompressedStream(F); + } + } + public string SaveToCompressedBase64() + { + using (var stream = new System.IO.MemoryStream()) + { + SaveToCompressedStream(stream); + stream.Position = 0; + return System.Convert.ToBase64String(stream.ToArray()); + } + } + +#else + public void SaveToCompressedStream(System.IO.Stream aData) + { + throw new Exception("Can't use compressed functions. You need include the SharpZipLib and uncomment the define at the top of SimpleJSON"); + } + + public void SaveToCompressedFile(string aFileName) + { + throw new Exception("Can't use compressed functions. You need include the SharpZipLib and uncomment the define at the top of SimpleJSON"); + } + + public string SaveToCompressedBase64() + { + throw new Exception("Can't use compressed functions. You need include the SharpZipLib and uncomment the define at the top of SimpleJSON"); + } +#endif + + public void SaveToBinaryFile(string aFileName) + { + System.IO.Directory.CreateDirectory((new System.IO.FileInfo(aFileName)).Directory.FullName); + using (var F = System.IO.File.OpenWrite(aFileName)) + { + SaveToBinaryStream(F); + } + } + + public string SaveToBinaryBase64() + { + using (var stream = new System.IO.MemoryStream()) + { + SaveToBinaryStream(stream); + stream.Position = 0; + return System.Convert.ToBase64String(stream.ToArray()); + } + } + + public static JSONNode DeserializeBinary(System.IO.BinaryReader aReader) + { + JSONNodeType type = (JSONNodeType)aReader.ReadByte(); + switch (type) + { + case JSONNodeType.Array: + { + int count = aReader.ReadInt32(); + JSONArray tmp = new JSONArray(); + for (int i = 0; i < count; i++) + tmp.Add(DeserializeBinary(aReader)); + return tmp; + } + case JSONNodeType.Object: + { + int count = aReader.ReadInt32(); + JSONObject tmp = new JSONObject(); + for (int i = 0; i < count; i++) + { + string key = aReader.ReadString(); + var val = DeserializeBinary(aReader); + tmp.Add(key, val); + } + return tmp; + } + case JSONNodeType.String: + { + return new JSONString(aReader.ReadString()); + } + case JSONNodeType.Number: + { + return new JSONNumber(aReader.ReadDouble()); + } + case JSONNodeType.Boolean: + { + return new JSONBool(aReader.ReadBoolean()); + } + case JSONNodeType.NullValue: + { + return JSONNull.CreateOrGet(); + } + default: + { + throw new Exception("Error deserializing JSON. Unknown tag: " + type); + } + } + } + +#if USE_SharpZipLib + public static JSONNode LoadFromCompressedStream(System.IO.Stream aData) + { + var zin = new ICSharpCode.SharpZipLib.BZip2.BZip2InputStream(aData); + return LoadFromBinaryStream(zin); + } + public static JSONNode LoadFromCompressedFile(string aFileName) + { + using(var F = System.IO.File.OpenRead(aFileName)) + { + return LoadFromCompressedStream(F); + } + } + public static JSONNode LoadFromCompressedBase64(string aBase64) + { + var tmp = System.Convert.FromBase64String(aBase64); + var stream = new System.IO.MemoryStream(tmp); + stream.Position = 0; + return LoadFromCompressedStream(stream); + } +#else + public static JSONNode LoadFromCompressedFile(string aFileName) + { + throw new Exception("Can't use compressed functions. You need include the SharpZipLib and uncomment the define at the top of SimpleJSON"); + } + + public static JSONNode LoadFromCompressedStream(System.IO.Stream aData) + { + throw new Exception("Can't use compressed functions. You need include the SharpZipLib and uncomment the define at the top of SimpleJSON"); + } + + public static JSONNode LoadFromCompressedBase64(string aBase64) + { + throw new Exception("Can't use compressed functions. You need include the SharpZipLib and uncomment the define at the top of SimpleJSON"); + } +#endif + + public static JSONNode LoadFromBinaryStream(System.IO.Stream aData) + { + using (var R = new System.IO.BinaryReader(aData)) + { + return DeserializeBinary(R); + } + } + + public static JSONNode LoadFromBinaryFile(string aFileName) + { + using (var F = System.IO.File.OpenRead(aFileName)) + { + return LoadFromBinaryStream(F); + } + } + + public static JSONNode LoadFromBinaryBase64(string aBase64) + { + var tmp = System.Convert.FromBase64String(aBase64); + var stream = new System.IO.MemoryStream(tmp); + stream.Position = 0; + return LoadFromBinaryStream(stream); + } + } + + public partial class JSONArray : JSONNode + { + public override void SerializeBinary(System.IO.BinaryWriter aWriter) + { + aWriter.Write((byte)JSONNodeType.Array); + aWriter.Write(m_List.Count); + for (int i = 0; i < m_List.Count; i++) + { + m_List[i].SerializeBinary(aWriter); + } + } + } + + public partial class JSONObject : JSONNode + { + public override void SerializeBinary(System.IO.BinaryWriter aWriter) + { + aWriter.Write((byte)JSONNodeType.Object); + aWriter.Write(m_Dict.Count); + foreach (string K in m_Dict.Keys) + { + aWriter.Write(K); + m_Dict[K].SerializeBinary(aWriter); + } + } + } + + public partial class JSONString : JSONNode + { + public override void SerializeBinary(System.IO.BinaryWriter aWriter) + { + aWriter.Write((byte)JSONNodeType.String); + aWriter.Write(m_Data); + } + } + + public partial class JSONNumber : JSONNode + { + public override void SerializeBinary(System.IO.BinaryWriter aWriter) + { + aWriter.Write((byte)JSONNodeType.Number); + aWriter.Write(m_Data); + } + } + + public partial class JSONBool : JSONNode + { + public override void SerializeBinary(System.IO.BinaryWriter aWriter) + { + aWriter.Write((byte)JSONNodeType.Boolean); + aWriter.Write(m_Data); + } + } + public partial class JSONNull : JSONNode + { + public override void SerializeBinary(System.IO.BinaryWriter aWriter) + { + aWriter.Write((byte)JSONNodeType.NullValue); + } + } + internal partial class JSONLazyCreator : JSONNode + { + public override void SerializeBinary(System.IO.BinaryWriter aWriter) + { + + } + } +#endif +} \ No newline at end of file diff --git a/Assets/Plugins/SimpleJSONBinary.cs.meta b/Assets/Plugins/SimpleJSONBinary.cs.meta new file mode 100644 index 0000000..204ea07 --- /dev/null +++ b/Assets/Plugins/SimpleJSONBinary.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 739df7dcad852b2469ca1d80b2e36a1e +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/SimpleJSONUnity.cs b/Assets/Plugins/SimpleJSONUnity.cs new file mode 100644 index 0000000..d6485a7 --- /dev/null +++ b/Assets/Plugins/SimpleJSONUnity.cs @@ -0,0 +1,369 @@ +#region License and information +/* * * * * + * + * Unity extension for the SimpleJSON framework. It does only work together with + * the SimpleJSON.cs + * It provides several helpers and conversion operators to serialize/deserialize + * common Unity types such as Vector2/3/4, Rect, RectOffset, Quaternion and + * Matrix4x4 as JSONObject or JSONArray. + * This extension will add 3 static settings to the JSONNode class: + * ( VectorContainerType, QuaternionContainerType, RectContainerType ) which + * control what node type should be used for serializing the given type. So a + * Vector3 as array would look like [12,32,24] and {"x":12, "y":32, "z":24} as + * object. + * + * + * The MIT License (MIT) + * + * Copyright (c) 2012-2017 Markus Göbel (Bunny83) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * * * * */ + +#endregion License and information + +using UnityEngine; + +namespace SimpleJSON +{ + public enum JSONContainerType { Array, Object } + public partial class JSONNode + { + public static JSONContainerType VectorContainerType = JSONContainerType.Array; + public static JSONContainerType QuaternionContainerType = JSONContainerType.Array; + public static JSONContainerType RectContainerType = JSONContainerType.Array; + private static JSONNode GetContainer(JSONContainerType aType) + { + if (aType == JSONContainerType.Array) + return new JSONArray(); + return new JSONObject(); + } + + #region implicit conversion operators + public static implicit operator JSONNode(Vector2 aVec) + { + JSONNode n = GetContainer(VectorContainerType); + n.WriteVector2(aVec); + return n; + } + public static implicit operator JSONNode(Vector3 aVec) + { + JSONNode n = GetContainer(VectorContainerType); + n.WriteVector3(aVec); + return n; + } + public static implicit operator JSONNode(Vector4 aVec) + { + JSONNode n = GetContainer(VectorContainerType); + n.WriteVector4(aVec); + return n; + } + public static implicit operator JSONNode(Quaternion aRot) + { + JSONNode n = GetContainer(QuaternionContainerType); + n.WriteQuaternion(aRot); + return n; + } + public static implicit operator JSONNode(Rect aRect) + { + JSONNode n = GetContainer(RectContainerType); + n.WriteRect(aRect); + return n; + } + public static implicit operator JSONNode(RectOffset aRect) + { + JSONNode n = GetContainer(RectContainerType); + n.WriteRectOffset(aRect); + return n; + } + + public static implicit operator Vector2(JSONNode aNode) + { + return aNode.ReadVector2(); + } + public static implicit operator Vector3(JSONNode aNode) + { + return aNode.ReadVector3(); + } + public static implicit operator Vector4(JSONNode aNode) + { + return aNode.ReadVector4(); + } + public static implicit operator Quaternion(JSONNode aNode) + { + return aNode.ReadQuaternion(); + } + public static implicit operator Rect(JSONNode aNode) + { + return aNode.ReadRect(); + } + public static implicit operator RectOffset(JSONNode aNode) + { + return aNode.ReadRectOffset(); + } + #endregion implicit conversion operators + + #region Vector2 + public Vector2 ReadVector2(Vector2 aDefault) + { + if (IsObject) + return new Vector2(this["x"].AsFloat, this["y"].AsFloat); + if (IsArray) + return new Vector2(this[0].AsFloat, this[1].AsFloat); + return aDefault; + } + public Vector2 ReadVector2(string aXName, string aYName) + { + if (IsObject) + { + return new Vector2(this[aXName].AsFloat, this[aYName].AsFloat); + } + return Vector2.zero; + } + + public Vector2 ReadVector2() + { + return ReadVector2(Vector2.zero); + } + public JSONNode WriteVector2(Vector2 aVec, string aXName = "x", string aYName = "y") + { + if (IsObject) + { + Inline = true; + this[aXName].AsFloat = aVec.x; + this[aYName].AsFloat = aVec.y; + } + else if (IsArray) + { + Inline = true; + this[0].AsFloat = aVec.x; + this[1].AsFloat = aVec.y; + } + return this; + } + #endregion Vector2 + + #region Vector3 + public Vector3 ReadVector3(Vector3 aDefault) + { + if (IsObject) + return new Vector3(this["x"].AsFloat, this["y"].AsFloat, this["z"].AsFloat); + if (IsArray) + return new Vector3(this[0].AsFloat, this[1].AsFloat, this[2].AsFloat); + return aDefault; + } + public Vector3 ReadVector3(string aXName, string aYName, string aZName) + { + if (IsObject) + return new Vector3(this[aXName].AsFloat, this[aYName].AsFloat, this[aZName].AsFloat); + return Vector3.zero; + } + public Vector3 ReadVector3() + { + return ReadVector3(Vector3.zero); + } + public JSONNode WriteVector3(Vector3 aVec, string aXName = "x", string aYName = "y", string aZName = "z") + { + if (IsObject) + { + Inline = true; + this[aXName].AsFloat = aVec.x; + this[aYName].AsFloat = aVec.y; + this[aZName].AsFloat = aVec.z; + } + else if (IsArray) + { + Inline = true; + this[0].AsFloat = aVec.x; + this[1].AsFloat = aVec.y; + this[2].AsFloat = aVec.z; + } + return this; + } + #endregion Vector3 + + #region Vector4 + public Vector4 ReadVector4(Vector4 aDefault) + { + if (IsObject) + return new Vector4(this["x"].AsFloat, this["y"].AsFloat, this["z"].AsFloat, this["w"].AsFloat); + if (IsArray) + return new Vector4(this[0].AsFloat, this[1].AsFloat, this[2].AsFloat, this[3].AsFloat); + return aDefault; + } + public Vector4 ReadVector4() + { + return ReadVector4(Vector4.zero); + } + public JSONNode WriteVector4(Vector4 aVec) + { + if (IsObject) + { + Inline = true; + this["x"].AsFloat = aVec.x; + this["y"].AsFloat = aVec.y; + this["z"].AsFloat = aVec.z; + this["w"].AsFloat = aVec.w; + } + else if (IsArray) + { + Inline = true; + this[0].AsFloat = aVec.x; + this[1].AsFloat = aVec.y; + this[2].AsFloat = aVec.z; + this[3].AsFloat = aVec.w; + } + return this; + } + #endregion Vector4 + + #region Quaternion + public Quaternion ReadQuaternion(Quaternion aDefault) + { + if (IsObject) + return new Quaternion(this["x"].AsFloat, this["y"].AsFloat, this["z"].AsFloat, this["w"].AsFloat); + if (IsArray) + return new Quaternion(this[0].AsFloat, this[1].AsFloat, this[2].AsFloat, this[3].AsFloat); + return aDefault; + } + public Quaternion ReadQuaternion() + { + return ReadQuaternion(Quaternion.identity); + } + public JSONNode WriteQuaternion(Quaternion aRot) + { + if (IsObject) + { + Inline = true; + this["x"].AsFloat = aRot.x; + this["y"].AsFloat = aRot.y; + this["z"].AsFloat = aRot.z; + this["w"].AsFloat = aRot.w; + } + else if (IsArray) + { + Inline = true; + this[0].AsFloat = aRot.x; + this[1].AsFloat = aRot.y; + this[2].AsFloat = aRot.z; + this[3].AsFloat = aRot.w; + } + return this; + } + #endregion Quaternion + + #region Rect + public Rect ReadRect(Rect aDefault) + { + if (IsObject) + return new Rect(this["x"].AsFloat, this["y"].AsFloat, this["width"].AsFloat, this["height"].AsFloat); + if (IsArray) + return new Rect(this[0].AsFloat, this[1].AsFloat, this[2].AsFloat, this[3].AsFloat); + return aDefault; + } + public Rect ReadRect() + { + return ReadRect(new Rect()); + } + public JSONNode WriteRect(Rect aRect) + { + if (IsObject) + { + Inline = true; + this["x"].AsFloat = aRect.x; + this["y"].AsFloat = aRect.y; + this["width"].AsFloat = aRect.width; + this["height"].AsFloat = aRect.height; + } + else if (IsArray) + { + Inline = true; + this[0].AsFloat = aRect.x; + this[1].AsFloat = aRect.y; + this[2].AsFloat = aRect.width; + this[3].AsFloat = aRect.height; + } + return this; + } + #endregion Rect + + #region RectOffset + public RectOffset ReadRectOffset(RectOffset aDefault) + { + if (this is JSONObject) + return new RectOffset(this["left"].AsInt, this["right"].AsInt, this["top"].AsInt, this["bottom"].AsInt); + if (this is JSONArray) + return new RectOffset(this[0].AsInt, this[1].AsInt, this[2].AsInt, this[3].AsInt); + return aDefault; + } + public RectOffset ReadRectOffset() + { + return ReadRectOffset(new RectOffset()); + } + public JSONNode WriteRectOffset(RectOffset aRect) + { + if (IsObject) + { + Inline = true; + this["left"].AsInt = aRect.left; + this["right"].AsInt = aRect.right; + this["top"].AsInt = aRect.top; + this["bottom"].AsInt = aRect.bottom; + } + else if (IsArray) + { + Inline = true; + this[0].AsInt = aRect.left; + this[1].AsInt = aRect.right; + this[2].AsInt = aRect.top; + this[3].AsInt = aRect.bottom; + } + return this; + } + #endregion RectOffset + + #region Matrix4x4 + public Matrix4x4 ReadMatrix() + { + Matrix4x4 result = Matrix4x4.identity; + if (IsArray) + { + for (int i = 0; i < 16; i++) + { + result[i] = this[i].AsFloat; + } + } + return result; + } + public JSONNode WriteMatrix(Matrix4x4 aMatrix) + { + if (IsArray) + { + Inline = true; + for (int i = 0; i < 16; i++) + { + this[i].AsFloat = aMatrix[i]; + } + } + return this; + } + #endregion Matrix4x4 + } +} \ No newline at end of file diff --git a/Assets/Plugins/SimpleJSONUnity.cs.meta b/Assets/Plugins/SimpleJSONUnity.cs.meta new file mode 100644 index 0000000..a97e7b0 --- /dev/null +++ b/Assets/Plugins/SimpleJSONUnity.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 2661a71996161a247aaea5b3fa900cca +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scenes/Main.unity b/Assets/Scenes/Main.unity index b801af2..e1e5c10 100644 --- a/Assets/Scenes/Main.unity +++ b/Assets/Scenes/Main.unity @@ -198,8 +198,13 @@ MonoBehaviour: twistCursor: {x: 0, y: 0, z: 0} stretchCursor: {x: 0, y: 0, z: 0} pixelgon: - vectors: [] - quads: + vectors: + - {x: 0, y: 0, z: 0} + - {x: -0.3, y: -0.3, z: 0} + - {x: -0.3, y: 0.3, z: 0} + - {x: 0.3, y: -0.43, z: 0} + - {x: 0, y: 0, z: 0} + quads: 010000000200000003000000 assetSpace: folderPath: C:/dofdev/Pixelgon/Assets/AssetSpace name: draft @@ -218,8 +223,6 @@ MonoBehaviour: cursorPos: {x: 0, y: 0, z: 0} indexQuad: 0 quad: - tris: - uvs: [] toolEraser: cursorPos: {x: 0, y: 0, z: 0} selected: diff --git a/Assets/Scripts/AssetSpace.cs b/Assets/Scripts/AssetSpace.cs index a09c7b4..63dfcbc 100644 --- a/Assets/Scripts/AssetSpace.cs +++ b/Assets/Scripts/AssetSpace.cs @@ -1,10 +1,9 @@ using UnityEngine; using System; using System.IO; -using System.Runtime.Serialization.Formatters.Binary; using System.Collections; using System.Collections.Generic; -using SerializableTypes; +using SimpleJSON; [Serializable] public class AssetSpace @@ -124,45 +123,59 @@ public class AssetSpace public void Save(Pixelgon pixelgon) { - string destination = folderPath + "/" + name + ".pixelgon"; - FileStream file; - - if (File.Exists(destination)) file = File.OpenWrite(destination); - else file = File.Create(destination); - - BinaryFormatter bf = new BinaryFormatter(); - FPixelgon fPixelgon = new FPixelgon(); - fPixelgon.vectors = new SVector3[pixelgon.vectors.Count]; - for (int i = 0; i < pixelgon.vectors.Count; i++) + // Cleanup Empty Vectors and re-index quads + int dup = 0; + for (int i = pixelgon.vectors.Count - 1; i >= 0; i--) { - SVector3 vec3 = pixelgon.vectors[i]; - fPixelgon.vectors[i] = vec3; + if (pixelgon.vectors[i] == Vector3.zero) + { + if (dup++ > 0) + { + for (int j = 0; j < pixelgon.quads.Count; j++) + { + if (pixelgon.quads[j] >= i) + { + pixelgon.quads[j]--; + } + } + + pixelgon.vectors.RemoveAt(i); + } + } + else + { + dup = 0; + } } - bf.Serialize(file, fPixelgon); - file.Close(); + + string destination = folderPath + "/" + name + ".json"; + File.WriteAllText(destination, JsonUtility.ToJson(pixelgon)); } public Pixelgon Load() { - string destination = folderPath + "/" + name + ".pixelgon"; - FileStream file; - - if (File.Exists(destination)) file = File.OpenRead(destination); - else + string destination = folderPath + "/" + name + ".json"; + if (!File.Exists(destination)) { Debug.LogError("File not found"); return null; } - BinaryFormatter bf = new BinaryFormatter(); - FPixelgon fPixelgon = (FPixelgon)bf.Deserialize(file); + JSONNode N = JSON.Parse(File.ReadAllText(destination)); + Pixelgon pixelgon = new Pixelgon(); - for (int i = 0; i < fPixelgon.vectors.Length; i++) + pixelgon.vectors.Clear(); + for (int i = 0; i < N["vectors"].Count; i++) { - Vector3 vec3 = fPixelgon.vectors[i]; - pixelgon.vectors.Add(vec3); + pixelgon.vectors.Add( + new Vector3(N["vectors"][i][0].AsFloat, N["vectors"][i][1].AsFloat, N["vectors"][i][2].AsFloat) + ); + } + pixelgon.quads.Clear(); + for (int i = 0; i < N["quads"].Count; i++) + { + pixelgon.quads.Add(N["quads"][i].AsInt); } - file.Close(); return pixelgon; } } @@ -173,125 +186,4 @@ public class Asset public Mesh mesh; public Vector3 pos; public Quaternion rot; -} - -[Serializable] -public class FAssetSpace -{ - // public class Placement - // { - // public SerializableVector3 pos - // } -} - -[Serializable] -public class FPixelgon -{ - public SVector3[] vectors; -} - -namespace SerializableTypes -{ - /// Serializable version of UnityEngine.Vector3. - [Serializable] - public struct SVector3 - { - public float x; - public float y; - public float z; - - public SVector3(float x, float y, float z) - { - this.x = x; - this.y = y; - this.z = z; - } - - public override string ToString() - => $"[x, y, z]"; - - public static implicit operator Vector3(SVector3 s) - => new Vector3(s.x, s.y, s.z); - - public static implicit operator SVector3(Vector3 v) - => new SVector3(v.x, v.y, v.z); - - - public static SVector3 operator +(SVector3 a, SVector3 b) - => new SVector3(a.x + b.x, a.y + b.y, a.z + b.z); - - public static SVector3 operator -(SVector3 a, SVector3 b) - => new SVector3(a.x - b.x, a.y - b.y, a.z - b.z); - - public static SVector3 operator -(SVector3 a) - => new SVector3(-a.x, -a.y, -a.z); - - public static SVector3 operator *(SVector3 a, float m) - => new SVector3(a.x * m, a.y * m, a.z * m); - - public static SVector3 operator *(float m, SVector3 a) - => new SVector3(a.x * m, a.y * m, a.z * m); - - public static SVector3 operator /(SVector3 a, float d) - => new SVector3(a.x / d, a.y / d, a.z / d); - } - - /// Serializable version of UnityEngine.Quaternion. - [Serializable] - public struct SQuaternion - { - public float x; - public float y; - public float z; - public float w; - - public SQuaternion(float x, float y, float z, float w) - { - this.x = x; - this.y = y; - this.z = z; - this.w = w; - } - - public override string ToString() - => $"[{x}, {y}, {z}, {w}]"; - - public static implicit operator Quaternion(SQuaternion s) - => new Quaternion(s.x, s.y, s.z, s.w); - - public static implicit operator SQuaternion(Quaternion q) - => new SQuaternion(q.x, q.y, q.z, q.w); - } - - /// Serializable version of UnityEngine.Color32 without transparency. - [Serializable] - public struct SColor32 - { - public byte r; - public byte g; - public byte b; - - public SColor32(byte r, byte g, byte b) - { - this.r = r; - this.g = g; - this.b = b; - } - - public SColor32(Color32 c) - { - r = c.r; - g = c.g; - b = c.b; - } - - public override string ToString() - => $"[{r}, {g}, {b}]"; - - public static implicit operator Color32(SColor32 rValue) - => new Color32(rValue.r, rValue.g, rValue.b, a: byte.MaxValue); - - public static implicit operator SColor32(Color32 rValue) - => new SColor32(rValue.r, rValue.g, rValue.b); - } } \ No newline at end of file