mirror of
https://github.com/exogen/t2-mapper.git
synced 2026-03-24 06:39:29 +00:00
1 line
19 KiB
JavaScript
1 line
19 KiB
JavaScript
|
|
import{r as e}from"./chunk-DECur_0Z.js";import{n as t,r as n,t as r}from"./jsx-runtime-BpGWiA-R.js";import{i}from"./react-three-fiber.esm-CgPHUpXo.js";import{a}from"./SettingsProvider-CCHVZuSg.js";import{S as o,a as s,d as c,f as l,i as u,l as d,p as f,r as p,t as m}from"./GenericShape-PntybIni.js";import"./logger-z_EpIdIa.js";import"./traditional-BTL5qX2E.js";import{$ as h,Q as g,bt as _,i as v,o as y,s as b}from"./three.module-07hRbor4.js";import"./mission-D8vr00S1.js";import{a as x,i as S,o as C}from"./engineStore-Dkm20jvr.js";import{r as ee}from"./loaders-VxR5Bl13.js";import{n as te}from"./AudioContext-CMp1T7r9.js";import"./FloatingLabel-C7nyg5oz.js";import{getCachedAudioBuffer as ne,getSoundGeneration as w,playOneShotSound as T,resolveAudioProfile as re,trackSound as ie,untrackSound as E}from"./AudioEmitter-awEqEuEC.js";import{t as D}from"./DebugSuspense-Dk4MzcWf.js";import{n as O}from"./streamPlaybackStore-DhJekvnx.js";import{c as k}from"./globalFogUniforms-CtxQvsRj.js";import{t as A}from"./ShapeErrorBoundary-CJ_4YTMy.js";var j=t(),M=e(n(),1),N=.1,P=20;function F(e){return-2*Math.atan2(e[1],e[3])}function ae(e,t,n,r){if(n)return{animation:`fall`,timeScale:1};if(!e)return{animation:`root`,timeScale:1};let[i,a,o]=e,s=i*i+a*a;if(Math.abs(o)>2||s>P*P)return r?{animation:`jet`,timeScale:1}:{animation:`root`,timeScale:1};let c=F(t),l=Math.cos(c),u=Math.sin(c),d=i*l+a*u,f=-i*u+a*l,p=f,m=-f,h=-d,g=d,_=Math.max(p,m,h,g);return _<N?{animation:`root`,timeScale:1}:_===p?{animation:`run`,timeScale:1}:_===m?{animation:`back`,timeScale:1}:_===h?{animation:`side`,timeScale:1}:{animation:`side`,timeScale:-1}}var I=-1,L=32,R=1,z=2,B=3,V=4,H=class{states;seqIndexToName;currentStateIndex=0;delayTime=0;lastFireCount=-1;spinTimeScale=0;constructor(e,t){this.states=e,this.seqIndexToName=t,e.length>0&&(this.delayTime=e[0].timeoutValue??0)}get stateIndex(){return this.currentStateIndex}reset(){this.currentStateIndex=0,this.delayTime=this.states.length>0?this.states[0].timeoutValue??0:0,this.lastFireCount=-1}tick(e,t){if(this.states.length===0)return{sequenceName:null,isFiring:!1,spinTimeScale:0,reverse:!1,scaleAnimation:!1,timeoutValue:0,transitioned:!1,soundDataBlockIds:[],stateIndex:-1};let n=this.lastFireCount>=0&&t.fireCount!==this.lastFireCount;this.lastFireCount=t.fireCount;let r=[];if(n){let e=this.states.findIndex(e=>e.fire);if(e>=0&&e!==this.currentStateIndex){this.currentStateIndex=e,this.delayTime=this.states[e].timeoutValue??0;let t=this.states[e].soundDataBlockId;t>=0&&r.push(t)}}this.delayTime-=e;let i=n,a=this.evaluateTickTransitions(t),o=0;for(;a>=0&&o<L;){if(o++,i=!0,a===this.currentStateIndex){this.delayTime=this.states[a].timeoutValue??0;break}let e=this.states[this.currentStateIndex].spin,n=this.delayTime;this.currentStateIndex=a;let s=this.states[a].timeoutValue??0;this.delayTime=s;let c=this.states[a].soundDataBlockId;switch(c>=0&&r.push(c),this.states[a].spin){case R:this.spinTimeScale=0;break;case V:this.spinTimeScale=1;break;case z:e===B&&s>0&&(this.delayTime*=1-n/s);break;case B:e===z&&s>0&&(this.delayTime*=1-n/s);break}a=this.evaluateEntryTransitions(t)}let s=this.states[this.currentStateIndex],c=s.timeoutValue??0;switch(s.spin){case R:this.spinTimeScale=0;break;case z:this.spinTimeScale=c>0?Math.max(0,1-this.delayTime/c):1;break;case V:this.spinTimeScale=1;break;case B:this.spinTimeScale=c>0?Math.max(0,this.delayTime/c):0;break}return{sequenceName:this.resolveSequenceName(s),isFiring:s.fire,spinTimeScale:this.spinTimeScale,reverse:!s.direction,scaleAnimation:s.scaleAnimation,timeoutValue:s.timeoutValue??0,transitioned:i,soundDataBlockIds:r,stateIndex:this.currentStateIndex}}evaluateTickTransitions(e){let t=this.states[this.currentStateIndex],n=this.delayTime<=0;if(!(n||!t.waitForTimeout))return-1;let r=this.evaluateConditions(t,e);if(r!==-1)return r;if(n){let e=t.transitionOnTimeout;if(e!==I)return e}return-1}evaluateEntryTransitions(e){let t=this.states[this.currentStateIndex];return this.evaluateConditions(t,e)}evaluateConditions(e,t){let n=t.loaded?e.transitionOnLoaded:e.transitionOnNotLoaded;if(n!==I)return
|