AMTween.cs 168 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717
  1. using System;
  2. using System.Collections;
  3. using System.Reflection;
  4. using UnityEngine;
  5. public class AMTween : MonoBehaviour
  6. {
  7. private static AMCameraFade cf
  8. {
  9. get
  10. {
  11. return AMCameraFade.getCameraFade(false);
  12. }
  13. }
  14. public static bool isTransitionReversed(int transition, float[] r)
  15. {
  16. switch (transition)
  17. {
  18. case 3:
  19. case 4:
  20. case 6:
  21. if (r.Length >= 1 && r[0] == 1f)
  22. {
  23. return true;
  24. }
  25. break;
  26. }
  27. return false;
  28. }
  29. public static void Init(GameObject target)
  30. {
  31. AMTween.MoveBy(target, Vector3.zero, 0f, string.Empty);
  32. }
  33. public static void CameraFade(AMTween.Fade type, bool useRenderTexture, float[] parameters, Hashtable args)
  34. {
  35. AMTween.CameraFade((int)type, useRenderTexture, parameters, args);
  36. }
  37. public static void CameraFade(int type, bool useRenderTexture, float[] parameters, Hashtable args)
  38. {
  39. args = AMTween.CleanArgs(args);
  40. bool flag = false;
  41. if ((type != 5 && !args.Contains("camera1") && !args.Contains("color1")) || (!args.Contains("camera2") && !args.Contains("color2")))
  42. {
  43. flag = true;
  44. }
  45. else if (type != 5 && args.Contains("camera1") && (args["camera1"] == null || args["camera1"].GetType() != typeof(Camera)))
  46. {
  47. flag = true;
  48. }
  49. else if (args.Contains("camera2") && (args["camera2"] == null || args["camera2"].GetType() != typeof(Camera)))
  50. {
  51. flag = true;
  52. }
  53. else if (type != 5 && args.Contains("color1") && (args["color1"] == null || args["color1"].GetType() != typeof(Color)))
  54. {
  55. flag = true;
  56. }
  57. else if (args.Contains("color2") && (args["color2"] == null || args["color2"].GetType() != typeof(Color)))
  58. {
  59. flag = true;
  60. }
  61. if (flag)
  62. {
  63. Debug.LogWarning("AMTween: CameraFade requires at least two arguments; Camera 'camera1' or Color 'color1' and Camera 'camera2' or Color 'color2'.");
  64. return;
  65. }
  66. if (!args.Contains("reversed") || args["reversed"].GetType() != typeof(bool))
  67. {
  68. args["reversed"] = false;
  69. }
  70. if (!args.Contains("allcameras") || args["allcameras"].GetType() != typeof(Camera[]))
  71. {
  72. args["allcameras"] = (Camera[])UnityEngine.Object.FindObjectsOfType(typeof(Camera));
  73. }
  74. if (args.Contains("texture"))
  75. {
  76. bool flag2 = false;
  77. if (args["texture"] == null)
  78. {
  79. flag2 = true;
  80. }
  81. else if (args["texture"].GetType() != typeof(Texture2D))
  82. {
  83. Debug.LogWarning("AMTween: CameraFade parameter 'irisshape' must be a Texture2D! No texture will be used.");
  84. flag2 = true;
  85. }
  86. if (flag2)
  87. {
  88. args.Remove("texture");
  89. }
  90. }
  91. AMTween.cf.incrementKeepAlives();
  92. args["type"] = "camerafade";
  93. args["camerafadetype"] = type;
  94. args["userendertex"] = useRenderTexture;
  95. args["parameters"] = parameters;
  96. AMTween.Launch(AMTween.cf.gameObject, args);
  97. }
  98. public static void CameraFadeFrom(float amount, float time, string trackId)
  99. {
  100. if (AMTween.cameraFade)
  101. {
  102. AMTween.CameraFadeFrom(AMTween.Hash(new object[]
  103. {
  104. "trackid",
  105. trackId,
  106. "amount",
  107. amount,
  108. "time",
  109. time
  110. }));
  111. }
  112. else
  113. {
  114. Debug.LogError("AMTween Error: You must first add a camera fade object with CameraFadeAdd() before atttempting to use camera fading.");
  115. }
  116. }
  117. public static void CameraFadeFrom(Hashtable args)
  118. {
  119. if (AMTween.cameraFade)
  120. {
  121. AMTween.ColorFrom(AMTween.cameraFade, args);
  122. }
  123. else
  124. {
  125. Debug.LogError("AMTween Error: You must first add a camera fade object with CameraFadeAdd() before atttempting to use camera fading.");
  126. }
  127. }
  128. public static void CameraFadeTo(float amount, float time, string trackId)
  129. {
  130. if (AMTween.cameraFade)
  131. {
  132. AMTween.CameraFadeTo(AMTween.Hash(new object[]
  133. {
  134. "trackid",
  135. trackId,
  136. "amount",
  137. amount,
  138. "time",
  139. time
  140. }));
  141. }
  142. else
  143. {
  144. Debug.LogError("AMTween Error: You must first add a camera fade object with CameraFadeAdd() before atttempting to use camera fading.");
  145. }
  146. }
  147. public static void CameraFadeTo(Hashtable args)
  148. {
  149. if (AMTween.cameraFade)
  150. {
  151. AMTween.ColorTo(AMTween.cameraFade, args);
  152. }
  153. else
  154. {
  155. Debug.LogError("AMTween Error: You must first add a camera fade object with CameraFadeAdd() before atttempting to use camera fading.");
  156. }
  157. }
  158. public static void ValueTo(GameObject target, Hashtable args)
  159. {
  160. args = AMTween.CleanArgs(args);
  161. if (!args.Contains("onupdate") || !args.Contains("from") || !args.Contains("to"))
  162. {
  163. Debug.LogError("AMTween Error: ValueTo() requires an 'onupdate' callback function and a 'from' and 'to' property. The supplied 'onupdate' callback must accept a single argument that is the same type as the supplied 'from' and 'to' properties!");
  164. return;
  165. }
  166. args["type"] = "value";
  167. if (args["from"].GetType() == typeof(Vector2))
  168. {
  169. args["method"] = "vector2";
  170. }
  171. else if (args["from"].GetType() == typeof(Vector3))
  172. {
  173. args["method"] = "vector3";
  174. }
  175. else if (args["from"].GetType() == typeof(Rect))
  176. {
  177. args["method"] = "rect";
  178. }
  179. else if (args["from"].GetType() == typeof(float))
  180. {
  181. args["method"] = "float";
  182. }
  183. else
  184. {
  185. if (args["from"].GetType() != typeof(Color))
  186. {
  187. Debug.LogError("AMTween Error: ValueTo() only works with interpolating Vector3s, Vector2s, floats, ints, Rects and Colors!");
  188. return;
  189. }
  190. args["method"] = "color";
  191. }
  192. if (!args.Contains("easetype"))
  193. {
  194. args.Add("easetype", AMTween.EaseType.linear);
  195. }
  196. AMTween.Launch(target, args);
  197. }
  198. public static void PropertyTo(Component component, Hashtable args)
  199. {
  200. args = AMTween.CleanArgs(args);
  201. if (!args.Contains("fieldinfo") && !args.Contains("propertyinfo") && !args.Contains("methodinfo"))
  202. {
  203. Debug.LogError("AMTween Error: PropertyTo() requires a valid 'fieldinfo', 'propertyinfo' or 'methodinfo'.");
  204. return;
  205. }
  206. if (!args.Contains("from") || !args.Contains("to"))
  207. {
  208. Debug.LogError("AMTween Error: PropertyTo() requires a 'from' and 'to' property.");
  209. return;
  210. }
  211. args["type"] = "property";
  212. if (args.Contains("methodtype"))
  213. {
  214. if (!((string)args["methodtype"] == "morph"))
  215. {
  216. Debug.LogError("AMTween Error: Invalid method type '" + args["methodtype"] + "' supplied!");
  217. return;
  218. }
  219. args["method"] = "morph";
  220. if (!args.Contains("from") || args["from"].GetType() != typeof(float[]) || !args.Contains("to") || args["to"].GetType() != typeof(float[]))
  221. {
  222. Debug.LogError("AMTween Error: Morph requires from and to targets of type float[]!");
  223. return;
  224. }
  225. }
  226. else if (args["from"].GetType() == typeof(Vector2))
  227. {
  228. args["method"] = "vector2";
  229. }
  230. else if (args["from"].GetType() == typeof(Vector3))
  231. {
  232. args["method"] = "vector3";
  233. }
  234. else if (args["from"].GetType() == typeof(Rect))
  235. {
  236. args["method"] = "rect";
  237. }
  238. else if (args["from"].GetType() == typeof(float))
  239. {
  240. args["method"] = "float";
  241. }
  242. else
  243. {
  244. if (args["from"].GetType() != typeof(Color))
  245. {
  246. Debug.LogError("AMTween Error: PropertyTo() only works with interpolating Vector3s, Vector2s, floats, ints, Rects and Colors!");
  247. return;
  248. }
  249. args["method"] = "color";
  250. }
  251. if (!args.Contains("easetype"))
  252. {
  253. args.Add("easetype", AMTween.EaseType.linear);
  254. }
  255. AMTween.Launch(component, args);
  256. }
  257. public static void InvokeMethod(Component component, Hashtable args)
  258. {
  259. args = AMTween.CleanArgs(args);
  260. if (!args.Contains("methodinfo"))
  261. {
  262. Debug.LogError("AMTween Error: InvokeMethod() requires a parameter 'methodinfo'.");
  263. return;
  264. }
  265. args["type"] = "invoke";
  266. args["method"] = "method";
  267. AMTween.Launch(component, args);
  268. }
  269. public static void FadeFrom(GameObject target, float alpha, float time, string trackId)
  270. {
  271. AMTween.FadeFrom(target, AMTween.Hash(new object[]
  272. {
  273. "trackid",
  274. trackId,
  275. "alpha",
  276. alpha,
  277. "time",
  278. time
  279. }));
  280. }
  281. public static void FadeFrom(GameObject target, Hashtable args)
  282. {
  283. AMTween.ColorFrom(target, args);
  284. }
  285. public static void FadeTo(GameObject target, float alpha, float time, string trackId)
  286. {
  287. AMTween.FadeTo(target, AMTween.Hash(new object[]
  288. {
  289. "trackid",
  290. trackId,
  291. "alpha",
  292. alpha,
  293. "time",
  294. time
  295. }));
  296. }
  297. public static void FadeTo(GameObject target, Hashtable args)
  298. {
  299. AMTween.ColorTo(target, args);
  300. }
  301. public static void ColorFrom(GameObject target, Color color, float time, string trackId)
  302. {
  303. AMTween.ColorFrom(target, AMTween.Hash(new object[]
  304. {
  305. "trackid",
  306. trackId,
  307. "color",
  308. color,
  309. "time",
  310. time
  311. }));
  312. }
  313. public static void ColorFrom(GameObject target, Hashtable args)
  314. {
  315. Color color = default(Color);
  316. Color color2 = default(Color);
  317. args = AMTween.CleanArgs(args);
  318. if (!args.Contains("includechildren") || (bool)args["includechildren"])
  319. {
  320. IEnumerator enumerator = target.transform.GetEnumerator();
  321. try
  322. {
  323. while (enumerator.MoveNext())
  324. {
  325. object obj = enumerator.Current;
  326. Transform transform = (Transform)obj;
  327. Hashtable hashtable = (Hashtable)args.Clone();
  328. hashtable["ischild"] = true;
  329. AMTween.ColorFrom(transform.gameObject, hashtable);
  330. }
  331. }
  332. finally
  333. {
  334. IDisposable disposable;
  335. if ((disposable = (enumerator as IDisposable)) != null)
  336. {
  337. disposable.Dispose();
  338. }
  339. }
  340. }
  341. if (!args.Contains("easetype"))
  342. {
  343. args.Add("easetype", AMTween.EaseType.linear);
  344. }
  345. if (target.GetComponent(typeof(GUITexture)))
  346. {
  347. color = (color2 = target.GetComponent<GUITexture>().color);
  348. }
  349. else if (target.GetComponent(typeof(GUIText)))
  350. {
  351. color = (color2 = target.GetComponent<GUIText>().material.color);
  352. }
  353. else if (target.GetComponent<Renderer>())
  354. {
  355. color = (color2 = target.GetComponent<Renderer>().material.color);
  356. }
  357. else if (target.GetComponent<Light>())
  358. {
  359. color = (color2 = target.GetComponent<Light>().color);
  360. }
  361. if (args.Contains("color"))
  362. {
  363. color = (Color)args["color"];
  364. }
  365. else
  366. {
  367. if (args.Contains("r"))
  368. {
  369. color.r = (float)args["r"];
  370. }
  371. if (args.Contains("g"))
  372. {
  373. color.g = (float)args["g"];
  374. }
  375. if (args.Contains("b"))
  376. {
  377. color.b = (float)args["b"];
  378. }
  379. if (args.Contains("a"))
  380. {
  381. color.a = (float)args["a"];
  382. }
  383. }
  384. if (args.Contains("amount"))
  385. {
  386. color.a = (float)args["amount"];
  387. args.Remove("amount");
  388. }
  389. else if (args.Contains("alpha"))
  390. {
  391. color.a = (float)args["alpha"];
  392. args.Remove("alpha");
  393. }
  394. if (target.GetComponent(typeof(GUITexture)))
  395. {
  396. target.GetComponent<GUITexture>().color = color;
  397. }
  398. else if (target.GetComponent(typeof(GUIText)))
  399. {
  400. target.GetComponent<GUIText>().material.color = color;
  401. }
  402. else if (target.GetComponent<Renderer>())
  403. {
  404. target.GetComponent<Renderer>().material.color = color;
  405. }
  406. else if (target.GetComponent<Light>())
  407. {
  408. target.GetComponent<Light>().color = color;
  409. }
  410. args["color"] = color2;
  411. args["type"] = "color";
  412. args["method"] = "to";
  413. AMTween.Launch(target, args);
  414. }
  415. public static void ColorTo(GameObject target, Color color, float time, string trackId)
  416. {
  417. AMTween.ColorTo(target, AMTween.Hash(new object[]
  418. {
  419. "trackid",
  420. trackId,
  421. "color",
  422. color,
  423. "time",
  424. time
  425. }));
  426. }
  427. public static void ColorTo(GameObject target, Hashtable args)
  428. {
  429. args = AMTween.CleanArgs(args);
  430. if (!args.Contains("includechildren") || (bool)args["includechildren"])
  431. {
  432. IEnumerator enumerator = target.transform.GetEnumerator();
  433. try
  434. {
  435. while (enumerator.MoveNext())
  436. {
  437. object obj = enumerator.Current;
  438. Transform transform = (Transform)obj;
  439. Hashtable hashtable = (Hashtable)args.Clone();
  440. hashtable["ischild"] = true;
  441. AMTween.ColorTo(transform.gameObject, hashtable);
  442. }
  443. }
  444. finally
  445. {
  446. IDisposable disposable;
  447. if ((disposable = (enumerator as IDisposable)) != null)
  448. {
  449. disposable.Dispose();
  450. }
  451. }
  452. }
  453. if (!args.Contains("easetype"))
  454. {
  455. args.Add("easetype", AMTween.EaseType.linear);
  456. }
  457. args["type"] = "color";
  458. args["method"] = "to";
  459. AMTween.Launch(target, args);
  460. }
  461. public static void AudioFrom(GameObject target, float volume, float pitch, float time, string trackId)
  462. {
  463. AMTween.AudioFrom(target, AMTween.Hash(new object[]
  464. {
  465. "trackid",
  466. trackId,
  467. "volume",
  468. volume,
  469. "pitch",
  470. pitch,
  471. "time",
  472. time
  473. }));
  474. }
  475. public static void AudioFrom(GameObject target, Hashtable args)
  476. {
  477. args = AMTween.CleanArgs(args);
  478. AudioSource audioSource;
  479. if (args.Contains("audiosource"))
  480. {
  481. audioSource = (AudioSource)args["audiosource"];
  482. }
  483. else
  484. {
  485. if (!target.GetComponent(typeof(AudioSource)))
  486. {
  487. Debug.LogError("AMTween Error: AudioFrom requires an AudioSource.");
  488. return;
  489. }
  490. audioSource = target.GetComponent<AudioSource>();
  491. }
  492. Vector2 vector;
  493. Vector2 vector2;
  494. vector.x = (vector2.x = audioSource.volume);
  495. vector.y = (vector2.y = audioSource.pitch);
  496. if (args.Contains("volume"))
  497. {
  498. vector2.x = (float)args["volume"];
  499. }
  500. if (args.Contains("pitch"))
  501. {
  502. vector2.y = (float)args["pitch"];
  503. }
  504. audioSource.volume = vector2.x;
  505. audioSource.pitch = vector2.y;
  506. args["volume"] = vector.x;
  507. args["pitch"] = vector.y;
  508. if (!args.Contains("easetype"))
  509. {
  510. args.Add("easetype", AMTween.EaseType.linear);
  511. }
  512. args["type"] = "audio";
  513. args["method"] = "to";
  514. AMTween.Launch(target, args);
  515. }
  516. public static void AudioTo(GameObject target, float volume, float pitch, float time, string trackId)
  517. {
  518. AMTween.AudioTo(target, AMTween.Hash(new object[]
  519. {
  520. "trackid",
  521. trackId,
  522. "volume",
  523. volume,
  524. "pitch",
  525. pitch,
  526. "time",
  527. time
  528. }));
  529. }
  530. public static void AudioTo(GameObject target, Hashtable args)
  531. {
  532. args = AMTween.CleanArgs(args);
  533. if (!args.Contains("easetype"))
  534. {
  535. args.Add("easetype", AMTween.EaseType.linear);
  536. }
  537. args["type"] = "audio";
  538. args["method"] = "to";
  539. AMTween.Launch(target, args);
  540. }
  541. public static void Stab(GameObject target, AudioClip audioclip, float delay, string trackId)
  542. {
  543. AMTween.Stab(target, AMTween.Hash(new object[]
  544. {
  545. "trackid",
  546. trackId,
  547. "audioclip",
  548. audioclip,
  549. "delay",
  550. delay
  551. }));
  552. }
  553. public static void Stab(GameObject target, Hashtable args)
  554. {
  555. args = AMTween.CleanArgs(args);
  556. args["type"] = "stab";
  557. AMTween.Launch(target, args);
  558. }
  559. public static void LookFrom(GameObject target, Vector3 looktarget, float time, string trackId)
  560. {
  561. AMTween.LookFrom(target, AMTween.Hash(new object[]
  562. {
  563. "trackid",
  564. trackId,
  565. "looktarget",
  566. looktarget,
  567. "time",
  568. time
  569. }));
  570. }
  571. public static void LookFrom(GameObject target, Hashtable args)
  572. {
  573. args = AMTween.CleanArgs(args);
  574. Vector3 eulerAngles = target.transform.eulerAngles;
  575. if (args["looktarget"].GetType() == typeof(Transform))
  576. {
  577. Transform transform = target.transform;
  578. Transform target2 = (Transform)args["looktarget"];
  579. Vector3? vector = (Vector3?)args["up"];
  580. transform.LookAt(target2, (vector == null) ? AMTween.Defaults.up : vector.Value);
  581. }
  582. else if (args["looktarget"].GetType() == typeof(Vector3))
  583. {
  584. Transform transform2 = target.transform;
  585. Vector3 worldPosition = (Vector3)args["looktarget"];
  586. Vector3? vector2 = (Vector3?)args["up"];
  587. transform2.LookAt(worldPosition, (vector2 == null) ? AMTween.Defaults.up : vector2.Value);
  588. }
  589. if (args.Contains("axis"))
  590. {
  591. Vector3 eulerAngles2 = target.transform.eulerAngles;
  592. string text = (string)args["axis"];
  593. if (text != null)
  594. {
  595. if (!(text == "x"))
  596. {
  597. if (!(text == "y"))
  598. {
  599. if (text == "z")
  600. {
  601. eulerAngles2.x = eulerAngles.x;
  602. eulerAngles2.y = eulerAngles.y;
  603. }
  604. }
  605. else
  606. {
  607. eulerAngles2.x = eulerAngles.x;
  608. eulerAngles2.z = eulerAngles.z;
  609. }
  610. }
  611. else
  612. {
  613. eulerAngles2.y = eulerAngles.y;
  614. eulerAngles2.z = eulerAngles.z;
  615. }
  616. }
  617. target.transform.eulerAngles = eulerAngles2;
  618. }
  619. args["rotation"] = eulerAngles;
  620. args["type"] = "rotate";
  621. args["method"] = "to";
  622. AMTween.Launch(target, args);
  623. }
  624. public static void LookToFollow(GameObject target, Transform looktarget, float time, string trackId)
  625. {
  626. AMTween.LookToFollow(target, AMTween.Hash(new object[]
  627. {
  628. "trackid",
  629. trackId,
  630. "looktarget",
  631. looktarget,
  632. "time",
  633. time
  634. }));
  635. }
  636. public static void LookToFollow(GameObject target, Hashtable args)
  637. {
  638. args = AMTween.CleanArgs(args);
  639. if (args.Contains("looktarget") && args["looktarget"].GetType() == typeof(Transform))
  640. {
  641. Transform transform = (Transform)args["looktarget"];
  642. args["position"] = new Vector3(transform.position.x, transform.position.y, transform.position.z);
  643. args["rotation"] = new Vector3(transform.eulerAngles.x, transform.eulerAngles.y, transform.eulerAngles.z);
  644. }
  645. if (args.Contains("endposition") && args["endposition"] == null)
  646. {
  647. args.Remove("endposition");
  648. }
  649. args["type"] = "look";
  650. args["method"] = "tofollow";
  651. AMTween.Launch(target, args);
  652. }
  653. public static void LookFollow(GameObject target, Transform looktarget, float time, string trackId)
  654. {
  655. AMTween.LookFollow(target, AMTween.Hash(new object[]
  656. {
  657. "trackid",
  658. trackId,
  659. "looktarget",
  660. looktarget,
  661. "time",
  662. time
  663. }));
  664. }
  665. public static void LookFollow(GameObject target, Hashtable args)
  666. {
  667. args = AMTween.CleanArgs(args);
  668. if (args.Contains("looktarget") && args["looktarget"].GetType() == typeof(Transform))
  669. {
  670. Transform transform = (Transform)args["looktarget"];
  671. args["position"] = new Vector3(transform.position.x, transform.position.y, transform.position.z);
  672. args["rotation"] = new Vector3(transform.eulerAngles.x, transform.eulerAngles.y, transform.eulerAngles.z);
  673. }
  674. args["type"] = "look";
  675. args["method"] = "follow";
  676. AMTween.Launch(target, args);
  677. }
  678. public static void LookTo(GameObject target, Vector3 looktarget, float time, string trackId)
  679. {
  680. AMTween.LookTo(target, AMTween.Hash(new object[]
  681. {
  682. "trackid",
  683. trackId,
  684. "looktarget",
  685. looktarget,
  686. "time",
  687. time
  688. }));
  689. }
  690. public static void LookTo(GameObject target, Hashtable args)
  691. {
  692. args = AMTween.CleanArgs(args);
  693. if (args.Contains("looktarget") && args["looktarget"].GetType() == typeof(Transform))
  694. {
  695. Transform transform = (Transform)args["looktarget"];
  696. args["position"] = new Vector3(transform.position.x, transform.position.y, transform.position.z);
  697. args["rotation"] = new Vector3(transform.eulerAngles.x, transform.eulerAngles.y, transform.eulerAngles.z);
  698. }
  699. args["type"] = "look";
  700. args["method"] = "to";
  701. AMTween.Launch(target, args);
  702. }
  703. public static void SendMessage(GameObject target, string methodName, object parameter, string trackId)
  704. {
  705. AMTween.SendMessage(target, AMTween.Hash(new object[]
  706. {
  707. "trackid",
  708. trackId,
  709. "methodname",
  710. methodName,
  711. "parameter",
  712. parameter
  713. }));
  714. }
  715. public static void SendMessage(GameObject target, Hashtable args)
  716. {
  717. args = AMTween.CleanArgs(args);
  718. if (!args.Contains("methodname"))
  719. {
  720. Debug.LogError("AMTween Error: SendMessage() requires 'methodname'.");
  721. return;
  722. }
  723. args["type"] = "send";
  724. args["method"] = "message";
  725. AMTween.Launch(target, args);
  726. }
  727. public static void PlayAnimation(GameObject target, string animation, WrapMode wrapmode, bool crossfade, string trackId)
  728. {
  729. AMTween.PlayAnimation(target, AMTween.Hash(new object[]
  730. {
  731. "trackid",
  732. trackId,
  733. "animation",
  734. animation,
  735. "crossfade",
  736. crossfade,
  737. "wrapmode",
  738. wrapmode
  739. }));
  740. }
  741. public static void PlayAnimation(GameObject target, Hashtable args)
  742. {
  743. args["type"] = "play";
  744. args["method"] = "animation";
  745. AMTween.Launch(target, args);
  746. }
  747. public static void PlayAudio(AudioSource audioSource, AudioClip audioClip, bool loop, string trackId)
  748. {
  749. AMTween.PlayAudio(audioSource, AMTween.Hash(new object[]
  750. {
  751. "trackid",
  752. trackId,
  753. "audiosource",
  754. audioSource,
  755. "audioclip",
  756. audioClip,
  757. "loop",
  758. loop
  759. }));
  760. }
  761. public static void PlayAudio(AudioSource audioSource, Hashtable args)
  762. {
  763. args = AMTween.CleanArgs(args);
  764. args["audiosource"] = audioSource;
  765. args["type"] = "play";
  766. args["method"] = "audio";
  767. if ((bool)args["loop"])
  768. {
  769. args["looptype"] = AMTween.LoopType.loop;
  770. }
  771. AMTween.Launch(audioSource.gameObject, args);
  772. }
  773. public static void MoveTo(GameObject target, Vector3 position, float time, string trackId)
  774. {
  775. AMTween.MoveTo(target, AMTween.Hash(new object[]
  776. {
  777. "trackid",
  778. trackId,
  779. "position",
  780. position,
  781. "time",
  782. time
  783. }));
  784. }
  785. public static void MoveTo(GameObject target, Hashtable args)
  786. {
  787. args = AMTween.CleanArgs(args);
  788. if (args.Contains("position") && args["position"].GetType() == typeof(Transform))
  789. {
  790. Transform transform = (Transform)args["position"];
  791. args["position"] = new Vector3(transform.position.x, transform.position.y, transform.position.z);
  792. args["rotation"] = new Vector3(transform.eulerAngles.x, transform.eulerAngles.y, transform.eulerAngles.z);
  793. args["scale"] = new Vector3(transform.localScale.x, transform.localScale.y, transform.localScale.z);
  794. }
  795. args["type"] = "move";
  796. args["method"] = "to";
  797. AMTween.Launch(target, args);
  798. }
  799. public static void MoveFrom(GameObject target, Vector3 position, float time, string trackId)
  800. {
  801. AMTween.MoveFrom(target, AMTween.Hash(new object[]
  802. {
  803. "trackid",
  804. trackId,
  805. "position",
  806. position,
  807. "time",
  808. time
  809. }));
  810. }
  811. public static void MoveFrom(GameObject target, Hashtable args)
  812. {
  813. args = AMTween.CleanArgs(args);
  814. bool flag;
  815. if (args.Contains("islocal"))
  816. {
  817. flag = (bool)args["islocal"];
  818. }
  819. else
  820. {
  821. flag = AMTween.Defaults.isLocal;
  822. }
  823. if (args.Contains("path"))
  824. {
  825. Vector3[] array2;
  826. if (args["path"].GetType() == typeof(Vector3[]))
  827. {
  828. Vector3[] array = (Vector3[])args["path"];
  829. array2 = new Vector3[array.Length];
  830. Array.Copy(array, array2, array.Length);
  831. }
  832. else
  833. {
  834. Transform[] array3 = (Transform[])args["path"];
  835. array2 = new Vector3[array3.Length];
  836. for (int i = 0; i < array3.Length; i++)
  837. {
  838. array2[i] = array3[i].position;
  839. }
  840. }
  841. if (array2[array2.Length - 1] != target.transform.position)
  842. {
  843. Vector3[] array4 = new Vector3[array2.Length + 1];
  844. Array.Copy(array2, array4, array2.Length);
  845. if (flag)
  846. {
  847. array4[array4.Length - 1] = target.transform.localPosition;
  848. target.transform.localPosition = array4[0];
  849. }
  850. else
  851. {
  852. array4[array4.Length - 1] = target.transform.position;
  853. target.transform.position = array4[0];
  854. }
  855. args["path"] = array4;
  856. }
  857. else
  858. {
  859. if (flag)
  860. {
  861. target.transform.localPosition = array2[0];
  862. }
  863. else
  864. {
  865. target.transform.position = array2[0];
  866. }
  867. args["path"] = array2;
  868. }
  869. }
  870. else
  871. {
  872. Vector3 vector2;
  873. Vector3 vector;
  874. if (flag)
  875. {
  876. vector = (vector2 = target.transform.localPosition);
  877. }
  878. else
  879. {
  880. vector = (vector2 = target.transform.position);
  881. }
  882. if (args.Contains("position"))
  883. {
  884. if (args["position"].GetType() == typeof(Transform))
  885. {
  886. Transform transform = (Transform)args["position"];
  887. vector = transform.position;
  888. }
  889. else if (args["position"].GetType() == typeof(Vector3))
  890. {
  891. vector = (Vector3)args["position"];
  892. }
  893. }
  894. else
  895. {
  896. if (args.Contains("x"))
  897. {
  898. vector.x = (float)args["x"];
  899. }
  900. if (args.Contains("y"))
  901. {
  902. vector.y = (float)args["y"];
  903. }
  904. if (args.Contains("z"))
  905. {
  906. vector.z = (float)args["z"];
  907. }
  908. }
  909. if (flag)
  910. {
  911. target.transform.localPosition = vector;
  912. }
  913. else
  914. {
  915. target.transform.position = vector;
  916. }
  917. args["position"] = vector2;
  918. }
  919. args["type"] = "move";
  920. args["method"] = "to";
  921. AMTween.Launch(target, args);
  922. }
  923. public static void MoveAdd(GameObject target, Vector3 amount, float time, string trackId)
  924. {
  925. AMTween.MoveAdd(target, AMTween.Hash(new object[]
  926. {
  927. "trackid",
  928. trackId,
  929. "amount",
  930. amount,
  931. "time",
  932. time
  933. }));
  934. }
  935. public static void MoveAdd(GameObject target, Hashtable args)
  936. {
  937. args = AMTween.CleanArgs(args);
  938. args["type"] = "move";
  939. args["method"] = "add";
  940. AMTween.Launch(target, args);
  941. }
  942. public static void MoveBy(GameObject target, Vector3 amount, float time, string trackId)
  943. {
  944. AMTween.MoveBy(target, AMTween.Hash(new object[]
  945. {
  946. "trackid",
  947. trackId,
  948. "amount",
  949. amount,
  950. "time",
  951. time
  952. }));
  953. }
  954. public static void MoveBy(GameObject target, Hashtable args)
  955. {
  956. args = AMTween.CleanArgs(args);
  957. args["type"] = "move";
  958. args["method"] = "by";
  959. AMTween.Launch(target, args);
  960. }
  961. public static void ScaleTo(GameObject target, Vector3 scale, float time, string trackId)
  962. {
  963. AMTween.ScaleTo(target, AMTween.Hash(new object[]
  964. {
  965. "trackid",
  966. trackId,
  967. "scale",
  968. scale,
  969. "time",
  970. time
  971. }));
  972. }
  973. public static void ScaleTo(GameObject target, Hashtable args)
  974. {
  975. args = AMTween.CleanArgs(args);
  976. if (args.Contains("scale") && args["scale"].GetType() == typeof(Transform))
  977. {
  978. Transform transform = (Transform)args["scale"];
  979. args["position"] = new Vector3(transform.position.x, transform.position.y, transform.position.z);
  980. args["rotation"] = new Vector3(transform.eulerAngles.x, transform.eulerAngles.y, transform.eulerAngles.z);
  981. args["scale"] = new Vector3(transform.localScale.x, transform.localScale.y, transform.localScale.z);
  982. }
  983. args["type"] = "scale";
  984. args["method"] = "to";
  985. AMTween.Launch(target, args);
  986. }
  987. public static void ScaleFrom(GameObject target, Vector3 scale, float time, string trackId)
  988. {
  989. AMTween.ScaleFrom(target, AMTween.Hash(new object[]
  990. {
  991. "trackid",
  992. trackId,
  993. "scale",
  994. scale,
  995. "time",
  996. time
  997. }));
  998. }
  999. public static void ScaleFrom(GameObject target, Hashtable args)
  1000. {
  1001. args = AMTween.CleanArgs(args);
  1002. Vector3 localScale2;
  1003. Vector3 localScale = localScale2 = target.transform.localScale;
  1004. if (args.Contains("scale"))
  1005. {
  1006. if (args["scale"].GetType() == typeof(Transform))
  1007. {
  1008. Transform transform = (Transform)args["scale"];
  1009. localScale = transform.localScale;
  1010. }
  1011. else if (args["scale"].GetType() == typeof(Vector3))
  1012. {
  1013. localScale = (Vector3)args["scale"];
  1014. }
  1015. }
  1016. else
  1017. {
  1018. if (args.Contains("x"))
  1019. {
  1020. localScale.x = (float)args["x"];
  1021. }
  1022. if (args.Contains("y"))
  1023. {
  1024. localScale.y = (float)args["y"];
  1025. }
  1026. if (args.Contains("z"))
  1027. {
  1028. localScale.z = (float)args["z"];
  1029. }
  1030. }
  1031. target.transform.localScale = localScale;
  1032. args["scale"] = localScale2;
  1033. args["type"] = "scale";
  1034. args["method"] = "to";
  1035. AMTween.Launch(target, args);
  1036. }
  1037. public static void ScaleAdd(GameObject target, Vector3 amount, float time, string trackId)
  1038. {
  1039. AMTween.ScaleAdd(target, AMTween.Hash(new object[]
  1040. {
  1041. "trackid",
  1042. trackId,
  1043. "amount",
  1044. amount,
  1045. "time",
  1046. time
  1047. }));
  1048. }
  1049. public static void ScaleAdd(GameObject target, Hashtable args)
  1050. {
  1051. args = AMTween.CleanArgs(args);
  1052. args["type"] = "scale";
  1053. args["method"] = "add";
  1054. AMTween.Launch(target, args);
  1055. }
  1056. public static void ScaleBy(GameObject target, Vector3 amount, float time, string trackId)
  1057. {
  1058. AMTween.ScaleBy(target, AMTween.Hash(new object[]
  1059. {
  1060. "trackid",
  1061. trackId,
  1062. "amount",
  1063. amount,
  1064. "time",
  1065. time
  1066. }));
  1067. }
  1068. public static void ScaleBy(GameObject target, Hashtable args)
  1069. {
  1070. args = AMTween.CleanArgs(args);
  1071. args["type"] = "scale";
  1072. args["method"] = "by";
  1073. AMTween.Launch(target, args);
  1074. }
  1075. public static void RotateTo(GameObject target, Vector3 rotation, float time, string trackId)
  1076. {
  1077. AMTween.RotateTo(target, AMTween.Hash(new object[]
  1078. {
  1079. "trackid",
  1080. trackId,
  1081. "rotation",
  1082. rotation,
  1083. "time",
  1084. time
  1085. }));
  1086. }
  1087. public static void RotateTo(GameObject target, Hashtable args)
  1088. {
  1089. args = AMTween.CleanArgs(args);
  1090. if (args.Contains("rotation") && args["rotation"].GetType() == typeof(Transform))
  1091. {
  1092. Transform transform = (Transform)args["rotation"];
  1093. args["position"] = new Vector3(transform.position.x, transform.position.y, transform.position.z);
  1094. args["rotation"] = new Vector3(transform.eulerAngles.x, transform.eulerAngles.y, transform.eulerAngles.z);
  1095. args["scale"] = new Vector3(transform.localScale.x, transform.localScale.y, transform.localScale.z);
  1096. }
  1097. args["type"] = "rotate";
  1098. args["method"] = "to";
  1099. AMTween.Launch(target, args);
  1100. }
  1101. public static void RotateFrom(GameObject target, Vector3 rotation, float time, string trackId)
  1102. {
  1103. AMTween.RotateFrom(target, AMTween.Hash(new object[]
  1104. {
  1105. "trackid",
  1106. trackId,
  1107. "rotation",
  1108. rotation,
  1109. "time",
  1110. time
  1111. }));
  1112. }
  1113. public static void RotateFrom(GameObject target, Hashtable args)
  1114. {
  1115. args = AMTween.CleanArgs(args);
  1116. bool flag;
  1117. if (args.Contains("islocal"))
  1118. {
  1119. flag = (bool)args["islocal"];
  1120. }
  1121. else
  1122. {
  1123. flag = AMTween.Defaults.isLocal;
  1124. }
  1125. Vector3 vector2;
  1126. Vector3 vector;
  1127. if (flag)
  1128. {
  1129. vector = (vector2 = target.transform.localEulerAngles);
  1130. }
  1131. else
  1132. {
  1133. vector = (vector2 = target.transform.eulerAngles);
  1134. }
  1135. if (args.Contains("rotation"))
  1136. {
  1137. if (args["rotation"].GetType() == typeof(Transform))
  1138. {
  1139. Transform transform = (Transform)args["rotation"];
  1140. vector = transform.eulerAngles;
  1141. }
  1142. else if (args["rotation"].GetType() == typeof(Vector3))
  1143. {
  1144. vector = (Vector3)args["rotation"];
  1145. }
  1146. }
  1147. else
  1148. {
  1149. if (args.Contains("x"))
  1150. {
  1151. vector.x = (float)args["x"];
  1152. }
  1153. if (args.Contains("y"))
  1154. {
  1155. vector.y = (float)args["y"];
  1156. }
  1157. if (args.Contains("z"))
  1158. {
  1159. vector.z = (float)args["z"];
  1160. }
  1161. }
  1162. if (flag)
  1163. {
  1164. target.transform.localEulerAngles = vector;
  1165. }
  1166. else
  1167. {
  1168. target.transform.eulerAngles = vector;
  1169. }
  1170. args["rotation"] = vector2;
  1171. args["type"] = "rotate";
  1172. args["method"] = "to";
  1173. AMTween.Launch(target, args);
  1174. }
  1175. public static void RotateAdd(GameObject target, Vector3 amount, float time, string trackId)
  1176. {
  1177. AMTween.RotateAdd(target, AMTween.Hash(new object[]
  1178. {
  1179. "trackid",
  1180. trackId,
  1181. "amount",
  1182. amount,
  1183. "time",
  1184. time
  1185. }));
  1186. }
  1187. public static void RotateAdd(GameObject target, Hashtable args)
  1188. {
  1189. args = AMTween.CleanArgs(args);
  1190. args["type"] = "rotate";
  1191. args["method"] = "add";
  1192. AMTween.Launch(target, args);
  1193. }
  1194. public static void RotateBy(GameObject target, Vector3 amount, float time, string trackId)
  1195. {
  1196. AMTween.RotateBy(target, AMTween.Hash(new object[]
  1197. {
  1198. "trackid",
  1199. trackId,
  1200. "amount",
  1201. amount,
  1202. "time",
  1203. time
  1204. }));
  1205. }
  1206. public static void RotateBy(GameObject target, Hashtable args)
  1207. {
  1208. args = AMTween.CleanArgs(args);
  1209. args["type"] = "rotate";
  1210. args["method"] = "by";
  1211. AMTween.Launch(target, args);
  1212. }
  1213. public static void ShakePosition(GameObject target, Vector3 amount, float time, string trackId)
  1214. {
  1215. AMTween.ShakePosition(target, AMTween.Hash(new object[]
  1216. {
  1217. "trackid",
  1218. trackId,
  1219. "amount",
  1220. amount,
  1221. "time",
  1222. time
  1223. }));
  1224. }
  1225. public static void ShakePosition(GameObject target, Hashtable args)
  1226. {
  1227. args = AMTween.CleanArgs(args);
  1228. args["type"] = "shake";
  1229. args["method"] = "position";
  1230. AMTween.Launch(target, args);
  1231. }
  1232. public static void ShakeScale(GameObject target, Vector3 amount, float time, string trackId)
  1233. {
  1234. AMTween.ShakeScale(target, AMTween.Hash(new object[]
  1235. {
  1236. "trackid",
  1237. trackId,
  1238. "amount",
  1239. amount,
  1240. "time",
  1241. time
  1242. }));
  1243. }
  1244. public static void ShakeScale(GameObject target, Hashtable args)
  1245. {
  1246. args = AMTween.CleanArgs(args);
  1247. args["type"] = "shake";
  1248. args["method"] = "scale";
  1249. AMTween.Launch(target, args);
  1250. }
  1251. public static void ShakeRotation(GameObject target, Vector3 amount, float time, string trackId)
  1252. {
  1253. AMTween.ShakeRotation(target, AMTween.Hash(new object[]
  1254. {
  1255. "trackid",
  1256. trackId,
  1257. "amount",
  1258. amount,
  1259. "time",
  1260. time
  1261. }));
  1262. }
  1263. public static void ShakeRotation(GameObject target, Hashtable args)
  1264. {
  1265. args = AMTween.CleanArgs(args);
  1266. args["type"] = "shake";
  1267. args["method"] = "rotation";
  1268. AMTween.Launch(target, args);
  1269. }
  1270. public static void PunchPosition(GameObject target, Vector3 amount, float time, string trackId)
  1271. {
  1272. AMTween.PunchPosition(target, AMTween.Hash(new object[]
  1273. {
  1274. "trackid",
  1275. trackId,
  1276. "amount",
  1277. amount,
  1278. "time",
  1279. time
  1280. }));
  1281. }
  1282. public static void PunchPosition(GameObject target, Hashtable args)
  1283. {
  1284. args = AMTween.CleanArgs(args);
  1285. args["type"] = "punch";
  1286. args["method"] = "position";
  1287. args["easetype"] = AMTween.EaseType.punch;
  1288. AMTween.Launch(target, args);
  1289. }
  1290. public static void PunchRotation(GameObject target, Vector3 amount, float time, string trackId)
  1291. {
  1292. AMTween.PunchRotation(target, AMTween.Hash(new object[]
  1293. {
  1294. "trackid",
  1295. trackId,
  1296. "amount",
  1297. amount,
  1298. "time",
  1299. time
  1300. }));
  1301. }
  1302. public static void PunchRotation(GameObject target, Hashtable args)
  1303. {
  1304. args = AMTween.CleanArgs(args);
  1305. args["type"] = "punch";
  1306. args["method"] = "rotation";
  1307. args["easetype"] = AMTween.EaseType.punch;
  1308. AMTween.Launch(target, args);
  1309. }
  1310. public static void PunchScale(GameObject target, Vector3 amount, float time, string trackId)
  1311. {
  1312. AMTween.PunchScale(target, AMTween.Hash(new object[]
  1313. {
  1314. "trackid",
  1315. trackId,
  1316. "amount",
  1317. amount,
  1318. "time",
  1319. time
  1320. }));
  1321. }
  1322. public static void PunchScale(GameObject target, Hashtable args)
  1323. {
  1324. args = AMTween.CleanArgs(args);
  1325. args["type"] = "punch";
  1326. args["method"] = "scale";
  1327. args["easetype"] = AMTween.EaseType.punch;
  1328. AMTween.Launch(target, args);
  1329. }
  1330. private void GenerateTargets()
  1331. {
  1332. string text = this.type;
  1333. switch (text)
  1334. {
  1335. case "value":
  1336. {
  1337. string text2 = this.method;
  1338. if (text2 != null)
  1339. {
  1340. if (!(text2 == "float"))
  1341. {
  1342. if (!(text2 == "vector2"))
  1343. {
  1344. if (!(text2 == "vector3"))
  1345. {
  1346. if (!(text2 == "color"))
  1347. {
  1348. if (text2 == "rect")
  1349. {
  1350. this.GenerateRectTargets();
  1351. this.apply = new AMTween.ApplyTween(this.ApplyRectTargets);
  1352. }
  1353. }
  1354. else
  1355. {
  1356. this.GenerateColorTargets();
  1357. this.apply = new AMTween.ApplyTween(this.ApplyColorTargets);
  1358. }
  1359. }
  1360. else
  1361. {
  1362. this.GenerateVector3Targets();
  1363. this.apply = new AMTween.ApplyTween(this.ApplyVector3Targets);
  1364. }
  1365. }
  1366. else
  1367. {
  1368. this.GenerateVector2Targets();
  1369. this.apply = new AMTween.ApplyTween(this.ApplyVector2Targets);
  1370. }
  1371. }
  1372. else
  1373. {
  1374. this.GenerateFloatTargets();
  1375. this.apply = new AMTween.ApplyTween(this.ApplyFloatTargets);
  1376. }
  1377. }
  1378. break;
  1379. }
  1380. case "property":
  1381. {
  1382. string text3 = this.method;
  1383. if (text3 != null)
  1384. {
  1385. if (!(text3 == "morph"))
  1386. {
  1387. if (!(text3 == "float"))
  1388. {
  1389. if (!(text3 == "vector2"))
  1390. {
  1391. if (!(text3 == "vector3"))
  1392. {
  1393. if (!(text3 == "color"))
  1394. {
  1395. if (text3 == "rect")
  1396. {
  1397. this.GenerateRectTargets();
  1398. this.apply = new AMTween.ApplyTween(this.ApplyPropertyRectTargets);
  1399. }
  1400. }
  1401. else
  1402. {
  1403. this.GenerateColorTargets();
  1404. this.apply = new AMTween.ApplyTween(this.ApplyPropertyColorTargets);
  1405. }
  1406. }
  1407. else
  1408. {
  1409. this.GenerateVector3Targets();
  1410. this.apply = new AMTween.ApplyTween(this.ApplyPropertyVector3Targets);
  1411. }
  1412. }
  1413. else
  1414. {
  1415. this.GenerateVector2Targets();
  1416. this.apply = new AMTween.ApplyTween(this.ApplyPropertyVector2Targets);
  1417. }
  1418. }
  1419. else
  1420. {
  1421. this.GenerateFloatTargets();
  1422. this.apply = new AMTween.ApplyTween(this.ApplyPropertyFloatTargets);
  1423. }
  1424. }
  1425. else
  1426. {
  1427. this.GenerateMorphTargets();
  1428. this.apply = new AMTween.ApplyTween(this.ApplyPropertyMorphTargets);
  1429. }
  1430. }
  1431. break;
  1432. }
  1433. case "color":
  1434. {
  1435. string text4 = this.method;
  1436. if (text4 != null)
  1437. {
  1438. if (text4 == "to")
  1439. {
  1440. this.GenerateColorToTargets();
  1441. this.apply = new AMTween.ApplyTween(this.ApplyColorToTargets);
  1442. }
  1443. }
  1444. break;
  1445. }
  1446. case "audio":
  1447. {
  1448. string text5 = this.method;
  1449. if (text5 != null)
  1450. {
  1451. if (text5 == "to")
  1452. {
  1453. this.GenerateAudioToTargets();
  1454. this.apply = new AMTween.ApplyTween(this.ApplyAudioToTargets);
  1455. }
  1456. }
  1457. break;
  1458. }
  1459. case "move":
  1460. {
  1461. string text6 = this.method;
  1462. if (text6 != null)
  1463. {
  1464. if (!(text6 == "to"))
  1465. {
  1466. if (text6 == "by" || text6 == "add")
  1467. {
  1468. this.GenerateMoveByTargets();
  1469. this.apply = new AMTween.ApplyTween(this.ApplyMoveByTargets);
  1470. }
  1471. }
  1472. else if (this.tweenArguments.Contains("path"))
  1473. {
  1474. this.GenerateMoveToPathTargets();
  1475. this.apply = new AMTween.ApplyTween(this.ApplyMoveToPathTargets);
  1476. }
  1477. else
  1478. {
  1479. this.GenerateMoveToTargets();
  1480. this.apply = new AMTween.ApplyTween(this.ApplyMoveToTargets);
  1481. }
  1482. }
  1483. break;
  1484. }
  1485. case "scale":
  1486. {
  1487. string text7 = this.method;
  1488. if (text7 != null)
  1489. {
  1490. if (!(text7 == "to"))
  1491. {
  1492. if (!(text7 == "by"))
  1493. {
  1494. if (text7 == "add")
  1495. {
  1496. this.GenerateScaleAddTargets();
  1497. this.apply = new AMTween.ApplyTween(this.ApplyScaleToTargets);
  1498. }
  1499. }
  1500. else
  1501. {
  1502. this.GenerateScaleByTargets();
  1503. this.apply = new AMTween.ApplyTween(this.ApplyScaleToTargets);
  1504. }
  1505. }
  1506. else
  1507. {
  1508. this.GenerateScaleToTargets();
  1509. this.apply = new AMTween.ApplyTween(this.ApplyScaleToTargets);
  1510. }
  1511. }
  1512. break;
  1513. }
  1514. case "rotate":
  1515. {
  1516. string text8 = this.method;
  1517. if (text8 != null)
  1518. {
  1519. if (!(text8 == "to"))
  1520. {
  1521. if (!(text8 == "add"))
  1522. {
  1523. if (text8 == "by")
  1524. {
  1525. this.GenerateRotateByTargets();
  1526. this.apply = new AMTween.ApplyTween(this.ApplyRotateAddTargets);
  1527. }
  1528. }
  1529. else
  1530. {
  1531. this.GenerateRotateAddTargets();
  1532. this.apply = new AMTween.ApplyTween(this.ApplyRotateAddTargets);
  1533. }
  1534. }
  1535. else
  1536. {
  1537. this.GenerateRotateToTargets();
  1538. this.apply = new AMTween.ApplyTween(this.ApplyRotateToTargets);
  1539. }
  1540. }
  1541. break;
  1542. }
  1543. case "shake":
  1544. {
  1545. string text9 = this.method;
  1546. if (text9 != null)
  1547. {
  1548. if (!(text9 == "position"))
  1549. {
  1550. if (!(text9 == "scale"))
  1551. {
  1552. if (text9 == "rotation")
  1553. {
  1554. this.GenerateShakeRotationTargets();
  1555. this.apply = new AMTween.ApplyTween(this.ApplyShakeRotationTargets);
  1556. }
  1557. }
  1558. else
  1559. {
  1560. this.GenerateShakeScaleTargets();
  1561. this.apply = new AMTween.ApplyTween(this.ApplyShakeScaleTargets);
  1562. }
  1563. }
  1564. else
  1565. {
  1566. this.GenerateShakePositionTargets();
  1567. this.apply = new AMTween.ApplyTween(this.ApplyShakePositionTargets);
  1568. }
  1569. }
  1570. break;
  1571. }
  1572. case "punch":
  1573. {
  1574. string text10 = this.method;
  1575. if (text10 != null)
  1576. {
  1577. if (!(text10 == "position"))
  1578. {
  1579. if (!(text10 == "rotation"))
  1580. {
  1581. if (text10 == "scale")
  1582. {
  1583. this.GeneratePunchScaleTargets();
  1584. this.apply = new AMTween.ApplyTween(this.ApplyPunchScaleTargets);
  1585. }
  1586. }
  1587. else
  1588. {
  1589. this.GeneratePunchRotationTargets();
  1590. this.apply = new AMTween.ApplyTween(this.ApplyPunchRotationTargets);
  1591. }
  1592. }
  1593. else
  1594. {
  1595. this.GeneratePunchPositionTargets();
  1596. this.apply = new AMTween.ApplyTween(this.ApplyPunchPositionTargets);
  1597. }
  1598. }
  1599. break;
  1600. }
  1601. case "look":
  1602. {
  1603. string text11 = this.method;
  1604. if (text11 != null)
  1605. {
  1606. if (!(text11 == "to"))
  1607. {
  1608. if (!(text11 == "follow"))
  1609. {
  1610. if (text11 == "tofollow")
  1611. {
  1612. this.GenerateLookToFollowTargets();
  1613. this.apply = new AMTween.ApplyTween(this.ApplyLookToFollowTargets);
  1614. }
  1615. }
  1616. else
  1617. {
  1618. this.apply = new AMTween.ApplyTween(this.ApplyLookFollowTargets);
  1619. }
  1620. }
  1621. else
  1622. {
  1623. this.GenerateLookToTargets();
  1624. this.apply = new AMTween.ApplyTween(this.ApplyLookToTargets);
  1625. }
  1626. }
  1627. break;
  1628. }
  1629. case "stab":
  1630. this.GenerateStabTargets();
  1631. this.apply = new AMTween.ApplyTween(this.ApplyStabTargets);
  1632. break;
  1633. case "play":
  1634. {
  1635. string text12 = this.method;
  1636. if (text12 != null)
  1637. {
  1638. if (!(text12 == "audio"))
  1639. {
  1640. if (text12 == "animation")
  1641. {
  1642. this.GeneratePlayAnimationTargets();
  1643. }
  1644. }
  1645. else
  1646. {
  1647. this.GeneratePlayAudioTargets();
  1648. }
  1649. }
  1650. break;
  1651. }
  1652. case "camerafade":
  1653. if ((int)this.tweenArguments["camerafadetype"] == 5)
  1654. {
  1655. this.GenerateCameraFadeNoneTargets();
  1656. }
  1657. else
  1658. {
  1659. this.GenerateCameraFadeTargets();
  1660. this.apply = new AMTween.ApplyTween(this.ApplyCameraFadeValueTargets);
  1661. }
  1662. break;
  1663. }
  1664. }
  1665. private void GenerateCameraFadeNoneTargets()
  1666. {
  1667. if (this.tweenArguments.Contains("camera2"))
  1668. {
  1669. AMTween.SetTopCamera((Camera)this.tweenArguments["camera2"], (Camera[])this.tweenArguments["allcameras"]);
  1670. }
  1671. else if (this.tweenArguments.Contains("color2"))
  1672. {
  1673. AMTween.ShowColor((Color)this.tweenArguments["color2"]);
  1674. }
  1675. this.Dispose();
  1676. }
  1677. private void GenerateCameraFadeTargets()
  1678. {
  1679. if (AMTween.cf.keepAliveColor)
  1680. {
  1681. AMTween.cf.keepAliveColor = false;
  1682. }
  1683. AMTween.cf.isReset = false;
  1684. bool flag = (bool)this.tweenArguments["reversed"];
  1685. Camera camera = null;
  1686. Camera camera2 = null;
  1687. Color? color = null;
  1688. Color? color2 = null;
  1689. if (!flag)
  1690. {
  1691. if (this.tweenArguments.Contains("camera1"))
  1692. {
  1693. camera = (Camera)this.tweenArguments["camera1"];
  1694. }
  1695. else if (this.tweenArguments.Contains("color1"))
  1696. {
  1697. color = new Color?((Color)this.tweenArguments["color1"]);
  1698. }
  1699. if (this.tweenArguments.Contains("camera2"))
  1700. {
  1701. camera2 = (Camera)this.tweenArguments["camera2"];
  1702. }
  1703. else if (this.tweenArguments.Contains("color2"))
  1704. {
  1705. color2 = new Color?((Color)this.tweenArguments["color2"]);
  1706. }
  1707. }
  1708. else
  1709. {
  1710. if (this.tweenArguments.Contains("camera2"))
  1711. {
  1712. camera = (Camera)this.tweenArguments["camera2"];
  1713. }
  1714. else if (this.tweenArguments.Contains("color2"))
  1715. {
  1716. color = new Color?((Color)this.tweenArguments["color2"]);
  1717. }
  1718. if (this.tweenArguments.Contains("camera1"))
  1719. {
  1720. camera2 = (Camera)this.tweenArguments["camera1"];
  1721. }
  1722. else if (this.tweenArguments.Contains("color1"))
  1723. {
  1724. color2 = new Color?((Color)this.tweenArguments["color1"]);
  1725. }
  1726. }
  1727. if (camera)
  1728. {
  1729. if ((bool)this.tweenArguments["userendertex"])
  1730. {
  1731. AMTween.cf.setupRenderTexture(camera);
  1732. }
  1733. else
  1734. {
  1735. AMTween.SetTopCamera(camera, (Camera[])this.tweenArguments["allcameras"]);
  1736. camera.Render();
  1737. AMTween.cf.clearTexture2D();
  1738. AMTween.cf.tex2d = AMTween.GetScreenTexture();
  1739. AMTween.cf.useRenderTexture = false;
  1740. AMTween.cf.hasColorTex = false;
  1741. }
  1742. }
  1743. else
  1744. {
  1745. AMTween.cf.colorTex = color.Value;
  1746. AMTween.cf.hasColorTex = true;
  1747. }
  1748. if (camera2)
  1749. {
  1750. AMTween.SetTopCamera(camera2, (Camera[])this.tweenArguments["allcameras"]);
  1751. AMTween.cf.hasColorBG = false;
  1752. }
  1753. else
  1754. {
  1755. AMTween.cf.colorBG = color2.Value;
  1756. AMTween.cf.hasColorBG = true;
  1757. }
  1758. if (this.tweenArguments.Contains("texture"))
  1759. {
  1760. AMTween.cf.irisShape = (Texture2D)this.tweenArguments["texture"];
  1761. }
  1762. AMTween.cf.mode = (int)this.tweenArguments["camerafadetype"];
  1763. AMTween.cf.setupMaterials();
  1764. AMTween.cf.r = (float[])this.tweenArguments["parameters"];
  1765. AMTween.cf.value = 1f;
  1766. AMTween.cf.percent = 0f;
  1767. }
  1768. private void GeneratePlayAnimationTargets()
  1769. {
  1770. if ((WrapMode)this.tweenArguments["wrapmode"] != WrapMode.Once)
  1771. {
  1772. this.time = float.PositiveInfinity;
  1773. }
  1774. else
  1775. {
  1776. this.time = (this.tweenArguments["target"] as GameObject).GetComponent<Animation>().GetClip((string)this.tweenArguments["animation"]).length;
  1777. }
  1778. }
  1779. private void GeneratePlayAudioTargets()
  1780. {
  1781. if ((bool)this.tweenArguments["loop"])
  1782. {
  1783. this.time = float.PositiveInfinity;
  1784. }
  1785. else
  1786. {
  1787. this.time = (this.tweenArguments["audioclip"] as AudioClip).length - this.runningTime;
  1788. }
  1789. }
  1790. private void GenerateMorphTargets()
  1791. {
  1792. this.startMorphs = (float[])this.tweenArguments["from"];
  1793. this.endMorphs = (float[])this.tweenArguments["to"];
  1794. this.currentMorphs = new float[this.startMorphs.Length];
  1795. for (int i = 0; i < this.startMorphs.Length; i++)
  1796. {
  1797. this.currentMorphs[i] = this.startMorphs[i];
  1798. }
  1799. if (this.tweenArguments.Contains("speed"))
  1800. {
  1801. float num = Math.Abs(this.floats[0] - this.floats[1]);
  1802. this.time = num / (float)this.tweenArguments["speed"];
  1803. }
  1804. }
  1805. private void GenerateRectTargets()
  1806. {
  1807. this.rects = new Rect[3];
  1808. this.rects[0] = (Rect)this.tweenArguments["from"];
  1809. this.rects[1] = (Rect)this.tweenArguments["to"];
  1810. }
  1811. private void GenerateColorTargets()
  1812. {
  1813. this.colors = new Color[1, 3];
  1814. this.colors[0, 0] = (Color)this.tweenArguments["from"];
  1815. this.colors[0, 1] = (Color)this.tweenArguments["to"];
  1816. }
  1817. private void GenerateVector3Targets()
  1818. {
  1819. this.vector3s = new Vector3[3];
  1820. this.vector3s[0] = (Vector3)this.tweenArguments["from"];
  1821. this.vector3s[1] = (Vector3)this.tweenArguments["to"];
  1822. if (this.tweenArguments.Contains("speed"))
  1823. {
  1824. float num = Math.Abs(Vector3.Distance(this.vector3s[0], this.vector3s[1]));
  1825. this.time = num / (float)this.tweenArguments["speed"];
  1826. }
  1827. }
  1828. private void GenerateVector2Targets()
  1829. {
  1830. this.vector2s = new Vector2[3];
  1831. this.vector2s[0] = (Vector2)this.tweenArguments["from"];
  1832. this.vector2s[1] = (Vector2)this.tweenArguments["to"];
  1833. if (this.tweenArguments.Contains("speed"))
  1834. {
  1835. Vector3 a = new Vector3(this.vector2s[0].x, this.vector2s[0].y, 0f);
  1836. Vector3 b = new Vector3(this.vector2s[1].x, this.vector2s[1].y, 0f);
  1837. float num = Math.Abs(Vector3.Distance(a, b));
  1838. this.time = num / (float)this.tweenArguments["speed"];
  1839. }
  1840. }
  1841. private void GenerateFloatTargets()
  1842. {
  1843. this.floats = new float[3];
  1844. this.floats[0] = (float)this.tweenArguments["from"];
  1845. this.floats[1] = (float)this.tweenArguments["to"];
  1846. if (this.tweenArguments.Contains("speed"))
  1847. {
  1848. float num = Math.Abs(this.floats[0] - this.floats[1]);
  1849. this.time = num / (float)this.tweenArguments["speed"];
  1850. }
  1851. }
  1852. private void GenerateColorToTargets()
  1853. {
  1854. if (base.GetComponent(typeof(GUITexture)))
  1855. {
  1856. this.colors = new Color[1, 3];
  1857. this.colors[0, 0] = (this.colors[0, 1] = base.GetComponent<GUITexture>().color);
  1858. }
  1859. else if (base.GetComponent(typeof(GUIText)))
  1860. {
  1861. this.colors = new Color[1, 3];
  1862. this.colors[0, 0] = (this.colors[0, 1] = base.GetComponent<GUIText>().material.color);
  1863. }
  1864. else if (base.GetComponent<Renderer>())
  1865. {
  1866. Renderer component = base.GetComponent<Renderer>();
  1867. this.colors = new Color[component.materials.Length, 3];
  1868. for (int i = 0; i < component.materials.Length; i++)
  1869. {
  1870. this.colors[i, 0] = component.materials[i].GetColor(this.namedcolorvalue.ToString());
  1871. this.colors[i, 1] = component.materials[i].GetColor(this.namedcolorvalue.ToString());
  1872. }
  1873. }
  1874. else if (base.GetComponent<Light>())
  1875. {
  1876. this.colors = new Color[1, 3];
  1877. this.colors[0, 0] = (this.colors[0, 1] = base.GetComponent<Light>().color);
  1878. }
  1879. else
  1880. {
  1881. this.colors = new Color[1, 3];
  1882. }
  1883. if (this.tweenArguments.Contains("color"))
  1884. {
  1885. for (int j = 0; j < this.colors.GetLength(0); j++)
  1886. {
  1887. this.colors[j, 1] = (Color)this.tweenArguments["color"];
  1888. }
  1889. }
  1890. else
  1891. {
  1892. if (this.tweenArguments.Contains("r"))
  1893. {
  1894. for (int k = 0; k < this.colors.GetLength(0); k++)
  1895. {
  1896. this.colors[k, 1].r = (float)this.tweenArguments["r"];
  1897. }
  1898. }
  1899. if (this.tweenArguments.Contains("g"))
  1900. {
  1901. for (int l = 0; l < this.colors.GetLength(0); l++)
  1902. {
  1903. this.colors[l, 1].g = (float)this.tweenArguments["g"];
  1904. }
  1905. }
  1906. if (this.tweenArguments.Contains("b"))
  1907. {
  1908. for (int m = 0; m < this.colors.GetLength(0); m++)
  1909. {
  1910. this.colors[m, 1].b = (float)this.tweenArguments["b"];
  1911. }
  1912. }
  1913. if (this.tweenArguments.Contains("a"))
  1914. {
  1915. for (int n = 0; n < this.colors.GetLength(0); n++)
  1916. {
  1917. this.colors[n, 1].a = (float)this.tweenArguments["a"];
  1918. }
  1919. }
  1920. }
  1921. if (this.tweenArguments.Contains("amount"))
  1922. {
  1923. for (int num = 0; num < this.colors.GetLength(0); num++)
  1924. {
  1925. this.colors[num, 1].a = (float)this.tweenArguments["amount"];
  1926. }
  1927. }
  1928. else if (this.tweenArguments.Contains("alpha"))
  1929. {
  1930. for (int num2 = 0; num2 < this.colors.GetLength(0); num2++)
  1931. {
  1932. this.colors[num2, 1].a = (float)this.tweenArguments["alpha"];
  1933. }
  1934. }
  1935. }
  1936. private void GenerateAudioToTargets()
  1937. {
  1938. this.vector2s = new Vector2[3];
  1939. if (this.tweenArguments.Contains("audiosource"))
  1940. {
  1941. this.audioSource = (AudioSource)this.tweenArguments["audiosource"];
  1942. }
  1943. else if (base.GetComponent(typeof(AudioSource)))
  1944. {
  1945. this.audioSource = base.GetComponent<AudioSource>();
  1946. }
  1947. else
  1948. {
  1949. Debug.LogError("AMTween Error: AudioTo requires an AudioSource.");
  1950. this.Dispose();
  1951. }
  1952. this.vector2s[0] = (this.vector2s[1] = new Vector2(this.audioSource.volume, this.audioSource.pitch));
  1953. if (this.tweenArguments.Contains("volume"))
  1954. {
  1955. this.vector2s[1].x = (float)this.tweenArguments["volume"];
  1956. }
  1957. if (this.tweenArguments.Contains("pitch"))
  1958. {
  1959. this.vector2s[1].y = (float)this.tweenArguments["pitch"];
  1960. }
  1961. }
  1962. private void GenerateStabTargets()
  1963. {
  1964. if (this.tweenArguments.Contains("audiosource"))
  1965. {
  1966. this.audioSource = (AudioSource)this.tweenArguments["audiosource"];
  1967. }
  1968. else if (base.GetComponent(typeof(AudioSource)))
  1969. {
  1970. this.audioSource = base.GetComponent<AudioSource>();
  1971. }
  1972. else
  1973. {
  1974. base.gameObject.AddComponent(typeof(AudioSource));
  1975. this.audioSource = base.GetComponent<AudioSource>();
  1976. this.audioSource.playOnAwake = false;
  1977. }
  1978. this.audioSource.clip = (AudioClip)this.tweenArguments["audioclip"];
  1979. if (this.tweenArguments.Contains("pitch"))
  1980. {
  1981. this.audioSource.pitch = (float)this.tweenArguments["pitch"];
  1982. }
  1983. if (this.tweenArguments.Contains("volume"))
  1984. {
  1985. this.audioSource.volume = (float)this.tweenArguments["volume"];
  1986. }
  1987. this.time = this.audioSource.clip.length / this.audioSource.pitch;
  1988. }
  1989. private void GenerateLookToFollowTargets()
  1990. {
  1991. this.vector3s = new Vector3[3];
  1992. this.vector3s[0] = base.transform.eulerAngles;
  1993. if (!this.tweenArguments.Contains("looktarget") && !this.tweenArguments.Contains("targetrotation"))
  1994. {
  1995. Debug.LogError("AMTween Error: LookTo needs a 'looktarget' pr 'targetrotation' property!");
  1996. this.Dispose();
  1997. }
  1998. }
  1999. private void GenerateLookToTargets()
  2000. {
  2001. this.vector3s = new Vector3[3];
  2002. this.vector3s[0] = base.transform.eulerAngles;
  2003. if (this.tweenArguments.Contains("looktarget"))
  2004. {
  2005. if (this.tweenArguments["looktarget"].GetType() == typeof(Transform))
  2006. {
  2007. Transform transform = base.transform;
  2008. Transform target = (Transform)this.tweenArguments["looktarget"];
  2009. Vector3? vector = (Vector3?)this.tweenArguments["up"];
  2010. transform.LookAt(target, (vector == null) ? AMTween.Defaults.up : vector.Value);
  2011. }
  2012. else if (this.tweenArguments["looktarget"].GetType() == typeof(Vector3))
  2013. {
  2014. Transform transform2 = base.transform;
  2015. Vector3 worldPosition = (Vector3)this.tweenArguments["looktarget"];
  2016. Vector3? vector2 = (Vector3?)this.tweenArguments["up"];
  2017. transform2.LookAt(worldPosition, (vector2 == null) ? AMTween.Defaults.up : vector2.Value);
  2018. }
  2019. }
  2020. else
  2021. {
  2022. Debug.LogError("AMTween Error: LookTo needs a 'looktarget' property!");
  2023. this.Dispose();
  2024. }
  2025. this.vector3s[1] = base.transform.eulerAngles;
  2026. base.transform.eulerAngles = this.vector3s[0];
  2027. if (this.tweenArguments.Contains("axis"))
  2028. {
  2029. string text = (string)this.tweenArguments["axis"];
  2030. if (text != null)
  2031. {
  2032. if (!(text == "x"))
  2033. {
  2034. if (!(text == "y"))
  2035. {
  2036. if (text == "z")
  2037. {
  2038. this.vector3s[1].x = this.vector3s[0].x;
  2039. this.vector3s[1].y = this.vector3s[0].y;
  2040. }
  2041. }
  2042. else
  2043. {
  2044. this.vector3s[1].x = this.vector3s[0].x;
  2045. this.vector3s[1].z = this.vector3s[0].z;
  2046. }
  2047. }
  2048. else
  2049. {
  2050. this.vector3s[1].y = this.vector3s[0].y;
  2051. this.vector3s[1].z = this.vector3s[0].z;
  2052. }
  2053. }
  2054. }
  2055. this.vector3s[1] = new Vector3(AMTween.clerp(this.vector3s[0].x, this.vector3s[1].x, 1f), AMTween.clerp(this.vector3s[0].y, this.vector3s[1].y, 1f), AMTween.clerp(this.vector3s[0].z, this.vector3s[1].z, 1f));
  2056. if (this.tweenArguments.Contains("speed"))
  2057. {
  2058. float num = Math.Abs(Vector3.Distance(this.vector3s[0], this.vector3s[1]));
  2059. this.time = num / (float)this.tweenArguments["speed"];
  2060. }
  2061. }
  2062. private void GenerateMoveToPathTargets()
  2063. {
  2064. Vector3[] array2;
  2065. if (this.tweenArguments["path"].GetType() == typeof(Vector3[]))
  2066. {
  2067. Vector3[] array = (Vector3[])this.tweenArguments["path"];
  2068. if (array.Length == 1)
  2069. {
  2070. Debug.LogError("AMTween Error: Attempting a path movement with MoveTo requires an array of more than 1 entry!");
  2071. this.Dispose();
  2072. }
  2073. array2 = new Vector3[array.Length];
  2074. Array.Copy(array, array2, array.Length);
  2075. }
  2076. else
  2077. {
  2078. Transform[] array3 = (Transform[])this.tweenArguments["path"];
  2079. if (array3.Length == 1)
  2080. {
  2081. Debug.LogError("AMTween Error: Attempting a path movement with MoveTo requires an array of more than 1 entry!");
  2082. this.Dispose();
  2083. }
  2084. array2 = new Vector3[array3.Length];
  2085. for (int i = 0; i < array3.Length; i++)
  2086. {
  2087. array2[i] = array3[i].position;
  2088. }
  2089. }
  2090. bool flag;
  2091. int num;
  2092. if (base.transform.position != array2[0])
  2093. {
  2094. if (!this.tweenArguments.Contains("movetopath") || (bool)this.tweenArguments["movetopath"])
  2095. {
  2096. flag = true;
  2097. num = 3;
  2098. }
  2099. else
  2100. {
  2101. flag = false;
  2102. num = 2;
  2103. }
  2104. }
  2105. else
  2106. {
  2107. flag = false;
  2108. num = 2;
  2109. }
  2110. this.vector3s = new Vector3[array2.Length + num];
  2111. if (flag)
  2112. {
  2113. this.vector3s[1] = base.transform.position;
  2114. num = 2;
  2115. }
  2116. else
  2117. {
  2118. num = 1;
  2119. }
  2120. Array.Copy(array2, 0, this.vector3s, num, array2.Length);
  2121. this.vector3s[0] = this.vector3s[1] + (this.vector3s[1] - this.vector3s[2]);
  2122. this.vector3s[this.vector3s.Length - 1] = this.vector3s[this.vector3s.Length - 2] + (this.vector3s[this.vector3s.Length - 2] - this.vector3s[this.vector3s.Length - 3]);
  2123. if (this.vector3s[1] == this.vector3s[this.vector3s.Length - 2])
  2124. {
  2125. Vector3[] array4 = new Vector3[this.vector3s.Length];
  2126. Array.Copy(this.vector3s, array4, this.vector3s.Length);
  2127. array4[0] = array4[array4.Length - 3];
  2128. array4[array4.Length - 1] = array4[2];
  2129. this.vector3s = new Vector3[array4.Length];
  2130. Array.Copy(array4, this.vector3s, array4.Length);
  2131. }
  2132. this.path = new AMTween.CRSpline(this.vector3s);
  2133. if (this.tweenArguments.Contains("speed"))
  2134. {
  2135. float num2 = AMTween.PathLength(this.vector3s);
  2136. this.time = num2 / (float)this.tweenArguments["speed"];
  2137. }
  2138. }
  2139. private void GenerateMoveToTargets()
  2140. {
  2141. this.vector3s = new Vector3[3];
  2142. if (this.isLocal)
  2143. {
  2144. this.vector3s[0] = (this.vector3s[1] = base.transform.localPosition);
  2145. }
  2146. else
  2147. {
  2148. this.vector3s[0] = (this.vector3s[1] = base.transform.position);
  2149. }
  2150. if (this.tweenArguments.Contains("position"))
  2151. {
  2152. if (this.tweenArguments["position"].GetType() == typeof(Transform))
  2153. {
  2154. Transform transform = (Transform)this.tweenArguments["position"];
  2155. this.vector3s[1] = transform.position;
  2156. }
  2157. else if (this.tweenArguments["position"].GetType() == typeof(Vector3))
  2158. {
  2159. this.vector3s[1] = (Vector3)this.tweenArguments["position"];
  2160. }
  2161. }
  2162. else
  2163. {
  2164. if (this.tweenArguments.Contains("x"))
  2165. {
  2166. this.vector3s[1].x = (float)this.tweenArguments["x"];
  2167. }
  2168. if (this.tweenArguments.Contains("y"))
  2169. {
  2170. this.vector3s[1].y = (float)this.tweenArguments["y"];
  2171. }
  2172. if (this.tweenArguments.Contains("z"))
  2173. {
  2174. this.vector3s[1].z = (float)this.tweenArguments["z"];
  2175. }
  2176. }
  2177. if (this.tweenArguments.Contains("orienttopath") && (bool)this.tweenArguments["orienttopath"])
  2178. {
  2179. this.tweenArguments["looktarget"] = this.vector3s[1];
  2180. }
  2181. if (this.tweenArguments.Contains("speed"))
  2182. {
  2183. float num = Math.Abs(Vector3.Distance(this.vector3s[0], this.vector3s[1]));
  2184. this.time = num / (float)this.tweenArguments["speed"];
  2185. }
  2186. }
  2187. private void GenerateMoveByTargets()
  2188. {
  2189. this.vector3s = new Vector3[6];
  2190. this.vector3s[4] = base.transform.eulerAngles;
  2191. this.vector3s[0] = (this.vector3s[1] = (this.vector3s[3] = base.transform.position));
  2192. if (this.tweenArguments.Contains("amount"))
  2193. {
  2194. this.vector3s[1] = this.vector3s[0] + (Vector3)this.tweenArguments["amount"];
  2195. }
  2196. else
  2197. {
  2198. if (this.tweenArguments.Contains("x"))
  2199. {
  2200. this.vector3s[1].x = this.vector3s[0].x + (float)this.tweenArguments["x"];
  2201. }
  2202. if (this.tweenArguments.Contains("y"))
  2203. {
  2204. this.vector3s[1].y = this.vector3s[0].y + (float)this.tweenArguments["y"];
  2205. }
  2206. if (this.tweenArguments.Contains("z"))
  2207. {
  2208. this.vector3s[1].z = this.vector3s[0].z + (float)this.tweenArguments["z"];
  2209. }
  2210. }
  2211. base.transform.Translate(this.vector3s[1], this.space);
  2212. this.vector3s[5] = base.transform.position;
  2213. base.transform.position = this.vector3s[0];
  2214. if (this.tweenArguments.Contains("orienttopath") && (bool)this.tweenArguments["orienttopath"])
  2215. {
  2216. this.tweenArguments["looktarget"] = this.vector3s[1];
  2217. }
  2218. if (this.tweenArguments.Contains("speed"))
  2219. {
  2220. float num = Math.Abs(Vector3.Distance(this.vector3s[0], this.vector3s[1]));
  2221. this.time = num / (float)this.tweenArguments["speed"];
  2222. }
  2223. }
  2224. private void GenerateScaleToTargets()
  2225. {
  2226. this.vector3s = new Vector3[3];
  2227. this.vector3s[0] = (this.vector3s[1] = base.transform.localScale);
  2228. if (this.tweenArguments.Contains("scale"))
  2229. {
  2230. if (this.tweenArguments["scale"].GetType() == typeof(Transform))
  2231. {
  2232. Transform transform = (Transform)this.tweenArguments["scale"];
  2233. this.vector3s[1] = transform.localScale;
  2234. }
  2235. else if (this.tweenArguments["scale"].GetType() == typeof(Vector3))
  2236. {
  2237. this.vector3s[1] = (Vector3)this.tweenArguments["scale"];
  2238. }
  2239. }
  2240. else
  2241. {
  2242. if (this.tweenArguments.Contains("x"))
  2243. {
  2244. this.vector3s[1].x = (float)this.tweenArguments["x"];
  2245. }
  2246. if (this.tweenArguments.Contains("y"))
  2247. {
  2248. this.vector3s[1].y = (float)this.tweenArguments["y"];
  2249. }
  2250. if (this.tweenArguments.Contains("z"))
  2251. {
  2252. this.vector3s[1].z = (float)this.tweenArguments["z"];
  2253. }
  2254. }
  2255. if (this.tweenArguments.Contains("speed"))
  2256. {
  2257. float num = Math.Abs(Vector3.Distance(this.vector3s[0], this.vector3s[1]));
  2258. this.time = num / (float)this.tweenArguments["speed"];
  2259. }
  2260. }
  2261. private void GenerateScaleByTargets()
  2262. {
  2263. this.vector3s = new Vector3[3];
  2264. this.vector3s[0] = (this.vector3s[1] = base.transform.localScale);
  2265. if (this.tweenArguments.Contains("amount"))
  2266. {
  2267. this.vector3s[1] = Vector3.Scale(this.vector3s[1], (Vector3)this.tweenArguments["amount"]);
  2268. }
  2269. else
  2270. {
  2271. if (this.tweenArguments.Contains("x"))
  2272. {
  2273. Vector3[] array = this.vector3s;
  2274. int num = 1;
  2275. array[num].x = array[num].x * (float)this.tweenArguments["x"];
  2276. }
  2277. if (this.tweenArguments.Contains("y"))
  2278. {
  2279. Vector3[] array2 = this.vector3s;
  2280. int num2 = 1;
  2281. array2[num2].y = array2[num2].y * (float)this.tweenArguments["y"];
  2282. }
  2283. if (this.tweenArguments.Contains("z"))
  2284. {
  2285. Vector3[] array3 = this.vector3s;
  2286. int num3 = 1;
  2287. array3[num3].z = array3[num3].z * (float)this.tweenArguments["z"];
  2288. }
  2289. }
  2290. if (this.tweenArguments.Contains("speed"))
  2291. {
  2292. float num4 = Math.Abs(Vector3.Distance(this.vector3s[0], this.vector3s[1]));
  2293. this.time = num4 / (float)this.tweenArguments["speed"];
  2294. }
  2295. }
  2296. private void GenerateScaleAddTargets()
  2297. {
  2298. this.vector3s = new Vector3[3];
  2299. this.vector3s[0] = (this.vector3s[1] = base.transform.localScale);
  2300. if (this.tweenArguments.Contains("amount"))
  2301. {
  2302. this.vector3s[1] += (Vector3)this.tweenArguments["amount"];
  2303. }
  2304. else
  2305. {
  2306. if (this.tweenArguments.Contains("x"))
  2307. {
  2308. Vector3[] array = this.vector3s;
  2309. int num = 1;
  2310. array[num].x = array[num].x + (float)this.tweenArguments["x"];
  2311. }
  2312. if (this.tweenArguments.Contains("y"))
  2313. {
  2314. Vector3[] array2 = this.vector3s;
  2315. int num2 = 1;
  2316. array2[num2].y = array2[num2].y + (float)this.tweenArguments["y"];
  2317. }
  2318. if (this.tweenArguments.Contains("z"))
  2319. {
  2320. Vector3[] array3 = this.vector3s;
  2321. int num3 = 1;
  2322. array3[num3].z = array3[num3].z + (float)this.tweenArguments["z"];
  2323. }
  2324. }
  2325. if (this.tweenArguments.Contains("speed"))
  2326. {
  2327. float num4 = Math.Abs(Vector3.Distance(this.vector3s[0], this.vector3s[1]));
  2328. this.time = num4 / (float)this.tweenArguments["speed"];
  2329. }
  2330. }
  2331. private void GenerateRotateToTargets()
  2332. {
  2333. this.vector3s = new Vector3[3];
  2334. if (this.isLocal)
  2335. {
  2336. this.vector3s[0] = (this.vector3s[1] = base.transform.localEulerAngles);
  2337. }
  2338. else
  2339. {
  2340. this.vector3s[0] = (this.vector3s[1] = base.transform.eulerAngles);
  2341. }
  2342. if (this.tweenArguments.Contains("rotation"))
  2343. {
  2344. if (this.tweenArguments["rotation"].GetType() == typeof(Transform))
  2345. {
  2346. Transform transform = (Transform)this.tweenArguments["rotation"];
  2347. this.vector3s[1] = transform.eulerAngles;
  2348. }
  2349. else if (this.tweenArguments["rotation"].GetType() == typeof(Vector3))
  2350. {
  2351. this.vector3s[1] = (Vector3)this.tweenArguments["rotation"];
  2352. }
  2353. }
  2354. else
  2355. {
  2356. if (this.tweenArguments.Contains("x"))
  2357. {
  2358. this.vector3s[1].x = (float)this.tweenArguments["x"];
  2359. }
  2360. if (this.tweenArguments.Contains("y"))
  2361. {
  2362. this.vector3s[1].y = (float)this.tweenArguments["y"];
  2363. }
  2364. if (this.tweenArguments.Contains("z"))
  2365. {
  2366. this.vector3s[1].z = (float)this.tweenArguments["z"];
  2367. }
  2368. }
  2369. this.vector3s[1] = new Vector3(AMTween.clerp(this.vector3s[0].x, this.vector3s[1].x, 1f), AMTween.clerp(this.vector3s[0].y, this.vector3s[1].y, 1f), AMTween.clerp(this.vector3s[0].z, this.vector3s[1].z, 1f));
  2370. if (this.tweenArguments.Contains("speed"))
  2371. {
  2372. float num = Math.Abs(Vector3.Distance(this.vector3s[0], this.vector3s[1]));
  2373. this.time = num / (float)this.tweenArguments["speed"];
  2374. }
  2375. }
  2376. private void GenerateRotateAddTargets()
  2377. {
  2378. this.vector3s = new Vector3[5];
  2379. this.vector3s[0] = (this.vector3s[1] = (this.vector3s[3] = base.transform.eulerAngles));
  2380. if (this.tweenArguments.Contains("amount"))
  2381. {
  2382. this.vector3s[1] += (Vector3)this.tweenArguments["amount"];
  2383. }
  2384. else
  2385. {
  2386. if (this.tweenArguments.Contains("x"))
  2387. {
  2388. Vector3[] array = this.vector3s;
  2389. int num = 1;
  2390. array[num].x = array[num].x + (float)this.tweenArguments["x"];
  2391. }
  2392. if (this.tweenArguments.Contains("y"))
  2393. {
  2394. Vector3[] array2 = this.vector3s;
  2395. int num2 = 1;
  2396. array2[num2].y = array2[num2].y + (float)this.tweenArguments["y"];
  2397. }
  2398. if (this.tweenArguments.Contains("z"))
  2399. {
  2400. Vector3[] array3 = this.vector3s;
  2401. int num3 = 1;
  2402. array3[num3].z = array3[num3].z + (float)this.tweenArguments["z"];
  2403. }
  2404. }
  2405. if (this.tweenArguments.Contains("speed"))
  2406. {
  2407. float num4 = Math.Abs(Vector3.Distance(this.vector3s[0], this.vector3s[1]));
  2408. this.time = num4 / (float)this.tweenArguments["speed"];
  2409. }
  2410. }
  2411. private void GenerateRotateByTargets()
  2412. {
  2413. this.vector3s = new Vector3[4];
  2414. this.vector3s[0] = (this.vector3s[1] = (this.vector3s[3] = base.transform.eulerAngles));
  2415. if (this.tweenArguments.Contains("amount"))
  2416. {
  2417. this.vector3s[1] += Vector3.Scale((Vector3)this.tweenArguments["amount"], new Vector3(360f, 360f, 360f));
  2418. }
  2419. else
  2420. {
  2421. if (this.tweenArguments.Contains("x"))
  2422. {
  2423. Vector3[] array = this.vector3s;
  2424. int num = 1;
  2425. array[num].x = array[num].x + 360f * (float)this.tweenArguments["x"];
  2426. }
  2427. if (this.tweenArguments.Contains("y"))
  2428. {
  2429. Vector3[] array2 = this.vector3s;
  2430. int num2 = 1;
  2431. array2[num2].y = array2[num2].y + 360f * (float)this.tweenArguments["y"];
  2432. }
  2433. if (this.tweenArguments.Contains("z"))
  2434. {
  2435. Vector3[] array3 = this.vector3s;
  2436. int num3 = 1;
  2437. array3[num3].z = array3[num3].z + 360f * (float)this.tweenArguments["z"];
  2438. }
  2439. }
  2440. if (this.tweenArguments.Contains("speed"))
  2441. {
  2442. float num4 = Math.Abs(Vector3.Distance(this.vector3s[0], this.vector3s[1]));
  2443. this.time = num4 / (float)this.tweenArguments["speed"];
  2444. }
  2445. }
  2446. private void GenerateShakePositionTargets()
  2447. {
  2448. this.vector3s = new Vector3[4];
  2449. this.vector3s[3] = base.transform.eulerAngles;
  2450. this.vector3s[0] = base.transform.position;
  2451. if (this.tweenArguments.Contains("amount"))
  2452. {
  2453. this.vector3s[1] = (Vector3)this.tweenArguments["amount"];
  2454. }
  2455. else
  2456. {
  2457. if (this.tweenArguments.Contains("x"))
  2458. {
  2459. this.vector3s[1].x = (float)this.tweenArguments["x"];
  2460. }
  2461. if (this.tweenArguments.Contains("y"))
  2462. {
  2463. this.vector3s[1].y = (float)this.tweenArguments["y"];
  2464. }
  2465. if (this.tweenArguments.Contains("z"))
  2466. {
  2467. this.vector3s[1].z = (float)this.tweenArguments["z"];
  2468. }
  2469. }
  2470. }
  2471. private void GenerateShakeScaleTargets()
  2472. {
  2473. this.vector3s = new Vector3[3];
  2474. this.vector3s[0] = base.transform.localScale;
  2475. if (this.tweenArguments.Contains("amount"))
  2476. {
  2477. this.vector3s[1] = (Vector3)this.tweenArguments["amount"];
  2478. }
  2479. else
  2480. {
  2481. if (this.tweenArguments.Contains("x"))
  2482. {
  2483. this.vector3s[1].x = (float)this.tweenArguments["x"];
  2484. }
  2485. if (this.tweenArguments.Contains("y"))
  2486. {
  2487. this.vector3s[1].y = (float)this.tweenArguments["y"];
  2488. }
  2489. if (this.tweenArguments.Contains("z"))
  2490. {
  2491. this.vector3s[1].z = (float)this.tweenArguments["z"];
  2492. }
  2493. }
  2494. }
  2495. private void GenerateShakeRotationTargets()
  2496. {
  2497. this.vector3s = new Vector3[3];
  2498. this.vector3s[0] = base.transform.eulerAngles;
  2499. if (this.tweenArguments.Contains("amount"))
  2500. {
  2501. this.vector3s[1] = (Vector3)this.tweenArguments["amount"];
  2502. }
  2503. else
  2504. {
  2505. if (this.tweenArguments.Contains("x"))
  2506. {
  2507. this.vector3s[1].x = (float)this.tweenArguments["x"];
  2508. }
  2509. if (this.tweenArguments.Contains("y"))
  2510. {
  2511. this.vector3s[1].y = (float)this.tweenArguments["y"];
  2512. }
  2513. if (this.tweenArguments.Contains("z"))
  2514. {
  2515. this.vector3s[1].z = (float)this.tweenArguments["z"];
  2516. }
  2517. }
  2518. }
  2519. private void GeneratePunchPositionTargets()
  2520. {
  2521. this.vector3s = new Vector3[5];
  2522. this.vector3s[4] = base.transform.eulerAngles;
  2523. this.vector3s[0] = base.transform.position;
  2524. this.vector3s[1] = (this.vector3s[3] = Vector3.zero);
  2525. if (this.tweenArguments.Contains("amount"))
  2526. {
  2527. this.vector3s[1] = (Vector3)this.tweenArguments["amount"];
  2528. }
  2529. else
  2530. {
  2531. if (this.tweenArguments.Contains("x"))
  2532. {
  2533. this.vector3s[1].x = (float)this.tweenArguments["x"];
  2534. }
  2535. if (this.tweenArguments.Contains("y"))
  2536. {
  2537. this.vector3s[1].y = (float)this.tweenArguments["y"];
  2538. }
  2539. if (this.tweenArguments.Contains("z"))
  2540. {
  2541. this.vector3s[1].z = (float)this.tweenArguments["z"];
  2542. }
  2543. }
  2544. }
  2545. private void GeneratePunchRotationTargets()
  2546. {
  2547. this.vector3s = new Vector3[4];
  2548. this.vector3s[0] = base.transform.eulerAngles;
  2549. this.vector3s[1] = (this.vector3s[3] = Vector3.zero);
  2550. if (this.tweenArguments.Contains("amount"))
  2551. {
  2552. this.vector3s[1] = (Vector3)this.tweenArguments["amount"];
  2553. }
  2554. else
  2555. {
  2556. if (this.tweenArguments.Contains("x"))
  2557. {
  2558. this.vector3s[1].x = (float)this.tweenArguments["x"];
  2559. }
  2560. if (this.tweenArguments.Contains("y"))
  2561. {
  2562. this.vector3s[1].y = (float)this.tweenArguments["y"];
  2563. }
  2564. if (this.tweenArguments.Contains("z"))
  2565. {
  2566. this.vector3s[1].z = (float)this.tweenArguments["z"];
  2567. }
  2568. }
  2569. }
  2570. private void GeneratePunchScaleTargets()
  2571. {
  2572. this.vector3s = new Vector3[3];
  2573. this.vector3s[0] = base.transform.localScale;
  2574. this.vector3s[1] = Vector3.zero;
  2575. if (this.tweenArguments.Contains("amount"))
  2576. {
  2577. this.vector3s[1] = (Vector3)this.tweenArguments["amount"];
  2578. }
  2579. else
  2580. {
  2581. if (this.tweenArguments.Contains("x"))
  2582. {
  2583. this.vector3s[1].x = (float)this.tweenArguments["x"];
  2584. }
  2585. if (this.tweenArguments.Contains("y"))
  2586. {
  2587. this.vector3s[1].y = (float)this.tweenArguments["y"];
  2588. }
  2589. if (this.tweenArguments.Contains("z"))
  2590. {
  2591. this.vector3s[1].z = (float)this.tweenArguments["z"];
  2592. }
  2593. }
  2594. }
  2595. private void ApplyPropertyMorphTargets()
  2596. {
  2597. float[] array = new float[this.startMorphs.Length];
  2598. for (int i = 0; i < array.Length; i++)
  2599. {
  2600. if (this.endMorphs.Length > i && this.startMorphs[i] != this.endMorphs[i])
  2601. {
  2602. array[i] = this.ease(this.startMorphs[i], this.endMorphs[i], this.percentage, this.easeCurve);
  2603. (this.tweenArguments["methodinfo"] as MethodInfo).Invoke(this.tweenArguments["component"] as Component, new object[]
  2604. {
  2605. i,
  2606. array[i]
  2607. });
  2608. }
  2609. }
  2610. if (this.percentage == 1f)
  2611. {
  2612. this.tweenArguments["onupdateparams"] = this.endMorphs;
  2613. }
  2614. }
  2615. private void ApplyRectTargets()
  2616. {
  2617. this.rects[2].x = this.ease(this.rects[0].x, this.rects[1].x, this.percentage, this.easeCurve);
  2618. this.rects[2].y = this.ease(this.rects[0].y, this.rects[1].y, this.percentage, this.easeCurve);
  2619. this.rects[2].width = this.ease(this.rects[0].width, this.rects[1].width, this.percentage, this.easeCurve);
  2620. this.rects[2].height = this.ease(this.rects[0].height, this.rects[1].height, this.percentage, this.easeCurve);
  2621. this.tweenArguments["onupdateparams"] = this.rects[2];
  2622. if (this.percentage == 1f)
  2623. {
  2624. this.tweenArguments["onupdateparams"] = this.rects[1];
  2625. }
  2626. }
  2627. private void ApplyPropertyRectTargets()
  2628. {
  2629. this.rects[2].x = this.ease(this.rects[0].x, this.rects[1].x, this.percentage, this.easeCurve);
  2630. this.rects[2].y = this.ease(this.rects[0].y, this.rects[1].y, this.percentage, this.easeCurve);
  2631. this.rects[2].width = this.ease(this.rects[0].width, this.rects[1].width, this.percentage, this.easeCurve);
  2632. this.rects[2].height = this.ease(this.rects[0].height, this.rects[1].height, this.percentage, this.easeCurve);
  2633. if (this.tweenArguments["fieldinfo"] != null)
  2634. {
  2635. (this.tweenArguments["fieldinfo"] as FieldInfo).SetValue(this.tweenArguments["component"] as Component, this.rects[2]);
  2636. }
  2637. else if (this.tweenArguments["propertyinfo"] != null)
  2638. {
  2639. (this.tweenArguments["propertyinfo"] as PropertyInfo).SetValue(this.tweenArguments["component"] as Component, this.rects[2], null);
  2640. }
  2641. if (this.percentage == 1f)
  2642. {
  2643. this.tweenArguments["onupdateparams"] = this.rects[1];
  2644. }
  2645. }
  2646. private void ApplyColorTargets()
  2647. {
  2648. this.colors[0, 2].r = this.ease(this.colors[0, 0].r, this.colors[0, 1].r, this.percentage, this.easeCurve);
  2649. this.colors[0, 2].g = this.ease(this.colors[0, 0].g, this.colors[0, 1].g, this.percentage, this.easeCurve);
  2650. this.colors[0, 2].b = this.ease(this.colors[0, 0].b, this.colors[0, 1].b, this.percentage, this.easeCurve);
  2651. this.colors[0, 2].a = this.ease(this.colors[0, 0].a, this.colors[0, 1].a, this.percentage, this.easeCurve);
  2652. this.tweenArguments["onupdateparams"] = this.colors[0, 2];
  2653. if (this.percentage == 1f)
  2654. {
  2655. this.tweenArguments["onupdateparams"] = this.colors[0, 1];
  2656. }
  2657. }
  2658. private void ApplyPropertyColorTargets()
  2659. {
  2660. this.colors[0, 2].r = this.ease(this.colors[0, 0].r, this.colors[0, 1].r, this.percentage, this.easeCurve);
  2661. this.colors[0, 2].g = this.ease(this.colors[0, 0].g, this.colors[0, 1].g, this.percentage, this.easeCurve);
  2662. this.colors[0, 2].b = this.ease(this.colors[0, 0].b, this.colors[0, 1].b, this.percentage, this.easeCurve);
  2663. this.colors[0, 2].a = this.ease(this.colors[0, 0].a, this.colors[0, 1].a, this.percentage, this.easeCurve);
  2664. if (this.tweenArguments["fieldinfo"] != null)
  2665. {
  2666. (this.tweenArguments["fieldinfo"] as FieldInfo).SetValue(this.tweenArguments["component"] as Component, this.colors[0, 2]);
  2667. }
  2668. else if (this.tweenArguments["propertyinfo"] != null)
  2669. {
  2670. (this.tweenArguments["propertyinfo"] as PropertyInfo).SetValue(this.tweenArguments["component"] as Component, this.colors[0, 2], null);
  2671. }
  2672. if (this.percentage == 1f)
  2673. {
  2674. this.tweenArguments["onupdateparams"] = this.colors[0, 1];
  2675. }
  2676. }
  2677. private void ApplyVector3Targets()
  2678. {
  2679. this.vector3s[2].x = this.ease(this.vector3s[0].x, this.vector3s[1].x, this.percentage, this.easeCurve);
  2680. this.vector3s[2].y = this.ease(this.vector3s[0].y, this.vector3s[1].y, this.percentage, this.easeCurve);
  2681. this.vector3s[2].z = this.ease(this.vector3s[0].z, this.vector3s[1].z, this.percentage, this.easeCurve);
  2682. this.tweenArguments["onupdateparams"] = this.vector3s[2];
  2683. if (this.percentage == 1f)
  2684. {
  2685. this.tweenArguments["onupdateparams"] = this.vector3s[1];
  2686. }
  2687. }
  2688. private void ApplyPropertyVector3Targets()
  2689. {
  2690. this.vector3s[2].x = this.ease(this.vector3s[0].x, this.vector3s[1].x, this.percentage, this.easeCurve);
  2691. this.vector3s[2].y = this.ease(this.vector3s[0].y, this.vector3s[1].y, this.percentage, this.easeCurve);
  2692. this.vector3s[2].z = this.ease(this.vector3s[0].z, this.vector3s[1].z, this.percentage, this.easeCurve);
  2693. if (this.tweenArguments["fieldinfo"] != null)
  2694. {
  2695. (this.tweenArguments["fieldinfo"] as FieldInfo).SetValue(this.tweenArguments["component"] as Component, this.vector3s[2]);
  2696. }
  2697. else if (this.tweenArguments["propertyinfo"] != null)
  2698. {
  2699. (this.tweenArguments["propertyinfo"] as PropertyInfo).SetValue(this.tweenArguments["component"] as Component, this.vector3s[2], null);
  2700. }
  2701. if (this.percentage == 1f)
  2702. {
  2703. this.tweenArguments["onupdateparams"] = this.vector3s[1];
  2704. }
  2705. }
  2706. private void ApplyVector2Targets()
  2707. {
  2708. this.vector2s[2].x = this.ease(this.vector2s[0].x, this.vector2s[1].x, this.percentage, this.easeCurve);
  2709. this.vector2s[2].y = this.ease(this.vector2s[0].y, this.vector2s[1].y, this.percentage, this.easeCurve);
  2710. this.tweenArguments["onupdateparams"] = this.vector2s[2];
  2711. if (this.percentage == 1f)
  2712. {
  2713. this.tweenArguments["onupdateparams"] = this.vector2s[1];
  2714. }
  2715. }
  2716. private void ApplyPropertyVector2Targets()
  2717. {
  2718. this.vector2s[2].x = this.ease(this.vector2s[0].x, this.vector2s[1].x, this.percentage, this.easeCurve);
  2719. this.vector2s[2].y = this.ease(this.vector2s[0].y, this.vector2s[1].y, this.percentage, this.easeCurve);
  2720. if (this.tweenArguments["fieldinfo"] != null)
  2721. {
  2722. (this.tweenArguments["fieldinfo"] as FieldInfo).SetValue(this.tweenArguments["component"] as Component, this.vector2s[2]);
  2723. }
  2724. else if (this.tweenArguments["propertyinfo"] != null)
  2725. {
  2726. (this.tweenArguments["propertyinfo"] as PropertyInfo).SetValue(this.tweenArguments["component"] as Component, this.vector2s[2], null);
  2727. }
  2728. if (this.percentage == 1f)
  2729. {
  2730. this.tweenArguments["onupdateparams"] = this.vector2s[1];
  2731. }
  2732. }
  2733. private void ApplyFloatTargets()
  2734. {
  2735. this.floats[2] = this.ease(this.floats[0], this.floats[1], this.percentage, this.easeCurve);
  2736. this.tweenArguments["onupdateparams"] = this.floats[2];
  2737. if (this.percentage == 1f)
  2738. {
  2739. this.tweenArguments["onupdateparams"] = this.floats[1];
  2740. }
  2741. }
  2742. private void ApplyPropertyFloatTargets()
  2743. {
  2744. this.floats[2] = this.ease(this.floats[0], this.floats[1], this.percentage, this.easeCurve);
  2745. if (this.tweenArguments["fieldinfo"] != null)
  2746. {
  2747. if ((this.tweenArguments["fieldinfo"] as FieldInfo).FieldType == typeof(int))
  2748. {
  2749. (this.tweenArguments["fieldinfo"] as FieldInfo).SetValue(this.tweenArguments["component"] as Component, (int)this.floats[2]);
  2750. }
  2751. else
  2752. {
  2753. (this.tweenArguments["fieldinfo"] as FieldInfo).SetValue(this.tweenArguments["component"] as Component, this.floats[2]);
  2754. }
  2755. }
  2756. else if (this.tweenArguments["propertyinfo"] != null)
  2757. {
  2758. if ((this.tweenArguments["propertyinfo"] as PropertyInfo).PropertyType == typeof(int))
  2759. {
  2760. (this.tweenArguments["propertyinfo"] as PropertyInfo).SetValue(this.tweenArguments["component"] as Component, (int)this.floats[2], null);
  2761. }
  2762. else
  2763. {
  2764. (this.tweenArguments["propertyinfo"] as PropertyInfo).SetValue(this.tweenArguments["component"] as Component, this.floats[2], null);
  2765. }
  2766. }
  2767. if (this.percentage == 1f)
  2768. {
  2769. this.tweenArguments["onupdateparams"] = this.floats[1];
  2770. }
  2771. }
  2772. private void ApplyColorToTargets()
  2773. {
  2774. for (int i = 0; i < this.colors.GetLength(0); i++)
  2775. {
  2776. this.colors[i, 2].r = this.ease(this.colors[i, 0].r, this.colors[i, 1].r, this.percentage, this.easeCurve);
  2777. this.colors[i, 2].g = this.ease(this.colors[i, 0].g, this.colors[i, 1].g, this.percentage, this.easeCurve);
  2778. this.colors[i, 2].b = this.ease(this.colors[i, 0].b, this.colors[i, 1].b, this.percentage, this.easeCurve);
  2779. this.colors[i, 2].a = this.ease(this.colors[i, 0].a, this.colors[i, 1].a, this.percentage, this.easeCurve);
  2780. }
  2781. if (base.GetComponent(typeof(GUITexture)))
  2782. {
  2783. base.GetComponent<GUITexture>().color = this.colors[0, 2];
  2784. }
  2785. else if (base.GetComponent(typeof(GUIText)))
  2786. {
  2787. base.GetComponent<GUIText>().material.color = this.colors[0, 2];
  2788. }
  2789. else if (base.GetComponent<Renderer>())
  2790. {
  2791. Renderer component = base.GetComponent<Renderer>();
  2792. for (int j = 0; j < this.colors.GetLength(0); j++)
  2793. {
  2794. component.materials[j].SetColor(this.namedcolorvalue.ToString(), this.colors[j, 2]);
  2795. }
  2796. }
  2797. else if (base.GetComponent<Light>())
  2798. {
  2799. base.GetComponent<Light>().color = this.colors[0, 2];
  2800. }
  2801. if (this.percentage == 1f)
  2802. {
  2803. if (base.GetComponent(typeof(GUITexture)))
  2804. {
  2805. base.GetComponent<GUITexture>().color = this.colors[0, 1];
  2806. }
  2807. else if (base.GetComponent(typeof(GUIText)))
  2808. {
  2809. base.GetComponent<GUIText>().material.color = this.colors[0, 1];
  2810. }
  2811. else if (base.GetComponent<Renderer>())
  2812. {
  2813. Renderer component2 = base.GetComponent<Renderer>();
  2814. for (int k = 0; k < this.colors.GetLength(0); k++)
  2815. {
  2816. component2.materials[k].SetColor(this.namedcolorvalue.ToString(), this.colors[k, 1]);
  2817. }
  2818. }
  2819. else if (base.GetComponent<Light>())
  2820. {
  2821. base.GetComponent<Light>().color = this.colors[0, 1];
  2822. }
  2823. }
  2824. }
  2825. private void ApplyAudioToTargets()
  2826. {
  2827. this.vector2s[2].x = this.ease(this.vector2s[0].x, this.vector2s[1].x, this.percentage, this.easeCurve);
  2828. this.vector2s[2].y = this.ease(this.vector2s[0].y, this.vector2s[1].y, this.percentage, this.easeCurve);
  2829. this.audioSource.volume = this.vector2s[2].x;
  2830. this.audioSource.pitch = this.vector2s[2].y;
  2831. if (this.percentage == 1f)
  2832. {
  2833. this.audioSource.volume = this.vector2s[1].x;
  2834. this.audioSource.pitch = this.vector2s[1].y;
  2835. }
  2836. }
  2837. private void ApplyStabTargets()
  2838. {
  2839. }
  2840. private void ApplyMoveToPathTargets()
  2841. {
  2842. this.preUpdate = base.transform.position;
  2843. float value = this.ease(0f, 1f, this.percentage, this.easeCurve);
  2844. if (this.isLocal)
  2845. {
  2846. base.transform.localPosition = this.path.Interp(Mathf.Clamp(value, 0f, 1f));
  2847. }
  2848. else
  2849. {
  2850. base.transform.position = this.path.Interp(Mathf.Clamp(value, 0f, 1f));
  2851. }
  2852. if (this.tweenArguments.Contains("orienttopath") && (bool)this.tweenArguments["orienttopath"])
  2853. {
  2854. float num;
  2855. if (this.tweenArguments.Contains("lookahead"))
  2856. {
  2857. num = (float)this.tweenArguments["lookahead"];
  2858. }
  2859. else
  2860. {
  2861. num = AMTween.Defaults.lookAhead;
  2862. }
  2863. float value2 = this.ease(0f, 1f, Mathf.Min(1f, this.percentage + num), this.easeCurve);
  2864. this.tweenArguments["looktarget"] = this.path.Interp(Mathf.Clamp(value2, 0f, 1f));
  2865. }
  2866. this.postUpdate = base.transform.position;
  2867. if (this.physics)
  2868. {
  2869. base.transform.position = this.preUpdate;
  2870. base.GetComponent<Rigidbody>().MovePosition(this.postUpdate);
  2871. }
  2872. }
  2873. private void ApplyMoveToTargets()
  2874. {
  2875. this.preUpdate = base.transform.position;
  2876. this.vector3s[2].x = this.ease(this.vector3s[0].x, this.vector3s[1].x, this.percentage, this.easeCurve);
  2877. this.vector3s[2].y = this.ease(this.vector3s[0].y, this.vector3s[1].y, this.percentage, this.easeCurve);
  2878. this.vector3s[2].z = this.ease(this.vector3s[0].z, this.vector3s[1].z, this.percentage, this.easeCurve);
  2879. if (this.isLocal)
  2880. {
  2881. base.transform.localPosition = this.vector3s[2];
  2882. }
  2883. else
  2884. {
  2885. base.transform.position = this.vector3s[2];
  2886. }
  2887. if (this.percentage == 1f)
  2888. {
  2889. if (this.isLocal)
  2890. {
  2891. base.transform.localPosition = this.vector3s[1];
  2892. }
  2893. else
  2894. {
  2895. base.transform.position = this.vector3s[1];
  2896. }
  2897. }
  2898. this.postUpdate = base.transform.position;
  2899. if (this.physics)
  2900. {
  2901. base.transform.position = this.preUpdate;
  2902. base.GetComponent<Rigidbody>().MovePosition(this.postUpdate);
  2903. }
  2904. }
  2905. private void ApplyMoveByTargets()
  2906. {
  2907. this.preUpdate = base.transform.position;
  2908. Vector3 eulerAngles = default(Vector3);
  2909. if (this.tweenArguments.Contains("looktarget"))
  2910. {
  2911. eulerAngles = base.transform.eulerAngles;
  2912. base.transform.eulerAngles = this.vector3s[4];
  2913. }
  2914. this.vector3s[2].x = this.ease(this.vector3s[0].x, this.vector3s[1].x, this.percentage, this.easeCurve);
  2915. this.vector3s[2].y = this.ease(this.vector3s[0].y, this.vector3s[1].y, this.percentage, this.easeCurve);
  2916. this.vector3s[2].z = this.ease(this.vector3s[0].z, this.vector3s[1].z, this.percentage, this.easeCurve);
  2917. base.transform.Translate(this.vector3s[2] - this.vector3s[3], this.space);
  2918. this.vector3s[3] = this.vector3s[2];
  2919. if (this.tweenArguments.Contains("looktarget"))
  2920. {
  2921. base.transform.eulerAngles = eulerAngles;
  2922. }
  2923. this.postUpdate = base.transform.position;
  2924. if (this.physics)
  2925. {
  2926. base.transform.position = this.preUpdate;
  2927. base.GetComponent<Rigidbody>().MovePosition(this.postUpdate);
  2928. }
  2929. }
  2930. private void ApplyScaleToTargets()
  2931. {
  2932. this.vector3s[2].x = this.ease(this.vector3s[0].x, this.vector3s[1].x, this.percentage, this.easeCurve);
  2933. this.vector3s[2].y = this.ease(this.vector3s[0].y, this.vector3s[1].y, this.percentage, this.easeCurve);
  2934. this.vector3s[2].z = this.ease(this.vector3s[0].z, this.vector3s[1].z, this.percentage, this.easeCurve);
  2935. base.transform.localScale = this.vector3s[2];
  2936. if (this.percentage == 1f)
  2937. {
  2938. base.transform.localScale = this.vector3s[1];
  2939. }
  2940. }
  2941. private void ApplyLookToTargets()
  2942. {
  2943. this.vector3s[2].x = this.ease(this.vector3s[0].x, this.vector3s[1].x, this.percentage, this.easeCurve);
  2944. this.vector3s[2].y = this.ease(this.vector3s[0].y, this.vector3s[1].y, this.percentage, this.easeCurve);
  2945. this.vector3s[2].z = this.ease(this.vector3s[0].z, this.vector3s[1].z, this.percentage, this.easeCurve);
  2946. if (this.isLocal)
  2947. {
  2948. base.transform.localRotation = Quaternion.Euler(this.vector3s[2]);
  2949. }
  2950. else
  2951. {
  2952. base.transform.rotation = Quaternion.Euler(this.vector3s[2]);
  2953. }
  2954. }
  2955. private void ApplyLookToFollowTargets()
  2956. {
  2957. if (this.tweenArguments.Contains("endposition"))
  2958. {
  2959. Vector3 position = base.transform.position;
  2960. base.transform.position = (Vector3)this.tweenArguments["endposition"];
  2961. base.transform.LookAt((Transform)this.tweenArguments["looktarget"]);
  2962. base.transform.position = position;
  2963. }
  2964. else
  2965. {
  2966. base.transform.LookAt((Transform)this.tweenArguments["looktarget"]);
  2967. }
  2968. this.vector3s[1] = base.transform.eulerAngles;
  2969. this.vector3s[1] = new Vector3(AMTween.clerp(this.vector3s[0].x, this.vector3s[1].x, 1f), AMTween.clerp(this.vector3s[0].y, this.vector3s[1].y, 1f), AMTween.clerp(this.vector3s[0].z, this.vector3s[1].z, 1f));
  2970. this.vector3s[2].x = this.ease(this.vector3s[0].x, this.vector3s[1].x, this.percentage, this.easeCurve);
  2971. this.vector3s[2].y = this.ease(this.vector3s[0].y, this.vector3s[1].y, this.percentage, this.easeCurve);
  2972. this.vector3s[2].z = this.ease(this.vector3s[0].z, this.vector3s[1].z, this.percentage, this.easeCurve);
  2973. base.transform.rotation = Quaternion.Euler(this.vector3s[2]);
  2974. }
  2975. private void ApplyLookFollowTargets()
  2976. {
  2977. base.transform.LookAt((Transform)this.tweenArguments["looktarget"]);
  2978. }
  2979. private void ApplyRotateToTargets()
  2980. {
  2981. this.preUpdate = base.transform.eulerAngles;
  2982. this.vector3s[2].x = this.ease(this.vector3s[0].x, this.vector3s[1].x, this.percentage, this.easeCurve);
  2983. this.vector3s[2].y = this.ease(this.vector3s[0].y, this.vector3s[1].y, this.percentage, this.easeCurve);
  2984. this.vector3s[2].z = this.ease(this.vector3s[0].z, this.vector3s[1].z, this.percentage, this.easeCurve);
  2985. if (this.isLocal)
  2986. {
  2987. base.transform.localRotation = Quaternion.Euler(this.vector3s[2]);
  2988. }
  2989. else
  2990. {
  2991. base.transform.rotation = Quaternion.Euler(this.vector3s[2]);
  2992. }
  2993. if (this.percentage == 1f)
  2994. {
  2995. if (this.isLocal)
  2996. {
  2997. base.transform.localRotation = Quaternion.Euler(this.vector3s[1]);
  2998. }
  2999. else
  3000. {
  3001. base.transform.rotation = Quaternion.Euler(this.vector3s[1]);
  3002. }
  3003. }
  3004. this.postUpdate = base.transform.eulerAngles;
  3005. if (this.physics)
  3006. {
  3007. base.transform.eulerAngles = this.preUpdate;
  3008. base.GetComponent<Rigidbody>().MoveRotation(Quaternion.Euler(this.postUpdate));
  3009. }
  3010. }
  3011. private void ApplyRotateAddTargets()
  3012. {
  3013. this.preUpdate = base.transform.eulerAngles;
  3014. this.vector3s[2].x = this.ease(this.vector3s[0].x, this.vector3s[1].x, this.percentage, this.easeCurve);
  3015. this.vector3s[2].y = this.ease(this.vector3s[0].y, this.vector3s[1].y, this.percentage, this.easeCurve);
  3016. this.vector3s[2].z = this.ease(this.vector3s[0].z, this.vector3s[1].z, this.percentage, this.easeCurve);
  3017. base.transform.Rotate(this.vector3s[2] - this.vector3s[3], this.space);
  3018. this.vector3s[3] = this.vector3s[2];
  3019. this.postUpdate = base.transform.eulerAngles;
  3020. if (this.physics)
  3021. {
  3022. base.transform.eulerAngles = this.preUpdate;
  3023. base.GetComponent<Rigidbody>().MoveRotation(Quaternion.Euler(this.postUpdate));
  3024. }
  3025. }
  3026. private void ApplyShakePositionTargets()
  3027. {
  3028. if (this.isLocal)
  3029. {
  3030. this.preUpdate = base.transform.localPosition;
  3031. }
  3032. else
  3033. {
  3034. this.preUpdate = base.transform.position;
  3035. }
  3036. Vector3 eulerAngles = default(Vector3);
  3037. if (this.tweenArguments.Contains("looktarget"))
  3038. {
  3039. eulerAngles = base.transform.eulerAngles;
  3040. base.transform.eulerAngles = this.vector3s[3];
  3041. }
  3042. if (this.percentage == 0f)
  3043. {
  3044. base.transform.Translate(this.vector3s[1], this.space);
  3045. }
  3046. if (this.isLocal)
  3047. {
  3048. base.transform.localPosition = this.vector3s[0];
  3049. }
  3050. else
  3051. {
  3052. base.transform.position = this.vector3s[0];
  3053. }
  3054. float num = 1f - this.percentage;
  3055. this.vector3s[2].x = UnityEngine.Random.Range(-this.vector3s[1].x * num, this.vector3s[1].x * num);
  3056. this.vector3s[2].y = UnityEngine.Random.Range(-this.vector3s[1].y * num, this.vector3s[1].y * num);
  3057. this.vector3s[2].z = UnityEngine.Random.Range(-this.vector3s[1].z * num, this.vector3s[1].z * num);
  3058. if (this.isLocal)
  3059. {
  3060. base.transform.localPosition += this.vector3s[2];
  3061. }
  3062. else
  3063. {
  3064. base.transform.position += this.vector3s[2];
  3065. }
  3066. if (this.tweenArguments.Contains("looktarget"))
  3067. {
  3068. base.transform.eulerAngles = eulerAngles;
  3069. }
  3070. this.postUpdate = base.transform.position;
  3071. if (this.physics)
  3072. {
  3073. base.transform.position = this.preUpdate;
  3074. base.GetComponent<Rigidbody>().MovePosition(this.postUpdate);
  3075. }
  3076. }
  3077. private void ApplyShakeScaleTargets()
  3078. {
  3079. if (this.percentage == 0f)
  3080. {
  3081. base.transform.localScale = this.vector3s[1];
  3082. }
  3083. base.transform.localScale = this.vector3s[0];
  3084. float num = 1f - this.percentage;
  3085. this.vector3s[2].x = UnityEngine.Random.Range(-this.vector3s[1].x * num, this.vector3s[1].x * num);
  3086. this.vector3s[2].y = UnityEngine.Random.Range(-this.vector3s[1].y * num, this.vector3s[1].y * num);
  3087. this.vector3s[2].z = UnityEngine.Random.Range(-this.vector3s[1].z * num, this.vector3s[1].z * num);
  3088. base.transform.localScale += this.vector3s[2];
  3089. }
  3090. private void ApplyShakeRotationTargets()
  3091. {
  3092. this.preUpdate = base.transform.eulerAngles;
  3093. if (this.percentage == 0f)
  3094. {
  3095. base.transform.Rotate(this.vector3s[1], this.space);
  3096. }
  3097. base.transform.eulerAngles = this.vector3s[0];
  3098. float num = 1f - this.percentage;
  3099. this.vector3s[2].x = UnityEngine.Random.Range(-this.vector3s[1].x * num, this.vector3s[1].x * num);
  3100. this.vector3s[2].y = UnityEngine.Random.Range(-this.vector3s[1].y * num, this.vector3s[1].y * num);
  3101. this.vector3s[2].z = UnityEngine.Random.Range(-this.vector3s[1].z * num, this.vector3s[1].z * num);
  3102. base.transform.Rotate(this.vector3s[2], this.space);
  3103. this.postUpdate = base.transform.eulerAngles;
  3104. if (this.physics)
  3105. {
  3106. base.transform.eulerAngles = this.preUpdate;
  3107. base.GetComponent<Rigidbody>().MoveRotation(Quaternion.Euler(this.postUpdate));
  3108. }
  3109. }
  3110. private void ApplyPunchPositionTargets()
  3111. {
  3112. this.preUpdate = base.transform.position;
  3113. Vector3 eulerAngles = default(Vector3);
  3114. if (this.tweenArguments.Contains("looktarget"))
  3115. {
  3116. eulerAngles = base.transform.eulerAngles;
  3117. base.transform.eulerAngles = this.vector3s[4];
  3118. }
  3119. if (this.vector3s[1].x > 0f)
  3120. {
  3121. this.vector3s[2].x = AMTween.punch(this.vector3s[1].x, this.percentage, null);
  3122. }
  3123. else if (this.vector3s[1].x < 0f)
  3124. {
  3125. this.vector3s[2].x = -AMTween.punch(Mathf.Abs(this.vector3s[1].x), this.percentage, null);
  3126. }
  3127. if (this.vector3s[1].y > 0f)
  3128. {
  3129. this.vector3s[2].y = AMTween.punch(this.vector3s[1].y, this.percentage, null);
  3130. }
  3131. else if (this.vector3s[1].y < 0f)
  3132. {
  3133. this.vector3s[2].y = -AMTween.punch(Mathf.Abs(this.vector3s[1].y), this.percentage, null);
  3134. }
  3135. if (this.vector3s[1].z > 0f)
  3136. {
  3137. this.vector3s[2].z = AMTween.punch(this.vector3s[1].z, this.percentage, null);
  3138. }
  3139. else if (this.vector3s[1].z < 0f)
  3140. {
  3141. this.vector3s[2].z = -AMTween.punch(Mathf.Abs(this.vector3s[1].z), this.percentage, null);
  3142. }
  3143. base.transform.Translate(this.vector3s[2] - this.vector3s[3], this.space);
  3144. this.vector3s[3] = this.vector3s[2];
  3145. if (this.tweenArguments.Contains("looktarget"))
  3146. {
  3147. base.transform.eulerAngles = eulerAngles;
  3148. }
  3149. this.postUpdate = base.transform.position;
  3150. if (this.physics)
  3151. {
  3152. base.transform.position = this.preUpdate;
  3153. base.GetComponent<Rigidbody>().MovePosition(this.postUpdate);
  3154. }
  3155. }
  3156. private void ApplyPunchRotationTargets()
  3157. {
  3158. this.preUpdate = base.transform.eulerAngles;
  3159. if (this.vector3s[1].x > 0f)
  3160. {
  3161. this.vector3s[2].x = AMTween.punch(this.vector3s[1].x, this.percentage, null);
  3162. }
  3163. else if (this.vector3s[1].x < 0f)
  3164. {
  3165. this.vector3s[2].x = -AMTween.punch(Mathf.Abs(this.vector3s[1].x), this.percentage, null);
  3166. }
  3167. if (this.vector3s[1].y > 0f)
  3168. {
  3169. this.vector3s[2].y = AMTween.punch(this.vector3s[1].y, this.percentage, null);
  3170. }
  3171. else if (this.vector3s[1].y < 0f)
  3172. {
  3173. this.vector3s[2].y = -AMTween.punch(Mathf.Abs(this.vector3s[1].y), this.percentage, null);
  3174. }
  3175. if (this.vector3s[1].z > 0f)
  3176. {
  3177. this.vector3s[2].z = AMTween.punch(this.vector3s[1].z, this.percentage, null);
  3178. }
  3179. else if (this.vector3s[1].z < 0f)
  3180. {
  3181. this.vector3s[2].z = -AMTween.punch(Mathf.Abs(this.vector3s[1].z), this.percentage, null);
  3182. }
  3183. base.transform.Rotate(this.vector3s[2] - this.vector3s[3], this.space);
  3184. this.vector3s[3] = this.vector3s[2];
  3185. this.postUpdate = base.transform.eulerAngles;
  3186. if (this.physics)
  3187. {
  3188. base.transform.eulerAngles = this.preUpdate;
  3189. base.GetComponent<Rigidbody>().MoveRotation(Quaternion.Euler(this.postUpdate));
  3190. }
  3191. }
  3192. private void ApplyPunchScaleTargets()
  3193. {
  3194. if (this.vector3s[1].x > 0f)
  3195. {
  3196. this.vector3s[2].x = AMTween.punch(this.vector3s[1].x, this.percentage, null);
  3197. }
  3198. else if (this.vector3s[1].x < 0f)
  3199. {
  3200. this.vector3s[2].x = -AMTween.punch(Mathf.Abs(this.vector3s[1].x), this.percentage, null);
  3201. }
  3202. if (this.vector3s[1].y > 0f)
  3203. {
  3204. this.vector3s[2].y = AMTween.punch(this.vector3s[1].y, this.percentage, null);
  3205. }
  3206. else if (this.vector3s[1].y < 0f)
  3207. {
  3208. this.vector3s[2].y = -AMTween.punch(Mathf.Abs(this.vector3s[1].y), this.percentage, null);
  3209. }
  3210. if (this.vector3s[1].z > 0f)
  3211. {
  3212. this.vector3s[2].z = AMTween.punch(this.vector3s[1].z, this.percentage, null);
  3213. }
  3214. else if (this.vector3s[1].z < 0f)
  3215. {
  3216. this.vector3s[2].z = -AMTween.punch(Mathf.Abs(this.vector3s[1].z), this.percentage, null);
  3217. }
  3218. base.transform.localScale = this.vector3s[0] + this.vector3s[2];
  3219. }
  3220. private void ApplyCameraFadeValueTargets()
  3221. {
  3222. AMTween.cf.value = this.ease(1f, 0f, this.percentage, this.easeCurve);
  3223. AMTween.cf.percent = this.percentage;
  3224. }
  3225. private IEnumerator TweenDelay()
  3226. {
  3227. this.delayStarted = NTime.time;
  3228. while (NTime.time - this.delayStarted < this.delay)
  3229. {
  3230. yield return null;
  3231. }
  3232. if (this.wasPaused)
  3233. {
  3234. this.wasPaused = false;
  3235. this.TweenStart(true);
  3236. }
  3237. yield break;
  3238. }
  3239. private void TweenStart(bool checkConflict = true)
  3240. {
  3241. this.CallBack("onstart");
  3242. this.sendMessage();
  3243. this.invokeMethod();
  3244. this.playAnimation();
  3245. this.playAudio();
  3246. if (!this.loop)
  3247. {
  3248. if (checkConflict)
  3249. {
  3250. this.ConflictCheck();
  3251. }
  3252. this.GenerateTargets();
  3253. }
  3254. if (this.type == "stab")
  3255. {
  3256. this.audioSource.PlayOneShot(this.audioSource.clip);
  3257. }
  3258. if (this.type == "move" || this.type == "scale" || this.type == "rotate" || this.type == "punch" || this.type == "shake" || this.type == "curve" || this.type == "look")
  3259. {
  3260. this.EnableKinematic();
  3261. }
  3262. this.isRunning = true;
  3263. }
  3264. private IEnumerator TweenRestart()
  3265. {
  3266. if (this.delay > 0f)
  3267. {
  3268. this.delayStarted = NTime.time;
  3269. while (NTime.time - this.delayStarted < this.delay)
  3270. {
  3271. yield return null;
  3272. }
  3273. }
  3274. this.loop = true;
  3275. this.TweenStart(true);
  3276. yield break;
  3277. }
  3278. private void TweenUpdate()
  3279. {
  3280. if (!this.isRunning)
  3281. {
  3282. return;
  3283. }
  3284. if (this.apply != null)
  3285. {
  3286. this.apply();
  3287. }
  3288. this.CallBack("onupdate");
  3289. this.UpdatePercentage();
  3290. if ((string)this.tweenArguments["method"] == "animation")
  3291. {
  3292. GameObject gameObject = this.tweenArguments["target"] as GameObject;
  3293. AnimationClip clip = gameObject.GetComponent<Animation>().GetClip((string)this.tweenArguments["animation"]);
  3294. clip.SampleAnimation(gameObject, NTime.time - (this.delayStarted + this.delay));
  3295. }
  3296. }
  3297. private void TweenComplete(bool end = false)
  3298. {
  3299. if (!this.isRunning)
  3300. {
  3301. return;
  3302. }
  3303. if (end && this.apply == null)
  3304. {
  3305. this.GenerateTargets();
  3306. }
  3307. this.isRunning = false;
  3308. if (end || this.percentage > 0.5f)
  3309. {
  3310. this.percentage = 1f;
  3311. }
  3312. else
  3313. {
  3314. this.percentage = 0f;
  3315. }
  3316. if (this.apply != null)
  3317. {
  3318. this.apply();
  3319. }
  3320. if (this.type == "value")
  3321. {
  3322. this.CallBack("onupdate");
  3323. }
  3324. if (this.loopType == AMTween.LoopType.none)
  3325. {
  3326. this.Dispose();
  3327. }
  3328. else if ((string)this.tweenArguments["method"] != "audio")
  3329. {
  3330. this.TweenLoop();
  3331. }
  3332. this.CallBack("oncomplete");
  3333. }
  3334. private void TweenLoop()
  3335. {
  3336. if (!this.isRunning)
  3337. {
  3338. return;
  3339. }
  3340. this.DisableKinematic();
  3341. AMTween.LoopType loopType = this.loopType;
  3342. if (loopType != AMTween.LoopType.loop)
  3343. {
  3344. if (loopType == AMTween.LoopType.pingPong)
  3345. {
  3346. this.reverse = !this.reverse;
  3347. this.runningTime = 0f;
  3348. base.StartCoroutine("TweenRestart");
  3349. }
  3350. }
  3351. else
  3352. {
  3353. this.percentage = 0f;
  3354. this.runningTime = 0f;
  3355. if (this.apply != null)
  3356. {
  3357. this.apply();
  3358. }
  3359. base.StartCoroutine("TweenRestart");
  3360. }
  3361. }
  3362. private void resumeExtras()
  3363. {
  3364. if (this.delay > 0f)
  3365. {
  3366. return;
  3367. }
  3368. if ((string)this.tweenArguments["method"] == "audio")
  3369. {
  3370. (this.tweenArguments["audiosource"] as AudioSource).time = this.runningTime % (this.tweenArguments["audioclip"] as AudioClip).length;
  3371. (this.tweenArguments["audiosource"] as AudioSource).Play();
  3372. }
  3373. else if ((string)this.tweenArguments["method"] == "animation")
  3374. {
  3375. (this.tweenArguments["target"] as GameObject).GetComponent<Animation>()[(string)this.tweenArguments["animation"]].time = this.runningTime;
  3376. }
  3377. }
  3378. private void pauseExtras()
  3379. {
  3380. if (this.delay > 0f)
  3381. {
  3382. return;
  3383. }
  3384. if ((string)this.tweenArguments["method"] == "audio")
  3385. {
  3386. (this.tweenArguments["audiosource"] as AudioSource).Stop();
  3387. }
  3388. else if ((string)this.tweenArguments["method"] == "animation")
  3389. {
  3390. (this.tweenArguments["target"] as GameObject).GetComponent<Animation>().Stop();
  3391. }
  3392. }
  3393. private void playAnimation()
  3394. {
  3395. if ((string)this.tweenArguments["method"] != "animation")
  3396. {
  3397. return;
  3398. }
  3399. if (this.tweenArguments["wrapmode"] != null)
  3400. {
  3401. (this.tweenArguments["target"] as GameObject).GetComponent<Animation>().wrapMode = (WrapMode)this.tweenArguments["wrapmode"];
  3402. }
  3403. if (this.tweenArguments["crossfade"] == null || (bool)this.tweenArguments["crossfade"])
  3404. {
  3405. }
  3406. }
  3407. private void playAudio()
  3408. {
  3409. if ((string)this.tweenArguments["method"] != "audio")
  3410. {
  3411. return;
  3412. }
  3413. if ((this.tweenArguments["audiosource"] as AudioSource).isPlaying)
  3414. {
  3415. (this.tweenArguments["audiosource"] as AudioSource).Stop();
  3416. }
  3417. if (this.tweenArguments["loop"] != null)
  3418. {
  3419. (this.tweenArguments["audiosource"] as AudioSource).loop = (bool)this.tweenArguments["loop"];
  3420. }
  3421. (this.tweenArguments["audiosource"] as AudioSource).time = this.runningTime;
  3422. (this.tweenArguments["audiosource"] as AudioSource).clip = null;
  3423. (this.tweenArguments["audiosource"] as AudioSource).clip = (this.tweenArguments["audioclip"] as AudioClip);
  3424. (this.tweenArguments["audiosource"] as AudioSource).pitch = 1f;
  3425. (this.tweenArguments["audiosource"] as AudioSource).Play();
  3426. }
  3427. private void sendMessage()
  3428. {
  3429. if ((string)this.tweenArguments["method"] != "message")
  3430. {
  3431. return;
  3432. }
  3433. if (this.tweenArguments["parameter"] != null)
  3434. {
  3435. object value = this.tweenArguments["parameter"];
  3436. (this.tweenArguments["target"] as GameObject).SendMessage(this.tweenArguments["methodname"] as string, value);
  3437. }
  3438. else
  3439. {
  3440. (this.tweenArguments["target"] as GameObject).SendMessage(this.tweenArguments["methodname"] as string);
  3441. }
  3442. }
  3443. private void invokeMethod()
  3444. {
  3445. if ((string)this.tweenArguments["type"] != "invoke")
  3446. {
  3447. return;
  3448. }
  3449. try
  3450. {
  3451. if (this.tweenArguments["parameters"] != null)
  3452. {
  3453. object[] array = this.tweenArguments["parameters"] as object[];
  3454. ParameterInfo[] parameters = (this.tweenArguments["methodinfo"] as MethodInfo).GetParameters();
  3455. for (int i = 0; i < parameters.Length; i++)
  3456. {
  3457. if (array[i].GetType() != parameters[i].ParameterType)
  3458. {
  3459. Debug.LogWarning("AMTween: Error casting parameters for method '" + (this.tweenArguments["methodinfo"] as MethodInfo).Name + "'. If your parameters include derivatives of UnityEngine.Object[] (such as GameObject[]) try using UnityEngine.Object[] instead.");
  3460. return;
  3461. }
  3462. }
  3463. (this.tweenArguments["methodinfo"] as MethodInfo).Invoke(this.tweenArguments["component"] as Component, this.tweenArguments["parameters"] as object[]);
  3464. }
  3465. else
  3466. {
  3467. (this.tweenArguments["methodinfo"] as MethodInfo).Invoke(this.tweenArguments["component"] as Component, null);
  3468. }
  3469. }
  3470. catch
  3471. {
  3472. Debug.LogWarning(string.Concat(new object[]
  3473. {
  3474. "AMTween: Error processing method '",
  3475. (this.tweenArguments["methodinfo"] as MethodInfo).Name,
  3476. "' parameters. Are you passing a null value? ",
  3477. this.tweenArguments["trackid"],
  3478. " at ",
  3479. this.delayStarted,
  3480. "s"
  3481. }));
  3482. }
  3483. }
  3484. public static Rect RectUpdate(Rect currentValue, Rect targetValue, float speed)
  3485. {
  3486. Rect result = new Rect(AMTween.FloatUpdate(currentValue.x, targetValue.x, speed), AMTween.FloatUpdate(currentValue.y, targetValue.y, speed), AMTween.FloatUpdate(currentValue.width, targetValue.width, speed), AMTween.FloatUpdate(currentValue.height, targetValue.height, speed));
  3487. return result;
  3488. }
  3489. public static Vector3 Vector3Update(Vector3 currentValue, Vector3 targetValue, float speed)
  3490. {
  3491. Vector3 a = targetValue - currentValue;
  3492. currentValue += a * speed * NTime.deltaTime;
  3493. return currentValue;
  3494. }
  3495. public static Vector2 Vector2Update(Vector2 currentValue, Vector2 targetValue, float speed)
  3496. {
  3497. Vector2 a = targetValue - currentValue;
  3498. currentValue += a * speed * NTime.deltaTime;
  3499. return currentValue;
  3500. }
  3501. public static float FloatUpdate(float currentValue, float targetValue, float speed)
  3502. {
  3503. float num = targetValue - currentValue;
  3504. currentValue += num * speed * NTime.deltaTime;
  3505. return currentValue;
  3506. }
  3507. public static void FadeUpdate(GameObject target, Hashtable args)
  3508. {
  3509. args["a"] = args["alpha"];
  3510. AMTween.ColorUpdate(target, args);
  3511. }
  3512. public static void FadeUpdate(GameObject target, float alpha, float time, string trackId)
  3513. {
  3514. AMTween.FadeUpdate(target, AMTween.Hash(new object[]
  3515. {
  3516. "trackid",
  3517. trackId,
  3518. "alpha",
  3519. alpha,
  3520. "time",
  3521. time
  3522. }));
  3523. }
  3524. public static void ColorUpdate(GameObject target, Hashtable args)
  3525. {
  3526. AMTween.CleanArgs(args);
  3527. Color[] array = new Color[4];
  3528. if (!args.Contains("includechildren") || (bool)args["includechildren"])
  3529. {
  3530. IEnumerator enumerator = target.transform.GetEnumerator();
  3531. try
  3532. {
  3533. while (enumerator.MoveNext())
  3534. {
  3535. object obj = enumerator.Current;
  3536. Transform transform = (Transform)obj;
  3537. AMTween.ColorUpdate(transform.gameObject, args);
  3538. }
  3539. }
  3540. finally
  3541. {
  3542. IDisposable disposable;
  3543. if ((disposable = (enumerator as IDisposable)) != null)
  3544. {
  3545. disposable.Dispose();
  3546. }
  3547. }
  3548. }
  3549. float num;
  3550. if (args.Contains("time"))
  3551. {
  3552. num = (float)args["time"];
  3553. num *= AMTween.Defaults.updateTimePercentage;
  3554. }
  3555. else
  3556. {
  3557. num = AMTween.Defaults.updateTime;
  3558. }
  3559. if (target.GetComponent(typeof(GUITexture)))
  3560. {
  3561. array[0] = (array[1] = target.GetComponent<GUITexture>().color);
  3562. }
  3563. else if (target.GetComponent(typeof(GUIText)))
  3564. {
  3565. array[0] = (array[1] = target.GetComponent<GUIText>().material.color);
  3566. }
  3567. else if (target.GetComponent<Renderer>())
  3568. {
  3569. array[0] = (array[1] = target.GetComponent<Renderer>().material.color);
  3570. }
  3571. else if (target.GetComponent<Light>())
  3572. {
  3573. array[0] = (array[1] = target.GetComponent<Light>().color);
  3574. }
  3575. if (args.Contains("color"))
  3576. {
  3577. array[1] = (Color)args["color"];
  3578. }
  3579. else
  3580. {
  3581. if (args.Contains("r"))
  3582. {
  3583. array[1].r = (float)args["r"];
  3584. }
  3585. if (args.Contains("g"))
  3586. {
  3587. array[1].g = (float)args["g"];
  3588. }
  3589. if (args.Contains("b"))
  3590. {
  3591. array[1].b = (float)args["b"];
  3592. }
  3593. if (args.Contains("a"))
  3594. {
  3595. array[1].a = (float)args["a"];
  3596. }
  3597. }
  3598. array[3].r = Mathf.SmoothDamp(array[0].r, array[1].r, ref array[2].r, num);
  3599. array[3].g = Mathf.SmoothDamp(array[0].g, array[1].g, ref array[2].g, num);
  3600. array[3].b = Mathf.SmoothDamp(array[0].b, array[1].b, ref array[2].b, num);
  3601. array[3].a = Mathf.SmoothDamp(array[0].a, array[1].a, ref array[2].a, num);
  3602. if (target.GetComponent(typeof(GUITexture)))
  3603. {
  3604. target.GetComponent<GUITexture>().color = array[3];
  3605. }
  3606. else if (target.GetComponent(typeof(GUIText)))
  3607. {
  3608. target.GetComponent<GUIText>().material.color = array[3];
  3609. }
  3610. else if (target.GetComponent<Renderer>())
  3611. {
  3612. target.GetComponent<Renderer>().material.color = array[3];
  3613. }
  3614. else if (target.GetComponent<Light>())
  3615. {
  3616. target.GetComponent<Light>().color = array[3];
  3617. }
  3618. }
  3619. public static void ColorUpdate(GameObject target, Color color, float time, string trackId)
  3620. {
  3621. AMTween.ColorUpdate(target, AMTween.Hash(new object[]
  3622. {
  3623. "trackid",
  3624. trackId,
  3625. "color",
  3626. color,
  3627. "time",
  3628. time
  3629. }));
  3630. }
  3631. public static void AudioUpdate(GameObject target, Hashtable args)
  3632. {
  3633. AMTween.CleanArgs(args);
  3634. Vector2[] array = new Vector2[4];
  3635. float num;
  3636. if (args.Contains("time"))
  3637. {
  3638. num = (float)args["time"];
  3639. num *= AMTween.Defaults.updateTimePercentage;
  3640. }
  3641. else
  3642. {
  3643. num = AMTween.Defaults.updateTime;
  3644. }
  3645. AudioSource audioSource;
  3646. if (args.Contains("audiosource"))
  3647. {
  3648. audioSource = (AudioSource)args["audiosource"];
  3649. }
  3650. else
  3651. {
  3652. if (!target.GetComponent(typeof(AudioSource)))
  3653. {
  3654. Debug.LogError("AMTween Error: AudioUpdate requires an AudioSource.");
  3655. return;
  3656. }
  3657. audioSource = target.GetComponent<AudioSource>();
  3658. }
  3659. array[0] = (array[1] = new Vector2(audioSource.volume, audioSource.pitch));
  3660. if (args.Contains("volume"))
  3661. {
  3662. array[1].x = (float)args["volume"];
  3663. }
  3664. if (args.Contains("pitch"))
  3665. {
  3666. array[1].y = (float)args["pitch"];
  3667. }
  3668. array[3].x = Mathf.SmoothDampAngle(array[0].x, array[1].x, ref array[2].x, num);
  3669. array[3].y = Mathf.SmoothDampAngle(array[0].y, array[1].y, ref array[2].y, num);
  3670. audioSource.volume = array[3].x;
  3671. audioSource.pitch = array[3].y;
  3672. }
  3673. public static void AudioUpdate(GameObject target, float volume, float pitch, float time, string trackId)
  3674. {
  3675. AMTween.AudioUpdate(target, AMTween.Hash(new object[]
  3676. {
  3677. "trackid",
  3678. trackId,
  3679. "volume",
  3680. volume,
  3681. "pitch",
  3682. pitch,
  3683. "time",
  3684. time
  3685. }));
  3686. }
  3687. public static void RotateUpdate(GameObject target, Hashtable args)
  3688. {
  3689. AMTween.CleanArgs(args);
  3690. Vector3[] array = new Vector3[4];
  3691. Vector3 eulerAngles = target.transform.eulerAngles;
  3692. float num;
  3693. if (args.Contains("time"))
  3694. {
  3695. num = (float)args["time"];
  3696. num *= AMTween.Defaults.updateTimePercentage;
  3697. }
  3698. else
  3699. {
  3700. num = AMTween.Defaults.updateTime;
  3701. }
  3702. bool flag;
  3703. if (args.Contains("islocal"))
  3704. {
  3705. flag = (bool)args["islocal"];
  3706. }
  3707. else
  3708. {
  3709. flag = AMTween.Defaults.isLocal;
  3710. }
  3711. if (flag)
  3712. {
  3713. array[0] = target.transform.localEulerAngles;
  3714. }
  3715. else
  3716. {
  3717. array[0] = target.transform.eulerAngles;
  3718. }
  3719. if (args.Contains("rotation"))
  3720. {
  3721. if (args["rotation"].GetType() == typeof(Transform))
  3722. {
  3723. Transform transform = (Transform)args["rotation"];
  3724. array[1] = transform.eulerAngles;
  3725. }
  3726. else if (args["rotation"].GetType() == typeof(Vector3))
  3727. {
  3728. array[1] = (Vector3)args["rotation"];
  3729. }
  3730. }
  3731. array[3].x = Mathf.SmoothDampAngle(array[0].x, array[1].x, ref array[2].x, num);
  3732. array[3].y = Mathf.SmoothDampAngle(array[0].y, array[1].y, ref array[2].y, num);
  3733. array[3].z = Mathf.SmoothDampAngle(array[0].z, array[1].z, ref array[2].z, num);
  3734. if (flag)
  3735. {
  3736. target.transform.localEulerAngles = array[3];
  3737. }
  3738. else
  3739. {
  3740. target.transform.eulerAngles = array[3];
  3741. }
  3742. if (target.GetComponent<Rigidbody>() != null)
  3743. {
  3744. Vector3 eulerAngles2 = target.transform.eulerAngles;
  3745. target.transform.eulerAngles = eulerAngles;
  3746. target.GetComponent<Rigidbody>().MoveRotation(Quaternion.Euler(eulerAngles2));
  3747. }
  3748. }
  3749. public static void RotateUpdate(GameObject target, Vector3 rotation, float time, string trackId)
  3750. {
  3751. AMTween.RotateUpdate(target, AMTween.Hash(new object[]
  3752. {
  3753. "trackid",
  3754. trackId,
  3755. "rotation",
  3756. rotation,
  3757. "time",
  3758. time
  3759. }));
  3760. }
  3761. public static void ScaleUpdate(GameObject target, Hashtable args)
  3762. {
  3763. AMTween.CleanArgs(args);
  3764. Vector3[] array = new Vector3[4];
  3765. float num;
  3766. if (args.Contains("time"))
  3767. {
  3768. num = (float)args["time"];
  3769. num *= AMTween.Defaults.updateTimePercentage;
  3770. }
  3771. else
  3772. {
  3773. num = AMTween.Defaults.updateTime;
  3774. }
  3775. array[0] = (array[1] = target.transform.localScale);
  3776. if (args.Contains("scale"))
  3777. {
  3778. if (args["scale"].GetType() == typeof(Transform))
  3779. {
  3780. Transform transform = (Transform)args["scale"];
  3781. array[1] = transform.localScale;
  3782. }
  3783. else if (args["scale"].GetType() == typeof(Vector3))
  3784. {
  3785. array[1] = (Vector3)args["scale"];
  3786. }
  3787. }
  3788. else
  3789. {
  3790. if (args.Contains("x"))
  3791. {
  3792. array[1].x = (float)args["x"];
  3793. }
  3794. if (args.Contains("y"))
  3795. {
  3796. array[1].y = (float)args["y"];
  3797. }
  3798. if (args.Contains("z"))
  3799. {
  3800. array[1].z = (float)args["z"];
  3801. }
  3802. }
  3803. array[3].x = Mathf.SmoothDamp(array[0].x, array[1].x, ref array[2].x, num);
  3804. array[3].y = Mathf.SmoothDamp(array[0].y, array[1].y, ref array[2].y, num);
  3805. array[3].z = Mathf.SmoothDamp(array[0].z, array[1].z, ref array[2].z, num);
  3806. target.transform.localScale = array[3];
  3807. }
  3808. public static void ScaleUpdate(GameObject target, Vector3 scale, float time, string trackId)
  3809. {
  3810. AMTween.ScaleUpdate(target, AMTween.Hash(new object[]
  3811. {
  3812. "trackid",
  3813. trackId,
  3814. "scale",
  3815. scale,
  3816. "time",
  3817. time
  3818. }));
  3819. }
  3820. public static void MoveUpdate(GameObject target, Hashtable args)
  3821. {
  3822. AMTween.CleanArgs(args);
  3823. Vector3[] array = new Vector3[4];
  3824. Vector3 position = target.transform.position;
  3825. float num;
  3826. if (args.Contains("time"))
  3827. {
  3828. num = (float)args["time"];
  3829. num *= AMTween.Defaults.updateTimePercentage;
  3830. }
  3831. else
  3832. {
  3833. num = AMTween.Defaults.updateTime;
  3834. }
  3835. bool flag;
  3836. if (args.Contains("islocal"))
  3837. {
  3838. flag = (bool)args["islocal"];
  3839. }
  3840. else
  3841. {
  3842. flag = AMTween.Defaults.isLocal;
  3843. }
  3844. if (flag)
  3845. {
  3846. array[0] = (array[1] = target.transform.localPosition);
  3847. }
  3848. else
  3849. {
  3850. array[0] = (array[1] = target.transform.position);
  3851. }
  3852. if (args.Contains("position"))
  3853. {
  3854. if (args["position"].GetType() == typeof(Transform))
  3855. {
  3856. Transform transform = (Transform)args["position"];
  3857. array[1] = transform.position;
  3858. }
  3859. else if (args["position"].GetType() == typeof(Vector3))
  3860. {
  3861. array[1] = (Vector3)args["position"];
  3862. }
  3863. }
  3864. else
  3865. {
  3866. if (args.Contains("x"))
  3867. {
  3868. array[1].x = (float)args["x"];
  3869. }
  3870. if (args.Contains("y"))
  3871. {
  3872. array[1].y = (float)args["y"];
  3873. }
  3874. if (args.Contains("z"))
  3875. {
  3876. array[1].z = (float)args["z"];
  3877. }
  3878. }
  3879. array[3].x = Mathf.SmoothDamp(array[0].x, array[1].x, ref array[2].x, num);
  3880. array[3].y = Mathf.SmoothDamp(array[0].y, array[1].y, ref array[2].y, num);
  3881. array[3].z = Mathf.SmoothDamp(array[0].z, array[1].z, ref array[2].z, num);
  3882. if (args.Contains("orienttopath") && (bool)args["orienttopath"])
  3883. {
  3884. args["looktarget"] = array[3];
  3885. }
  3886. if (args.Contains("looktarget"))
  3887. {
  3888. AMTween.LookUpdate(target, args);
  3889. }
  3890. if (flag)
  3891. {
  3892. target.transform.localPosition = array[3];
  3893. }
  3894. else
  3895. {
  3896. target.transform.position = array[3];
  3897. }
  3898. if (target.GetComponent<Rigidbody>() != null)
  3899. {
  3900. Vector3 position2 = target.transform.position;
  3901. target.transform.position = position;
  3902. target.GetComponent<Rigidbody>().MovePosition(position2);
  3903. }
  3904. }
  3905. public static void MoveUpdate(GameObject target, Vector3 position, float time, string trackId)
  3906. {
  3907. AMTween.MoveUpdate(target, AMTween.Hash(new object[]
  3908. {
  3909. "trackid",
  3910. trackId,
  3911. "position",
  3912. position,
  3913. "time",
  3914. time
  3915. }));
  3916. }
  3917. public static void LookUpdate(GameObject target, Hashtable args)
  3918. {
  3919. AMTween.CleanArgs(args);
  3920. Vector3[] array = new Vector3[5];
  3921. float num;
  3922. if (args.Contains("looktime"))
  3923. {
  3924. num = (float)args["looktime"];
  3925. num *= AMTween.Defaults.updateTimePercentage;
  3926. }
  3927. else if (args.Contains("time"))
  3928. {
  3929. num = (float)args["time"] * 0.15f;
  3930. num *= AMTween.Defaults.updateTimePercentage;
  3931. }
  3932. else
  3933. {
  3934. num = AMTween.Defaults.updateTime;
  3935. }
  3936. array[0] = target.transform.eulerAngles;
  3937. if (args.Contains("looktarget"))
  3938. {
  3939. if (args["looktarget"].GetType() == typeof(Transform))
  3940. {
  3941. Transform transform = target.transform;
  3942. Transform target2 = (Transform)args["looktarget"];
  3943. Vector3? vector = (Vector3?)args["up"];
  3944. transform.LookAt(target2, (vector == null) ? AMTween.Defaults.up : vector.Value);
  3945. }
  3946. else if (args["looktarget"].GetType() == typeof(Vector3))
  3947. {
  3948. Transform transform2 = target.transform;
  3949. Vector3 worldPosition = (Vector3)args["looktarget"];
  3950. Vector3? vector2 = (Vector3?)args["up"];
  3951. transform2.LookAt(worldPosition, (vector2 == null) ? AMTween.Defaults.up : vector2.Value);
  3952. }
  3953. array[1] = target.transform.eulerAngles;
  3954. target.transform.eulerAngles = array[0];
  3955. array[3].x = Mathf.SmoothDampAngle(array[0].x, array[1].x, ref array[2].x, num);
  3956. array[3].y = Mathf.SmoothDampAngle(array[0].y, array[1].y, ref array[2].y, num);
  3957. array[3].z = Mathf.SmoothDampAngle(array[0].z, array[1].z, ref array[2].z, num);
  3958. target.transform.eulerAngles = array[3];
  3959. if (args.Contains("axis"))
  3960. {
  3961. array[4] = target.transform.eulerAngles;
  3962. string text = (string)args["axis"];
  3963. if (text != null)
  3964. {
  3965. if (!(text == "x"))
  3966. {
  3967. if (!(text == "y"))
  3968. {
  3969. if (text == "z")
  3970. {
  3971. array[4].x = array[0].x;
  3972. array[4].y = array[0].y;
  3973. }
  3974. }
  3975. else
  3976. {
  3977. array[4].x = array[0].x;
  3978. array[4].z = array[0].z;
  3979. }
  3980. }
  3981. else
  3982. {
  3983. array[4].y = array[0].y;
  3984. array[4].z = array[0].z;
  3985. }
  3986. }
  3987. target.transform.eulerAngles = array[4];
  3988. }
  3989. return;
  3990. }
  3991. Debug.LogError("AMTween Error: LookUpdate needs a 'looktarget' property!");
  3992. }
  3993. public static void LookUpdate(GameObject target, Vector3 looktarget, float time, string trackId)
  3994. {
  3995. AMTween.LookUpdate(target, AMTween.Hash(new object[]
  3996. {
  3997. "trackid",
  3998. trackId,
  3999. "looktarget",
  4000. looktarget,
  4001. "time",
  4002. time
  4003. }));
  4004. }
  4005. public static void SetMorph(Component component, MethodInfo setPercent, float[] morph)
  4006. {
  4007. for (int i = 0; i < morph.Length; i++)
  4008. {
  4009. setPercent.Invoke(component, new object[]
  4010. {
  4011. i,
  4012. morph[i]
  4013. });
  4014. }
  4015. }
  4016. public static Texture2D LoadTexture2D(string name)
  4017. {
  4018. return (Texture2D)Resources.Load(name);
  4019. }
  4020. public Vector3 getPositionAfter(float time)
  4021. {
  4022. return this.getPositionAtPercentage(this.getIncPercentageBy(time));
  4023. }
  4024. public Vector3 getPositionAtPercentage(float percentage)
  4025. {
  4026. float value = this.ease(0f, 1f, percentage, this.easeCurve);
  4027. return this.path.Interp(Mathf.Clamp(value, 0f, 1f));
  4028. }
  4029. public static void ShowColor(Color color)
  4030. {
  4031. AMTween.cf.keepAliveColor = true;
  4032. AMTween.cf.colorTex = color;
  4033. AMTween.cf.hasColorTex = true;
  4034. AMTween.cf.hasColorBG = false;
  4035. AMTween.cf.mode = 0;
  4036. AMTween.cf.value = 1f;
  4037. AMTween.cf.isReset = false;
  4038. }
  4039. public static void SetTopCamera(Camera top, Camera bottom)
  4040. {
  4041. if (top)
  4042. {
  4043. top.depth = 0f;
  4044. }
  4045. if (bottom)
  4046. {
  4047. bottom.depth = -1f;
  4048. }
  4049. }
  4050. public static void SetTopCamera(Camera top, Camera[] all)
  4051. {
  4052. top.depth = 0f;
  4053. foreach (Camera camera in all)
  4054. {
  4055. if (camera != top)
  4056. {
  4057. camera.depth = -1f;
  4058. }
  4059. }
  4060. }
  4061. private void CameraFadeCleanup()
  4062. {
  4063. if ((string)this.tweenArguments["type"] != "camerafade")
  4064. {
  4065. return;
  4066. }
  4067. Color? color = null;
  4068. if ((bool)this.tweenArguments["reversed"] && this.tweenArguments.Contains("camera2"))
  4069. {
  4070. AMTween.SetTopCamera((Camera)this.tweenArguments["camera2"], (Camera[])this.tweenArguments["allcameras"]);
  4071. }
  4072. if (this.tweenArguments.Contains("color2"))
  4073. {
  4074. color = new Color?((Color)this.tweenArguments["color2"]);
  4075. }
  4076. if (color != null)
  4077. {
  4078. AMTween.cf.keepAliveColor = true;
  4079. AMTween.cf.hasColorTex = true;
  4080. AMTween.cf.hasColorBG = false;
  4081. AMTween.cf.colorTex = color.Value;
  4082. AMTween.cf.mode = 0;
  4083. AMTween.cf.value = 1f;
  4084. }
  4085. else
  4086. {
  4087. AMCameraFade.reset();
  4088. }
  4089. if ((bool)this.tweenArguments["userendertex"])
  4090. {
  4091. if (this.tweenArguments.Contains("camera1"))
  4092. {
  4093. (this.tweenArguments["camera1"] as Camera).targetTexture = null;
  4094. }
  4095. if (this.tweenArguments.Contains("camera2"))
  4096. {
  4097. (this.tweenArguments["camera2"] as Camera).targetTexture = null;
  4098. }
  4099. }
  4100. if (AMCameraFade.hasInstance())
  4101. {
  4102. AMTween.cf.clearTexture2D();
  4103. AMTween.cf.keepAlives--;
  4104. }
  4105. }
  4106. public static Texture2D GetScreenTexture()
  4107. {
  4108. Texture2D texture2D = new Texture2D(Screen.width, Screen.height, TextureFormat.RGB24, false);
  4109. texture2D.ReadPixels(new Rect(0f, 0f, (float)Screen.width, (float)Screen.height), 0, 0, false);
  4110. texture2D.Apply();
  4111. return texture2D;
  4112. }
  4113. public static AnimationCurve GenerateCurve(float[] keyFrameInfo)
  4114. {
  4115. AnimationCurve animationCurve = new AnimationCurve();
  4116. if (keyFrameInfo.Length % 4 != 0)
  4117. {
  4118. Debug.LogError("AMTween: GenerateCurve requires keyframe information as a multiple of 4. (time, value, inTangent, outTangent)");
  4119. return animationCurve;
  4120. }
  4121. for (int i = 0; i < keyFrameInfo.Length; i += 4)
  4122. {
  4123. animationCurve.AddKey(new Keyframe(keyFrameInfo[i], keyFrameInfo[i + 1], keyFrameInfo[i + 2], keyFrameInfo[i + 3]));
  4124. }
  4125. return animationCurve;
  4126. }
  4127. public static float PathLength(Transform[] path)
  4128. {
  4129. Vector3[] array = new Vector3[path.Length];
  4130. float num = 0f;
  4131. for (int i = 0; i < path.Length; i++)
  4132. {
  4133. array[i] = path[i].position;
  4134. }
  4135. Vector3[] pts = AMTween.PathControlPointGenerator(array);
  4136. Vector3 a = AMTween.Interp(pts, 0f);
  4137. int num2 = path.Length * 20;
  4138. for (int j = 1; j <= num2; j++)
  4139. {
  4140. float t = (float)j / (float)num2;
  4141. Vector3 vector = AMTween.Interp(pts, t);
  4142. num += Vector3.Distance(a, vector);
  4143. a = vector;
  4144. }
  4145. return num;
  4146. }
  4147. public static float PathLength(Vector3[] path)
  4148. {
  4149. float num = 0f;
  4150. Vector3[] pts = AMTween.PathControlPointGenerator(path);
  4151. Vector3 a = AMTween.Interp(pts, 0f);
  4152. int num2 = path.Length * 20;
  4153. for (int i = 1; i <= num2; i++)
  4154. {
  4155. float t = (float)i / (float)num2;
  4156. Vector3 vector = AMTween.Interp(pts, t);
  4157. num += Vector3.Distance(a, vector);
  4158. a = vector;
  4159. }
  4160. return num;
  4161. }
  4162. public static Texture2D CameraTexture(Color color)
  4163. {
  4164. Texture2D texture2D = new Texture2D(Screen.width, Screen.height, TextureFormat.ARGB32, false);
  4165. Color[] array = new Color[Screen.width * Screen.height];
  4166. for (int i = 0; i < array.Length; i++)
  4167. {
  4168. array[i] = color;
  4169. }
  4170. texture2D.SetPixels(array);
  4171. texture2D.Apply();
  4172. return texture2D;
  4173. }
  4174. public static void PutOnPath(GameObject target, Vector3[] path, float percent)
  4175. {
  4176. target.transform.position = AMTween.Interp(AMTween.PathControlPointGenerator(path), percent);
  4177. }
  4178. public static void PutOnPath(Transform target, Vector3[] path, float percent)
  4179. {
  4180. target.position = AMTween.Interp(AMTween.PathControlPointGenerator(path), percent);
  4181. }
  4182. public static Vector3 PositionOnPath(Vector3[] path, float percent)
  4183. {
  4184. return AMTween.Interp(AMTween.PathControlPointGenerator(path), percent);
  4185. }
  4186. public static void PutOnPath(GameObject target, Transform[] path, float percent)
  4187. {
  4188. Vector3[] array = new Vector3[path.Length];
  4189. for (int i = 0; i < path.Length; i++)
  4190. {
  4191. array[i] = path[i].position;
  4192. }
  4193. target.transform.position = AMTween.Interp(AMTween.PathControlPointGenerator(array), percent);
  4194. }
  4195. public static void PutOnPath(Transform target, Transform[] path, float percent)
  4196. {
  4197. Vector3[] array = new Vector3[path.Length];
  4198. for (int i = 0; i < path.Length; i++)
  4199. {
  4200. array[i] = path[i].position;
  4201. }
  4202. target.position = AMTween.Interp(AMTween.PathControlPointGenerator(array), percent);
  4203. }
  4204. public static Vector3 PointOnPath(Transform[] path, float percent)
  4205. {
  4206. Vector3[] array = new Vector3[path.Length];
  4207. for (int i = 0; i < path.Length; i++)
  4208. {
  4209. array[i] = path[i].position;
  4210. }
  4211. return AMTween.Interp(AMTween.PathControlPointGenerator(array), percent);
  4212. }
  4213. public static void DrawLine(Vector3[] line)
  4214. {
  4215. if (line.Length > 0)
  4216. {
  4217. AMTween.DrawLineHelper(line, AMTween.Defaults.color, "gizmos");
  4218. }
  4219. }
  4220. public static void DrawLine(Vector3[] line, Color color)
  4221. {
  4222. if (line.Length > 0)
  4223. {
  4224. AMTween.DrawLineHelper(line, color, "gizmos");
  4225. }
  4226. }
  4227. public static void DrawLine(Transform[] line)
  4228. {
  4229. if (line.Length > 0)
  4230. {
  4231. Vector3[] array = new Vector3[line.Length];
  4232. for (int i = 0; i < line.Length; i++)
  4233. {
  4234. array[i] = line[i].position;
  4235. }
  4236. AMTween.DrawLineHelper(array, AMTween.Defaults.color, "gizmos");
  4237. }
  4238. }
  4239. public static void DrawLine(Transform[] line, Color color)
  4240. {
  4241. if (line.Length > 0)
  4242. {
  4243. Vector3[] array = new Vector3[line.Length];
  4244. for (int i = 0; i < line.Length; i++)
  4245. {
  4246. array[i] = line[i].position;
  4247. }
  4248. AMTween.DrawLineHelper(array, color, "gizmos");
  4249. }
  4250. }
  4251. public static void DrawLineGizmos(Vector3[] line)
  4252. {
  4253. if (line.Length > 0)
  4254. {
  4255. AMTween.DrawLineHelper(line, AMTween.Defaults.color, "gizmos");
  4256. }
  4257. }
  4258. public static void DrawLineGizmos(Vector3[] line, Color color)
  4259. {
  4260. if (line.Length > 0)
  4261. {
  4262. AMTween.DrawLineHelper(line, color, "gizmos");
  4263. }
  4264. }
  4265. public static void DrawLineGizmos(Transform[] line)
  4266. {
  4267. if (line.Length > 0)
  4268. {
  4269. Vector3[] array = new Vector3[line.Length];
  4270. for (int i = 0; i < line.Length; i++)
  4271. {
  4272. array[i] = line[i].position;
  4273. }
  4274. AMTween.DrawLineHelper(array, AMTween.Defaults.color, "gizmos");
  4275. }
  4276. }
  4277. public static void DrawLineGizmos(Transform[] line, Color color)
  4278. {
  4279. if (line.Length > 0)
  4280. {
  4281. Vector3[] array = new Vector3[line.Length];
  4282. for (int i = 0; i < line.Length; i++)
  4283. {
  4284. array[i] = line[i].position;
  4285. }
  4286. AMTween.DrawLineHelper(array, color, "gizmos");
  4287. }
  4288. }
  4289. public static void DrawLineHandles(Vector3[] line)
  4290. {
  4291. if (line.Length > 0)
  4292. {
  4293. AMTween.DrawLineHelper(line, AMTween.Defaults.color, "handles");
  4294. }
  4295. }
  4296. public static void DrawLineHandles(Vector3[] line, Color color)
  4297. {
  4298. if (line.Length > 0)
  4299. {
  4300. AMTween.DrawLineHelper(line, color, "handles");
  4301. }
  4302. }
  4303. public static void DrawLineHandles(Transform[] line)
  4304. {
  4305. if (line.Length > 0)
  4306. {
  4307. Vector3[] array = new Vector3[line.Length];
  4308. for (int i = 0; i < line.Length; i++)
  4309. {
  4310. array[i] = line[i].position;
  4311. }
  4312. AMTween.DrawLineHelper(array, AMTween.Defaults.color, "handles");
  4313. }
  4314. }
  4315. public static void DrawLineHandles(Transform[] line, Color color)
  4316. {
  4317. if (line.Length > 0)
  4318. {
  4319. Vector3[] array = new Vector3[line.Length];
  4320. for (int i = 0; i < line.Length; i++)
  4321. {
  4322. array[i] = line[i].position;
  4323. }
  4324. AMTween.DrawLineHelper(array, color, "handles");
  4325. }
  4326. }
  4327. public static Vector3 PointOnPath(Vector3[] path, float percent)
  4328. {
  4329. return AMTween.Interp(AMTween.PathControlPointGenerator(path), percent);
  4330. }
  4331. public static void DrawPath(Vector3[] path)
  4332. {
  4333. if (path.Length > 0)
  4334. {
  4335. AMTween.DrawPathHelper(path, AMTween.Defaults.color, "gizmos");
  4336. }
  4337. }
  4338. public static void DrawPath(Vector3[] path, Color color)
  4339. {
  4340. if (path.Length > 0)
  4341. {
  4342. AMTween.DrawPathHelper(path, color, "gizmos");
  4343. }
  4344. }
  4345. public static void DrawPath(Transform[] path)
  4346. {
  4347. if (path.Length > 0)
  4348. {
  4349. Vector3[] array = new Vector3[path.Length];
  4350. for (int i = 0; i < path.Length; i++)
  4351. {
  4352. array[i] = path[i].position;
  4353. }
  4354. AMTween.DrawPathHelper(array, AMTween.Defaults.color, "gizmos");
  4355. }
  4356. }
  4357. public static void DrawPath(Transform[] path, Color color)
  4358. {
  4359. if (path.Length > 0)
  4360. {
  4361. Vector3[] array = new Vector3[path.Length];
  4362. for (int i = 0; i < path.Length; i++)
  4363. {
  4364. array[i] = path[i].position;
  4365. }
  4366. AMTween.DrawPathHelper(array, color, "gizmos");
  4367. }
  4368. }
  4369. public static void DrawPathGizmos(Vector3[] path)
  4370. {
  4371. if (path.Length > 0)
  4372. {
  4373. AMTween.DrawPathHelper(path, AMTween.Defaults.color, "gizmos");
  4374. }
  4375. }
  4376. public static void DrawPathGizmos(Vector3[] path, Color color)
  4377. {
  4378. if (path.Length > 0)
  4379. {
  4380. AMTween.DrawPathHelper(path, color, "gizmos");
  4381. }
  4382. }
  4383. public static void DrawPathGizmos(Transform[] path)
  4384. {
  4385. if (path.Length > 0)
  4386. {
  4387. Vector3[] array = new Vector3[path.Length];
  4388. for (int i = 0; i < path.Length; i++)
  4389. {
  4390. array[i] = path[i].position;
  4391. }
  4392. AMTween.DrawPathHelper(array, AMTween.Defaults.color, "gizmos");
  4393. }
  4394. }
  4395. public static void DrawPathGizmos(Transform[] path, Color color)
  4396. {
  4397. if (path.Length > 0)
  4398. {
  4399. Vector3[] array = new Vector3[path.Length];
  4400. for (int i = 0; i < path.Length; i++)
  4401. {
  4402. array[i] = path[i].position;
  4403. }
  4404. AMTween.DrawPathHelper(array, color, "gizmos");
  4405. }
  4406. }
  4407. public static void DrawPathHandles(Vector3[] path)
  4408. {
  4409. if (path.Length > 0)
  4410. {
  4411. AMTween.DrawPathHelper(path, AMTween.Defaults.color, "handles");
  4412. }
  4413. }
  4414. public static void DrawPathHandles(Vector3[] path, Color color)
  4415. {
  4416. if (path.Length > 0)
  4417. {
  4418. AMTween.DrawPathHelper(path, color, "handles");
  4419. }
  4420. }
  4421. public static void DrawPathHandles(Transform[] path)
  4422. {
  4423. if (path.Length > 0)
  4424. {
  4425. Vector3[] array = new Vector3[path.Length];
  4426. for (int i = 0; i < path.Length; i++)
  4427. {
  4428. array[i] = path[i].position;
  4429. }
  4430. AMTween.DrawPathHelper(array, AMTween.Defaults.color, "handles");
  4431. }
  4432. }
  4433. public static void DrawPathHandles(Transform[] path, Color color)
  4434. {
  4435. if (path.Length > 0)
  4436. {
  4437. Vector3[] array = new Vector3[path.Length];
  4438. for (int i = 0; i < path.Length; i++)
  4439. {
  4440. array[i] = path[i].position;
  4441. }
  4442. AMTween.DrawPathHelper(array, color, "handles");
  4443. }
  4444. }
  4445. public static void CameraFadeDepth(int depth)
  4446. {
  4447. if (AMTween.cameraFade)
  4448. {
  4449. AMTween.cameraFade.transform.position = new Vector3(AMTween.cameraFade.transform.position.x, AMTween.cameraFade.transform.position.y, (float)depth);
  4450. }
  4451. }
  4452. public static void CameraFadeDestroy()
  4453. {
  4454. if (AMTween.cameraFade)
  4455. {
  4456. UnityEngine.Object.Destroy(AMTween.cameraFade);
  4457. }
  4458. }
  4459. public static void CameraFadeSwap(Texture2D texture)
  4460. {
  4461. if (AMTween.cameraFade)
  4462. {
  4463. AMTween.cameraFade.GetComponent<GUITexture>().texture = texture;
  4464. }
  4465. }
  4466. public static GameObject CameraFadeAdd(Texture2D texture, int depth)
  4467. {
  4468. if (AMTween.cameraFade)
  4469. {
  4470. return null;
  4471. }
  4472. AMTween.cameraFade = new GameObject("AMTween Camera Fade");
  4473. AMTween.cameraFade.transform.position = new Vector3(0.5f, 0.5f, (float)depth);
  4474. AMTween.cameraFade.AddComponent<GUITexture>();
  4475. AMTween.cameraFade.GetComponent<GUITexture>().texture = texture;
  4476. AMTween.cameraFade.GetComponent<GUITexture>().color = new Color(0.5f, 0.5f, 0.5f, 0f);
  4477. return AMTween.cameraFade;
  4478. }
  4479. public static GameObject CameraFadeAdd(Texture2D texture)
  4480. {
  4481. if (AMTween.cameraFade)
  4482. {
  4483. return null;
  4484. }
  4485. AMTween.cameraFade = new GameObject("AMTween Camera Fade");
  4486. AMTween.cameraFade.transform.position = new Vector3(0.5f, 0.5f, (float)AMTween.Defaults.cameraFadeDepth);
  4487. AMTween.cameraFade.AddComponent<GUITexture>();
  4488. AMTween.cameraFade.GetComponent<GUITexture>().texture = texture;
  4489. AMTween.cameraFade.GetComponent<GUITexture>().color = new Color(0.5f, 0.5f, 0.5f, 0f);
  4490. return AMTween.cameraFade;
  4491. }
  4492. public static GameObject CameraFadeAdd()
  4493. {
  4494. if (AMTween.cameraFade)
  4495. {
  4496. return null;
  4497. }
  4498. AMTween.cameraFade = new GameObject("AMTween Camera Fade");
  4499. AMTween.cameraFade.transform.position = new Vector3(0.5f, 0.5f, (float)AMTween.Defaults.cameraFadeDepth);
  4500. AMTween.cameraFade.AddComponent<GUITexture>();
  4501. AMTween.cameraFade.GetComponent<GUITexture>().texture = AMTween.CameraTexture(Color.black);
  4502. AMTween.cameraFade.GetComponent<GUITexture>().color = new Color(0.5f, 0.5f, 0.5f, 0f);
  4503. return AMTween.cameraFade;
  4504. }
  4505. public static void Resume(GameObject target)
  4506. {
  4507. Component[] components = target.GetComponents(typeof(AMTween));
  4508. foreach (AMTween amtween in components)
  4509. {
  4510. amtween.enabled = true;
  4511. amtween.resumeExtras();
  4512. }
  4513. }
  4514. public static void Resume(GameObject target, bool includechildren)
  4515. {
  4516. AMTween.Resume(target);
  4517. if (includechildren)
  4518. {
  4519. IEnumerator enumerator = target.transform.GetEnumerator();
  4520. try
  4521. {
  4522. while (enumerator.MoveNext())
  4523. {
  4524. object obj = enumerator.Current;
  4525. Transform transform = (Transform)obj;
  4526. AMTween.Resume(transform.gameObject, true);
  4527. }
  4528. }
  4529. finally
  4530. {
  4531. IDisposable disposable;
  4532. if ((disposable = (enumerator as IDisposable)) != null)
  4533. {
  4534. disposable.Dispose();
  4535. }
  4536. }
  4537. }
  4538. }
  4539. public static void Resume(GameObject target, string type)
  4540. {
  4541. Component[] components = target.GetComponents(typeof(AMTween));
  4542. foreach (AMTween amtween in components)
  4543. {
  4544. string text = amtween.type + amtween.method;
  4545. text = text.Substring(0, type.Length);
  4546. if (text.ToLower() == type.ToLower())
  4547. {
  4548. amtween.enabled = true;
  4549. }
  4550. }
  4551. }
  4552. public static void Resume(GameObject target, string type, bool includechildren)
  4553. {
  4554. Component[] components = target.GetComponents(typeof(AMTween));
  4555. foreach (AMTween amtween in components)
  4556. {
  4557. string text = amtween.type + amtween.method;
  4558. text = text.Substring(0, type.Length);
  4559. if (text.ToLower() == type.ToLower())
  4560. {
  4561. amtween.enabled = true;
  4562. }
  4563. }
  4564. if (includechildren)
  4565. {
  4566. IEnumerator enumerator = target.transform.GetEnumerator();
  4567. try
  4568. {
  4569. while (enumerator.MoveNext())
  4570. {
  4571. object obj = enumerator.Current;
  4572. Transform transform = (Transform)obj;
  4573. AMTween.Resume(transform.gameObject, type, true);
  4574. }
  4575. }
  4576. finally
  4577. {
  4578. IDisposable disposable;
  4579. if ((disposable = (enumerator as IDisposable)) != null)
  4580. {
  4581. disposable.Dispose();
  4582. }
  4583. }
  4584. }
  4585. }
  4586. public static void Resume()
  4587. {
  4588. for (int i = 0; i < AMTween.tweens_.Count; i++)
  4589. {
  4590. Hashtable hashtable = (Hashtable)AMTween.tweens_[i];
  4591. GameObject target = (GameObject)hashtable["target"];
  4592. AMTween.Resume(target);
  4593. }
  4594. }
  4595. public static void Resume(string type)
  4596. {
  4597. ArrayList arrayList = new ArrayList();
  4598. for (int i = 0; i < AMTween.tweens_.Count; i++)
  4599. {
  4600. Hashtable hashtable = (Hashtable)AMTween.tweens_[i];
  4601. GameObject value = (GameObject)hashtable["target"];
  4602. arrayList.Insert(arrayList.Count, value);
  4603. }
  4604. for (int j = 0; j < arrayList.Count; j++)
  4605. {
  4606. AMTween.Resume((GameObject)arrayList[j], type);
  4607. }
  4608. }
  4609. public static void Pause(GameObject target)
  4610. {
  4611. Component[] components = target.GetComponents(typeof(AMTween));
  4612. int num = 0;
  4613. foreach (AMTween amtween in components)
  4614. {
  4615. num++;
  4616. if (amtween.delay > 0f)
  4617. {
  4618. amtween.delay -= NTime.time - amtween.delayStarted;
  4619. amtween.StopCoroutine("TweenDelay");
  4620. }
  4621. amtween.pauseExtras();
  4622. amtween.isPaused = true;
  4623. amtween.enabled = false;
  4624. }
  4625. }
  4626. public static void Pause(GameObject target, bool includechildren)
  4627. {
  4628. AMTween.Pause(target);
  4629. if (includechildren)
  4630. {
  4631. IEnumerator enumerator = target.transform.GetEnumerator();
  4632. try
  4633. {
  4634. while (enumerator.MoveNext())
  4635. {
  4636. object obj = enumerator.Current;
  4637. Transform transform = (Transform)obj;
  4638. AMTween.Pause(transform.gameObject, true);
  4639. }
  4640. }
  4641. finally
  4642. {
  4643. IDisposable disposable;
  4644. if ((disposable = (enumerator as IDisposable)) != null)
  4645. {
  4646. disposable.Dispose();
  4647. }
  4648. }
  4649. }
  4650. }
  4651. public static void Pause(GameObject target, string type)
  4652. {
  4653. Component[] components = target.GetComponents(typeof(AMTween));
  4654. foreach (AMTween amtween in components)
  4655. {
  4656. string text = amtween.type + amtween.method;
  4657. text = text.Substring(0, type.Length);
  4658. if (text.ToLower() == type.ToLower())
  4659. {
  4660. if (amtween.delay > 0f)
  4661. {
  4662. amtween.delay -= NTime.time - amtween.delayStarted;
  4663. amtween.StopCoroutine("TweenDelay");
  4664. }
  4665. amtween.isPaused = true;
  4666. amtween.enabled = false;
  4667. }
  4668. }
  4669. }
  4670. public static void Pause(GameObject target, string type, bool includechildren)
  4671. {
  4672. Component[] components = target.GetComponents(typeof(AMTween));
  4673. foreach (AMTween amtween in components)
  4674. {
  4675. string text = amtween.type + amtween.method;
  4676. text = text.Substring(0, type.Length);
  4677. if (text.ToLower() == type.ToLower())
  4678. {
  4679. if (amtween.delay > 0f)
  4680. {
  4681. amtween.delay -= NTime.time - amtween.delayStarted;
  4682. amtween.StopCoroutine("TweenDelay");
  4683. }
  4684. amtween.isPaused = true;
  4685. amtween.enabled = false;
  4686. }
  4687. }
  4688. if (includechildren)
  4689. {
  4690. IEnumerator enumerator = target.transform.GetEnumerator();
  4691. try
  4692. {
  4693. while (enumerator.MoveNext())
  4694. {
  4695. object obj = enumerator.Current;
  4696. Transform transform = (Transform)obj;
  4697. AMTween.Pause(transform.gameObject, type, true);
  4698. }
  4699. }
  4700. finally
  4701. {
  4702. IDisposable disposable;
  4703. if ((disposable = (enumerator as IDisposable)) != null)
  4704. {
  4705. disposable.Dispose();
  4706. }
  4707. }
  4708. }
  4709. }
  4710. public static void Pause(string id, GameObject target)
  4711. {
  4712. Component[] components = target.GetComponents(typeof(AMTween));
  4713. foreach (AMTween amtween in components)
  4714. {
  4715. string a = amtween.id;
  4716. if (a == id)
  4717. {
  4718. if (amtween.delay > 0f)
  4719. {
  4720. amtween.delay -= NTime.time - amtween.delayStarted;
  4721. amtween.StopCoroutine("TweenDelay");
  4722. }
  4723. amtween.pauseExtras();
  4724. amtween.isPaused = true;
  4725. amtween.enabled = false;
  4726. }
  4727. }
  4728. }
  4729. public static void Pause()
  4730. {
  4731. for (int i = 0; i < AMTween.tweens_.Count; i++)
  4732. {
  4733. Hashtable hashtable = (Hashtable)AMTween.tweens_[i];
  4734. GameObject target = (GameObject)hashtable["target"];
  4735. string text = (string)hashtable["id"];
  4736. AMTween.Pause(text, target);
  4737. }
  4738. }
  4739. public static void Pause(string type)
  4740. {
  4741. ArrayList arrayList = new ArrayList();
  4742. for (int i = 0; i < AMTween.tweens_.Count; i++)
  4743. {
  4744. Hashtable hashtable = (Hashtable)AMTween.tweens_[i];
  4745. GameObject value = (GameObject)hashtable["target"];
  4746. arrayList.Insert(arrayList.Count, value);
  4747. }
  4748. for (int j = 0; j < arrayList.Count; j++)
  4749. {
  4750. AMTween.Pause((GameObject)arrayList[j], type);
  4751. }
  4752. }
  4753. public static int Count()
  4754. {
  4755. return AMTween.tweens_.Count;
  4756. }
  4757. public static int Count(string type)
  4758. {
  4759. int num = 0;
  4760. for (int i = 0; i < AMTween.tweens_.Count; i++)
  4761. {
  4762. Hashtable hashtable = (Hashtable)AMTween.tweens_[i];
  4763. string text = (string)hashtable["type"] + (string)hashtable["method"];
  4764. text = text.Substring(0, type.Length);
  4765. if (text.ToLower() == type.ToLower())
  4766. {
  4767. num++;
  4768. }
  4769. }
  4770. return num;
  4771. }
  4772. public static int Count(GameObject target)
  4773. {
  4774. Component[] components = target.GetComponents(typeof(AMTween));
  4775. return components.Length;
  4776. }
  4777. public static int Count(GameObject target, string type)
  4778. {
  4779. int num = 0;
  4780. Component[] components = target.GetComponents(typeof(AMTween));
  4781. foreach (AMTween amtween in components)
  4782. {
  4783. string text = amtween.type + amtween.method;
  4784. text = text.Substring(0, type.Length);
  4785. if (text.ToLower() == type.ToLower())
  4786. {
  4787. num++;
  4788. }
  4789. }
  4790. return num;
  4791. }
  4792. public static void StartDisabled()
  4793. {
  4794. IEnumerator enumerator = AMTween.disabledTweens.GetEnumerator();
  4795. try
  4796. {
  4797. while (enumerator.MoveNext())
  4798. {
  4799. object obj = enumerator.Current;
  4800. AMTween amtween = (AMTween)obj;
  4801. amtween.enabled = true;
  4802. }
  4803. }
  4804. finally
  4805. {
  4806. IDisposable disposable;
  4807. if ((disposable = (enumerator as IDisposable)) != null)
  4808. {
  4809. disposable.Dispose();
  4810. }
  4811. }
  4812. AMTween.disabledTweens = new ArrayList();
  4813. }
  4814. public static void Stop()
  4815. {
  4816. ArrayList arrayList = new ArrayList(AMTween.tweens_);
  4817. for (int i = 0; i < arrayList.Count; i++)
  4818. {
  4819. Hashtable hashtable = (Hashtable)arrayList[i];
  4820. GameObject target = (GameObject)hashtable["target"];
  4821. AMTween.Stop(target);
  4822. }
  4823. AMTween.tweens_.Clear();
  4824. }
  4825. public static void Stop(string type)
  4826. {
  4827. ArrayList arrayList = new ArrayList();
  4828. for (int i = 0; i < AMTween.tweens_.Count; i++)
  4829. {
  4830. Hashtable hashtable = (Hashtable)AMTween.tweens_[i];
  4831. GameObject value = (GameObject)hashtable["target"];
  4832. arrayList.Insert(arrayList.Count, value);
  4833. }
  4834. for (int j = 0; j < arrayList.Count; j++)
  4835. {
  4836. AMTween.Stop((GameObject)arrayList[j], type);
  4837. }
  4838. }
  4839. public static void StopByName(string name)
  4840. {
  4841. ArrayList arrayList = new ArrayList();
  4842. for (int i = 0; i < AMTween.tweens_.Count; i++)
  4843. {
  4844. Hashtable hashtable = (Hashtable)AMTween.tweens_[i];
  4845. GameObject value = (GameObject)hashtable["target"];
  4846. arrayList.Insert(arrayList.Count, value);
  4847. }
  4848. for (int j = 0; j < arrayList.Count; j++)
  4849. {
  4850. AMTween.StopByName((GameObject)arrayList[j], name);
  4851. }
  4852. }
  4853. public static void Stop(GameObject target)
  4854. {
  4855. if (!target)
  4856. {
  4857. return;
  4858. }
  4859. Component[] components = target.GetComponents(typeof(AMTween));
  4860. foreach (AMTween amtween in components)
  4861. {
  4862. amtween.Dispose();
  4863. }
  4864. }
  4865. public static void Stop(GameObject target, bool includechildren)
  4866. {
  4867. AMTween.Stop(target);
  4868. if (includechildren)
  4869. {
  4870. IEnumerator enumerator = target.transform.GetEnumerator();
  4871. try
  4872. {
  4873. while (enumerator.MoveNext())
  4874. {
  4875. object obj = enumerator.Current;
  4876. Transform transform = (Transform)obj;
  4877. AMTween.Stop(transform.gameObject, true);
  4878. }
  4879. }
  4880. finally
  4881. {
  4882. IDisposable disposable;
  4883. if ((disposable = (enumerator as IDisposable)) != null)
  4884. {
  4885. disposable.Dispose();
  4886. }
  4887. }
  4888. }
  4889. }
  4890. public static void Stop(GameObject target, string type)
  4891. {
  4892. Component[] components = target.GetComponents(typeof(AMTween));
  4893. foreach (AMTween amtween in components)
  4894. {
  4895. string text = amtween.type + amtween.method;
  4896. text = text.Substring(0, type.Length);
  4897. if (text.ToLower() == type.ToLower())
  4898. {
  4899. amtween.Dispose();
  4900. }
  4901. }
  4902. }
  4903. public static void StopByName(GameObject target, string name)
  4904. {
  4905. Component[] components = target.GetComponents(typeof(AMTween));
  4906. foreach (AMTween amtween in components)
  4907. {
  4908. if (amtween._name == name)
  4909. {
  4910. amtween.Dispose();
  4911. }
  4912. }
  4913. }
  4914. public static void Stop(GameObject target, string type, bool includechildren)
  4915. {
  4916. Component[] components = target.GetComponents(typeof(AMTween));
  4917. foreach (AMTween amtween in components)
  4918. {
  4919. string text = amtween.type + amtween.method;
  4920. text = text.Substring(0, type.Length);
  4921. if (text.ToLower() == type.ToLower())
  4922. {
  4923. amtween.Dispose();
  4924. }
  4925. }
  4926. if (includechildren)
  4927. {
  4928. IEnumerator enumerator = target.transform.GetEnumerator();
  4929. try
  4930. {
  4931. while (enumerator.MoveNext())
  4932. {
  4933. object obj = enumerator.Current;
  4934. Transform transform = (Transform)obj;
  4935. AMTween.Stop(transform.gameObject, type, true);
  4936. }
  4937. }
  4938. finally
  4939. {
  4940. IDisposable disposable;
  4941. if ((disposable = (enumerator as IDisposable)) != null)
  4942. {
  4943. disposable.Dispose();
  4944. }
  4945. }
  4946. }
  4947. }
  4948. public static void StopByName(GameObject target, string name, bool includechildren)
  4949. {
  4950. Component[] components = target.GetComponents(typeof(AMTween));
  4951. foreach (AMTween amtween in components)
  4952. {
  4953. if (amtween._name == name)
  4954. {
  4955. amtween.Dispose();
  4956. }
  4957. }
  4958. if (includechildren)
  4959. {
  4960. IEnumerator enumerator = target.transform.GetEnumerator();
  4961. try
  4962. {
  4963. while (enumerator.MoveNext())
  4964. {
  4965. object obj = enumerator.Current;
  4966. Transform transform = (Transform)obj;
  4967. AMTween.StopByName(transform.gameObject, name, true);
  4968. }
  4969. }
  4970. finally
  4971. {
  4972. IDisposable disposable;
  4973. if ((disposable = (enumerator as IDisposable)) != null)
  4974. {
  4975. disposable.Dispose();
  4976. }
  4977. }
  4978. }
  4979. }
  4980. public static Hashtable Hash(params object[] args)
  4981. {
  4982. Hashtable hashtable = new Hashtable(args.Length / 2);
  4983. if (args.Length % 2 != 0)
  4984. {
  4985. Debug.LogError("Tween Error: Hash requires an even number of arguments!");
  4986. return null;
  4987. }
  4988. for (int i = 0; i < args.Length - 1; i += 2)
  4989. {
  4990. if (hashtable.ContainsKey(args[i]))
  4991. {
  4992. Debug.LogError("duplicate !" + hashtable[i]);
  4993. }
  4994. hashtable.Add(args[i], args[i + 1]);
  4995. }
  4996. return hashtable;
  4997. }
  4998. private void Awake()
  4999. {
  5000. this.RetrieveArgs();
  5001. this.lastRealTime = NTime.realtimeSinceStartup;
  5002. }
  5003. private IEnumerator Start()
  5004. {
  5005. if (this.delay > 0f)
  5006. {
  5007. yield return base.StartCoroutine("TweenDelay");
  5008. }
  5009. this.TweenStart(true);
  5010. yield break;
  5011. }
  5012. private void Update()
  5013. {
  5014. if (this.isRunning && !this.physics)
  5015. {
  5016. if (!this.reverse)
  5017. {
  5018. if (this.percentage < 1f)
  5019. {
  5020. this.TweenUpdate();
  5021. }
  5022. else
  5023. {
  5024. this.TweenComplete(false);
  5025. }
  5026. }
  5027. else if (this.percentage > 0f)
  5028. {
  5029. this.TweenUpdate();
  5030. }
  5031. else
  5032. {
  5033. this.TweenComplete(false);
  5034. }
  5035. }
  5036. }
  5037. private void FixedUpdate()
  5038. {
  5039. if (this.isRunning && this.physics)
  5040. {
  5041. if (!this.reverse)
  5042. {
  5043. if (this.percentage < 1f)
  5044. {
  5045. this.TweenUpdate();
  5046. }
  5047. else
  5048. {
  5049. this.TweenComplete(false);
  5050. }
  5051. }
  5052. else if (this.percentage > 0f)
  5053. {
  5054. this.TweenUpdate();
  5055. }
  5056. else
  5057. {
  5058. this.TweenComplete(false);
  5059. }
  5060. }
  5061. }
  5062. private void LateUpdate()
  5063. {
  5064. if (this.tweenArguments.Contains("looktarget") && this.isRunning && (this.type == "move" || this.type == "shake" || this.type == "punch"))
  5065. {
  5066. AMTween.LookUpdate(base.gameObject, this.tweenArguments);
  5067. }
  5068. }
  5069. private void OnEnable()
  5070. {
  5071. if (this.isRunning)
  5072. {
  5073. this.EnableKinematic();
  5074. }
  5075. if (this.isPaused)
  5076. {
  5077. this.isPaused = false;
  5078. if (this.delay > 0f)
  5079. {
  5080. this.wasPaused = true;
  5081. this.ResumeDelay();
  5082. }
  5083. }
  5084. }
  5085. private void OnDisable()
  5086. {
  5087. this.DisableKinematic();
  5088. }
  5089. private static void DrawLineHelper(Vector3[] line, Color color, string method)
  5090. {
  5091. Gizmos.color = color;
  5092. for (int i = 0; i < line.Length - 1; i++)
  5093. {
  5094. if (method == "gizmos")
  5095. {
  5096. Gizmos.DrawLine(line[i], line[i + 1]);
  5097. }
  5098. else if (method == "handles")
  5099. {
  5100. Debug.LogError("AMTween Error: Drawing a line with Handles is temporarily disabled because of compatability issues with Unity 2.6!");
  5101. }
  5102. }
  5103. }
  5104. private static void DrawPathHelper(Vector3[] path, Color color, string method)
  5105. {
  5106. Vector3[] pts = AMTween.PathControlPointGenerator(path);
  5107. Vector3 to = AMTween.Interp(pts, 0f);
  5108. Gizmos.color = color;
  5109. int num = path.Length * 20;
  5110. for (int i = 1; i <= num; i++)
  5111. {
  5112. float t = (float)i / (float)num;
  5113. Vector3 vector = AMTween.Interp(pts, t);
  5114. if (method == "gizmos")
  5115. {
  5116. Gizmos.DrawLine(vector, to);
  5117. }
  5118. else if (method == "handles")
  5119. {
  5120. Debug.LogError("AMTween Error: Drawing a path with Handles is temporarily disabled because of compatability issues with Unity 2.6!");
  5121. }
  5122. to = vector;
  5123. }
  5124. }
  5125. private static Vector3[] PathControlPointGenerator(Vector3[] path)
  5126. {
  5127. int num = 2;
  5128. Vector3[] array = new Vector3[path.Length + num];
  5129. Array.Copy(path, 0, array, 1, path.Length);
  5130. array[0] = array[1] + (array[1] - array[2]);
  5131. array[array.Length - 1] = array[array.Length - 2] + (array[array.Length - 2] - array[array.Length - 3]);
  5132. if (array[1] == array[array.Length - 2])
  5133. {
  5134. Vector3[] array2 = new Vector3[array.Length];
  5135. Array.Copy(array, array2, array.Length);
  5136. array2[0] = array2[array2.Length - 3];
  5137. array2[array2.Length - 1] = array2[2];
  5138. array = new Vector3[array2.Length];
  5139. Array.Copy(array2, array, array2.Length);
  5140. }
  5141. return array;
  5142. }
  5143. private static Vector3 Interp(Vector3[] pts, float t)
  5144. {
  5145. int num = pts.Length - 3;
  5146. int num2 = Mathf.Min(Mathf.FloorToInt(t * (float)num), num - 1);
  5147. float num3 = t * (float)num - (float)num2;
  5148. Vector3 a = pts[num2];
  5149. Vector3 a2 = pts[num2 + 1];
  5150. Vector3 vector = pts[num2 + 2];
  5151. Vector3 b = pts[num2 + 3];
  5152. return 0.5f * ((-a + 3f * a2 - 3f * vector + b) * (num3 * num3 * num3) + (2f * a - 5f * a2 + 4f * vector - b) * (num3 * num3) + (-a + vector) * num3 + 2f * a2);
  5153. }
  5154. private static void Launch(GameObject target, Hashtable args)
  5155. {
  5156. if (!args.Contains("id"))
  5157. {
  5158. args["id"] = AMTween.GenerateID();
  5159. }
  5160. if (!args.Contains("target"))
  5161. {
  5162. args["target"] = target;
  5163. }
  5164. AMTween.tweens_.Insert(0, args);
  5165. target.AddComponent<AMTween>();
  5166. }
  5167. private static void Launch(Component component, Hashtable args)
  5168. {
  5169. if (!args.Contains("id"))
  5170. {
  5171. args["id"] = AMTween.GenerateID();
  5172. }
  5173. if (!args.Contains("component"))
  5174. {
  5175. args["component"] = component;
  5176. }
  5177. args["target"] = component.gameObject;
  5178. AMTween.tweens_.Insert(0, args);
  5179. component.gameObject.AddComponent<AMTween>();
  5180. }
  5181. private static Hashtable CleanArgs(Hashtable args)
  5182. {
  5183. Hashtable hashtable = new Hashtable(args.Count);
  5184. Hashtable hashtable2 = new Hashtable(args.Count);
  5185. IDictionaryEnumerator enumerator = args.GetEnumerator();
  5186. try
  5187. {
  5188. while (enumerator.MoveNext())
  5189. {
  5190. object obj = enumerator.Current;
  5191. DictionaryEntry dictionaryEntry = (DictionaryEntry)obj;
  5192. hashtable.Add(dictionaryEntry.Key, dictionaryEntry.Value);
  5193. }
  5194. }
  5195. finally
  5196. {
  5197. IDisposable disposable;
  5198. if ((disposable = (enumerator as IDisposable)) != null)
  5199. {
  5200. disposable.Dispose();
  5201. }
  5202. }
  5203. IDictionaryEnumerator enumerator2 = hashtable.GetEnumerator();
  5204. try
  5205. {
  5206. while (enumerator2.MoveNext())
  5207. {
  5208. object obj2 = enumerator2.Current;
  5209. DictionaryEntry dictionaryEntry2 = (DictionaryEntry)obj2;
  5210. if (dictionaryEntry2.Value != null)
  5211. {
  5212. if (dictionaryEntry2.Value.GetType() == typeof(int))
  5213. {
  5214. int num = (int)dictionaryEntry2.Value;
  5215. float num2 = (float)num;
  5216. args[dictionaryEntry2.Key] = num2;
  5217. }
  5218. if (dictionaryEntry2.Value.GetType() == typeof(double))
  5219. {
  5220. double num3 = (double)dictionaryEntry2.Value;
  5221. float num4 = (float)num3;
  5222. args[dictionaryEntry2.Key] = num4;
  5223. }
  5224. }
  5225. }
  5226. }
  5227. finally
  5228. {
  5229. IDisposable disposable2;
  5230. if ((disposable2 = (enumerator2 as IDisposable)) != null)
  5231. {
  5232. disposable2.Dispose();
  5233. }
  5234. }
  5235. IDictionaryEnumerator enumerator3 = args.GetEnumerator();
  5236. try
  5237. {
  5238. while (enumerator3.MoveNext())
  5239. {
  5240. object obj3 = enumerator3.Current;
  5241. DictionaryEntry dictionaryEntry3 = (DictionaryEntry)obj3;
  5242. hashtable2.Add(dictionaryEntry3.Key.ToString().ToLower(), dictionaryEntry3.Value);
  5243. }
  5244. }
  5245. finally
  5246. {
  5247. IDisposable disposable3;
  5248. if ((disposable3 = (enumerator3 as IDisposable)) != null)
  5249. {
  5250. disposable3.Dispose();
  5251. }
  5252. }
  5253. args = hashtable2;
  5254. return args;
  5255. }
  5256. private static string GenerateID()
  5257. {
  5258. int num = 15;
  5259. char[] array = new char[]
  5260. {
  5261. 'a',
  5262. 'b',
  5263. 'c',
  5264. 'd',
  5265. 'e',
  5266. 'f',
  5267. 'g',
  5268. 'h',
  5269. 'i',
  5270. 'j',
  5271. 'k',
  5272. 'l',
  5273. 'm',
  5274. 'n',
  5275. 'o',
  5276. 'p',
  5277. 'q',
  5278. 'r',
  5279. 's',
  5280. 't',
  5281. 'u',
  5282. 'v',
  5283. 'w',
  5284. 'x',
  5285. 'y',
  5286. 'z',
  5287. 'A',
  5288. 'B',
  5289. 'C',
  5290. 'D',
  5291. 'E',
  5292. 'F',
  5293. 'G',
  5294. 'H',
  5295. 'I',
  5296. 'J',
  5297. 'K',
  5298. 'L',
  5299. 'M',
  5300. 'N',
  5301. 'O',
  5302. 'P',
  5303. 'Q',
  5304. 'R',
  5305. 'S',
  5306. 'T',
  5307. 'U',
  5308. 'V',
  5309. 'W',
  5310. 'X',
  5311. 'Y',
  5312. 'Z',
  5313. '0',
  5314. '1',
  5315. '2',
  5316. '3',
  5317. '4',
  5318. '5',
  5319. '6',
  5320. '7',
  5321. '8'
  5322. };
  5323. int max = array.Length - 1;
  5324. string text = string.Empty;
  5325. for (int i = 0; i < num; i++)
  5326. {
  5327. text += array[(int)Mathf.Floor((float)UnityEngine.Random.Range(0, max))];
  5328. }
  5329. return text;
  5330. }
  5331. private void RetrieveArgs()
  5332. {
  5333. IEnumerator enumerator = AMTween.tweens_.GetEnumerator();
  5334. try
  5335. {
  5336. while (enumerator.MoveNext())
  5337. {
  5338. object obj = enumerator.Current;
  5339. Hashtable hashtable = (Hashtable)obj;
  5340. if ((GameObject)hashtable["target"] == base.gameObject)
  5341. {
  5342. this.tweenArguments = hashtable;
  5343. break;
  5344. }
  5345. }
  5346. }
  5347. finally
  5348. {
  5349. IDisposable disposable;
  5350. if ((disposable = (enumerator as IDisposable)) != null)
  5351. {
  5352. disposable.Dispose();
  5353. }
  5354. }
  5355. this.id = (string)this.tweenArguments["id"];
  5356. this.type = (string)this.tweenArguments["type"];
  5357. this._name = (string)this.tweenArguments["name"];
  5358. this.method = (string)this.tweenArguments["method"];
  5359. if (this.tweenArguments.Contains("time"))
  5360. {
  5361. this.time = (float)this.tweenArguments["time"];
  5362. }
  5363. else
  5364. {
  5365. this.time = AMTween.Defaults.time;
  5366. }
  5367. if (base.GetComponent<Rigidbody>() != null)
  5368. {
  5369. this.physics = true;
  5370. }
  5371. if (this.tweenArguments.Contains("delay"))
  5372. {
  5373. this.delay = (float)this.tweenArguments["delay"];
  5374. if (this.delay < 0f)
  5375. {
  5376. this.runningTime = -this.delay;
  5377. this.delay = 0f;
  5378. }
  5379. }
  5380. else
  5381. {
  5382. this.delay = AMTween.Defaults.delay;
  5383. }
  5384. if (this.tweenArguments.Contains("namedcolorvalue"))
  5385. {
  5386. if (this.tweenArguments["namedcolorvalue"].GetType() == typeof(AMTween.NamedValueColor))
  5387. {
  5388. this.namedcolorvalue = (AMTween.NamedValueColor)this.tweenArguments["namedcolorvalue"];
  5389. }
  5390. else
  5391. {
  5392. try
  5393. {
  5394. this.namedcolorvalue = (AMTween.NamedValueColor)Enum.Parse(typeof(AMTween.NamedValueColor), (string)this.tweenArguments["namedcolorvalue"], true);
  5395. }
  5396. catch
  5397. {
  5398. Debug.LogWarning("AMTween: Unsupported namedcolorvalue supplied! Default will be used.");
  5399. this.namedcolorvalue = AMTween.NamedValueColor._Color;
  5400. }
  5401. }
  5402. }
  5403. else
  5404. {
  5405. this.namedcolorvalue = AMTween.Defaults.namedColorValue;
  5406. }
  5407. if (this.tweenArguments.Contains("looptype"))
  5408. {
  5409. if (this.tweenArguments["looptype"].GetType() == typeof(AMTween.LoopType))
  5410. {
  5411. this.loopType = (AMTween.LoopType)this.tweenArguments["looptype"];
  5412. }
  5413. else
  5414. {
  5415. try
  5416. {
  5417. this.loopType = (AMTween.LoopType)Enum.Parse(typeof(AMTween.LoopType), (string)this.tweenArguments["looptype"], true);
  5418. }
  5419. catch
  5420. {
  5421. Debug.LogWarning("AMTween: Unsupported loopType supplied! Default will be used.");
  5422. this.loopType = AMTween.LoopType.none;
  5423. }
  5424. }
  5425. }
  5426. else
  5427. {
  5428. this.loopType = AMTween.LoopType.none;
  5429. }
  5430. if (this.tweenArguments.Contains("easetype"))
  5431. {
  5432. if (this.tweenArguments["easetype"].GetType() == typeof(AMTween.EaseType))
  5433. {
  5434. this.easeType = (AMTween.EaseType)this.tweenArguments["easetype"];
  5435. }
  5436. else
  5437. {
  5438. try
  5439. {
  5440. this.easeType = (AMTween.EaseType)Enum.Parse(typeof(AMTween.EaseType), (string)this.tweenArguments["easetype"], true);
  5441. }
  5442. catch
  5443. {
  5444. Debug.LogWarning("AMTween: Unsupported easeType supplied! Default will be used.");
  5445. this.easeType = AMTween.Defaults.easeType;
  5446. }
  5447. }
  5448. }
  5449. else
  5450. {
  5451. this.easeType = AMTween.Defaults.easeType;
  5452. }
  5453. if (this.tweenArguments.Contains("easecurve") && this.tweenArguments["easecurve"] != null)
  5454. {
  5455. if (this.tweenArguments["easecurve"].GetType() == typeof(AnimationCurve))
  5456. {
  5457. this.easeCurve = (AnimationCurve)this.tweenArguments["easecurve"];
  5458. }
  5459. else
  5460. {
  5461. Debug.LogWarning("AMTween: Unsupported easeCurve supplied! Default will be used.");
  5462. this.easeCurve = null;
  5463. }
  5464. }
  5465. else
  5466. {
  5467. this.easeCurve = null;
  5468. }
  5469. if (this.tweenArguments.Contains("space"))
  5470. {
  5471. if (this.tweenArguments["space"].GetType() == typeof(Space))
  5472. {
  5473. this.space = (Space)this.tweenArguments["space"];
  5474. }
  5475. else
  5476. {
  5477. try
  5478. {
  5479. this.space = (Space)Enum.Parse(typeof(Space), (string)this.tweenArguments["space"], true);
  5480. }
  5481. catch
  5482. {
  5483. Debug.LogWarning("AMTween: Unsupported space supplied! Default will be used.");
  5484. this.space = AMTween.Defaults.space;
  5485. }
  5486. }
  5487. }
  5488. else
  5489. {
  5490. this.space = AMTween.Defaults.space;
  5491. }
  5492. if (this.tweenArguments.Contains("islocal"))
  5493. {
  5494. this.isLocal = (bool)this.tweenArguments["islocal"];
  5495. }
  5496. else
  5497. {
  5498. this.isLocal = AMTween.Defaults.isLocal;
  5499. }
  5500. if (this.tweenArguments.Contains("ignoretimescale"))
  5501. {
  5502. this.useRealTime = (bool)this.tweenArguments["ignoretimescale"];
  5503. }
  5504. else
  5505. {
  5506. this.useRealTime = AMTween.Defaults.useRealTime;
  5507. }
  5508. this.GetEasingFunction();
  5509. if (this.tweenArguments.Contains("runningtime"))
  5510. {
  5511. this.runningTime = (float)this.tweenArguments["runningtime"];
  5512. }
  5513. if (this.tweenArguments.Contains("disable") && (bool)this.tweenArguments["disable"])
  5514. {
  5515. AMTween.disabledTweens.Add(this);
  5516. base.enabled = false;
  5517. }
  5518. }
  5519. private void GetEasingFunction()
  5520. {
  5521. if (this.easeCurve != null)
  5522. {
  5523. this.ease = new AMTween.EasingFunction(AMTween.customEase);
  5524. return;
  5525. }
  5526. switch (this.easeType)
  5527. {
  5528. case AMTween.EaseType.easeInQuad:
  5529. this.ease = new AMTween.EasingFunction(AMTween.easeInQuad);
  5530. break;
  5531. case AMTween.EaseType.easeOutQuad:
  5532. this.ease = new AMTween.EasingFunction(AMTween.easeOutQuad);
  5533. break;
  5534. case AMTween.EaseType.easeInOutQuad:
  5535. this.ease = new AMTween.EasingFunction(AMTween.easeInOutQuad);
  5536. break;
  5537. case AMTween.EaseType.easeInCubic:
  5538. this.ease = new AMTween.EasingFunction(AMTween.easeInCubic);
  5539. break;
  5540. case AMTween.EaseType.easeOutCubic:
  5541. this.ease = new AMTween.EasingFunction(AMTween.easeOutCubic);
  5542. break;
  5543. case AMTween.EaseType.easeInOutCubic:
  5544. this.ease = new AMTween.EasingFunction(AMTween.easeInOutCubic);
  5545. break;
  5546. case AMTween.EaseType.easeInQuart:
  5547. this.ease = new AMTween.EasingFunction(AMTween.easeInQuart);
  5548. break;
  5549. case AMTween.EaseType.easeOutQuart:
  5550. this.ease = new AMTween.EasingFunction(AMTween.easeOutQuart);
  5551. break;
  5552. case AMTween.EaseType.easeInOutQuart:
  5553. this.ease = new AMTween.EasingFunction(AMTween.easeInOutQuart);
  5554. break;
  5555. case AMTween.EaseType.easeInQuint:
  5556. this.ease = new AMTween.EasingFunction(AMTween.easeInQuint);
  5557. break;
  5558. case AMTween.EaseType.easeOutQuint:
  5559. this.ease = new AMTween.EasingFunction(AMTween.easeOutQuint);
  5560. break;
  5561. case AMTween.EaseType.easeInOutQuint:
  5562. this.ease = new AMTween.EasingFunction(AMTween.easeInOutQuint);
  5563. break;
  5564. case AMTween.EaseType.easeInSine:
  5565. this.ease = new AMTween.EasingFunction(AMTween.easeInSine);
  5566. break;
  5567. case AMTween.EaseType.easeOutSine:
  5568. this.ease = new AMTween.EasingFunction(AMTween.easeOutSine);
  5569. break;
  5570. case AMTween.EaseType.easeInOutSine:
  5571. this.ease = new AMTween.EasingFunction(AMTween.easeInOutSine);
  5572. break;
  5573. case AMTween.EaseType.easeInExpo:
  5574. this.ease = new AMTween.EasingFunction(AMTween.easeInExpo);
  5575. break;
  5576. case AMTween.EaseType.easeOutExpo:
  5577. this.ease = new AMTween.EasingFunction(AMTween.easeOutExpo);
  5578. break;
  5579. case AMTween.EaseType.easeInOutExpo:
  5580. this.ease = new AMTween.EasingFunction(AMTween.easeInOutExpo);
  5581. break;
  5582. case AMTween.EaseType.easeInCirc:
  5583. this.ease = new AMTween.EasingFunction(AMTween.easeInCirc);
  5584. break;
  5585. case AMTween.EaseType.easeOutCirc:
  5586. this.ease = new AMTween.EasingFunction(AMTween.easeOutCirc);
  5587. break;
  5588. case AMTween.EaseType.easeInOutCirc:
  5589. this.ease = new AMTween.EasingFunction(AMTween.easeInOutCirc);
  5590. break;
  5591. case AMTween.EaseType.linear:
  5592. this.ease = new AMTween.EasingFunction(AMTween.linear);
  5593. break;
  5594. case AMTween.EaseType.spring:
  5595. this.ease = new AMTween.EasingFunction(AMTween.spring);
  5596. break;
  5597. case AMTween.EaseType.easeInBounce:
  5598. this.ease = new AMTween.EasingFunction(AMTween.easeInBounce);
  5599. break;
  5600. case AMTween.EaseType.easeOutBounce:
  5601. this.ease = new AMTween.EasingFunction(AMTween.easeOutBounce);
  5602. break;
  5603. case AMTween.EaseType.easeInOutBounce:
  5604. this.ease = new AMTween.EasingFunction(AMTween.easeInOutBounce);
  5605. break;
  5606. case AMTween.EaseType.easeInBack:
  5607. this.ease = new AMTween.EasingFunction(AMTween.easeInBack);
  5608. break;
  5609. case AMTween.EaseType.easeOutBack:
  5610. this.ease = new AMTween.EasingFunction(AMTween.easeOutBack);
  5611. break;
  5612. case AMTween.EaseType.easeInOutBack:
  5613. this.ease = new AMTween.EasingFunction(AMTween.easeInOutBack);
  5614. break;
  5615. case AMTween.EaseType.easeInElastic:
  5616. this.ease = new AMTween.EasingFunction(AMTween.easeInElastic);
  5617. break;
  5618. case AMTween.EaseType.easeOutElastic:
  5619. this.ease = new AMTween.EasingFunction(AMTween.easeOutElastic);
  5620. break;
  5621. case AMTween.EaseType.easeInOutElastic:
  5622. this.ease = new AMTween.EasingFunction(AMTween.easeInOutElastic);
  5623. break;
  5624. case AMTween.EaseType.stayStart:
  5625. this.ease = new AMTween.EasingFunction(AMTween.stayStart);
  5626. break;
  5627. case AMTween.EaseType.stayEnd:
  5628. this.ease = new AMTween.EasingFunction(AMTween.stayEnd);
  5629. break;
  5630. }
  5631. }
  5632. public static AMTween.EasingFunction GetEasingFunction(AMTween.EaseType eType)
  5633. {
  5634. switch (eType)
  5635. {
  5636. case AMTween.EaseType.easeInQuad:
  5637. return new AMTween.EasingFunction(AMTween.easeInQuad);
  5638. case AMTween.EaseType.easeOutQuad:
  5639. return new AMTween.EasingFunction(AMTween.easeOutQuad);
  5640. case AMTween.EaseType.easeInOutQuad:
  5641. return new AMTween.EasingFunction(AMTween.easeInOutQuad);
  5642. case AMTween.EaseType.easeInCubic:
  5643. return new AMTween.EasingFunction(AMTween.easeInCubic);
  5644. case AMTween.EaseType.easeOutCubic:
  5645. return new AMTween.EasingFunction(AMTween.easeOutCubic);
  5646. case AMTween.EaseType.easeInOutCubic:
  5647. return new AMTween.EasingFunction(AMTween.easeInOutCubic);
  5648. case AMTween.EaseType.easeInQuart:
  5649. return new AMTween.EasingFunction(AMTween.easeInQuart);
  5650. case AMTween.EaseType.easeOutQuart:
  5651. return new AMTween.EasingFunction(AMTween.easeOutQuart);
  5652. case AMTween.EaseType.easeInOutQuart:
  5653. return new AMTween.EasingFunction(AMTween.easeInOutQuart);
  5654. case AMTween.EaseType.easeInQuint:
  5655. return new AMTween.EasingFunction(AMTween.easeInQuint);
  5656. case AMTween.EaseType.easeOutQuint:
  5657. return new AMTween.EasingFunction(AMTween.easeOutQuint);
  5658. case AMTween.EaseType.easeInOutQuint:
  5659. return new AMTween.EasingFunction(AMTween.easeInOutQuint);
  5660. case AMTween.EaseType.easeInSine:
  5661. return new AMTween.EasingFunction(AMTween.easeInSine);
  5662. case AMTween.EaseType.easeOutSine:
  5663. return new AMTween.EasingFunction(AMTween.easeOutSine);
  5664. case AMTween.EaseType.easeInOutSine:
  5665. return new AMTween.EasingFunction(AMTween.easeInOutSine);
  5666. case AMTween.EaseType.easeInExpo:
  5667. return new AMTween.EasingFunction(AMTween.easeInExpo);
  5668. case AMTween.EaseType.easeOutExpo:
  5669. return new AMTween.EasingFunction(AMTween.easeOutExpo);
  5670. case AMTween.EaseType.easeInOutExpo:
  5671. return new AMTween.EasingFunction(AMTween.easeInOutExpo);
  5672. case AMTween.EaseType.easeInCirc:
  5673. return new AMTween.EasingFunction(AMTween.easeInCirc);
  5674. case AMTween.EaseType.easeOutCirc:
  5675. return new AMTween.EasingFunction(AMTween.easeOutCirc);
  5676. case AMTween.EaseType.easeInOutCirc:
  5677. return new AMTween.EasingFunction(AMTween.easeInOutCirc);
  5678. case AMTween.EaseType.linear:
  5679. return new AMTween.EasingFunction(AMTween.linear);
  5680. case AMTween.EaseType.spring:
  5681. return new AMTween.EasingFunction(AMTween.spring);
  5682. case AMTween.EaseType.easeInBounce:
  5683. return new AMTween.EasingFunction(AMTween.easeInBounce);
  5684. case AMTween.EaseType.easeOutBounce:
  5685. return new AMTween.EasingFunction(AMTween.easeOutBounce);
  5686. case AMTween.EaseType.easeInOutBounce:
  5687. return new AMTween.EasingFunction(AMTween.easeInOutBounce);
  5688. case AMTween.EaseType.easeInBack:
  5689. return new AMTween.EasingFunction(AMTween.easeInBack);
  5690. case AMTween.EaseType.easeOutBack:
  5691. return new AMTween.EasingFunction(AMTween.easeOutBack);
  5692. case AMTween.EaseType.easeInOutBack:
  5693. return new AMTween.EasingFunction(AMTween.easeInOutBack);
  5694. case AMTween.EaseType.easeInElastic:
  5695. return new AMTween.EasingFunction(AMTween.easeInElastic);
  5696. case AMTween.EaseType.easeOutElastic:
  5697. return new AMTween.EasingFunction(AMTween.easeOutElastic);
  5698. case AMTween.EaseType.easeInOutElastic:
  5699. return new AMTween.EasingFunction(AMTween.easeInOutElastic);
  5700. case AMTween.EaseType.stayStart:
  5701. return new AMTween.EasingFunction(AMTween.stayStart);
  5702. case AMTween.EaseType.stayEnd:
  5703. return new AMTween.EasingFunction(AMTween.stayEnd);
  5704. }
  5705. return new AMTween.EasingFunction(AMTween.linear);
  5706. }
  5707. private void UpdatePercentage()
  5708. {
  5709. if (this.useRealTime)
  5710. {
  5711. this.runningTime += NTime.realtimeSinceStartup - this.lastRealTime;
  5712. }
  5713. else
  5714. {
  5715. this.runningTime += NTime.deltaTime;
  5716. }
  5717. if (this.reverse)
  5718. {
  5719. this.percentage = 1f - this.runningTime / this.time;
  5720. }
  5721. else
  5722. {
  5723. this.percentage = this.runningTime / this.time;
  5724. }
  5725. this.lastRealTime = NTime.realtimeSinceStartup;
  5726. }
  5727. private float getIncPercentageBy(float _time)
  5728. {
  5729. return Mathf.Clamp01((this.runningTime + _time) / this.time);
  5730. }
  5731. private void CallBack(string callbackType)
  5732. {
  5733. if (this.tweenArguments.Contains(callbackType) && !this.tweenArguments.Contains("ischild"))
  5734. {
  5735. GameObject gameObject;
  5736. if (this.tweenArguments.Contains(callbackType + "target"))
  5737. {
  5738. gameObject = (GameObject)this.tweenArguments[callbackType + "target"];
  5739. }
  5740. else
  5741. {
  5742. gameObject = base.gameObject;
  5743. }
  5744. if (this.tweenArguments[callbackType].GetType() == typeof(string))
  5745. {
  5746. gameObject.SendMessage((string)this.tweenArguments[callbackType], this.tweenArguments[callbackType + "params"], SendMessageOptions.DontRequireReceiver);
  5747. }
  5748. else
  5749. {
  5750. Debug.LogError("AMTween Error: Callback method references must be passed as a String!");
  5751. UnityEngine.Object.Destroy(this);
  5752. }
  5753. }
  5754. }
  5755. public void Dispose()
  5756. {
  5757. for (int i = 0; i < AMTween.tweens_.Count; i++)
  5758. {
  5759. Hashtable hashtable = (Hashtable)AMTween.tweens_[i];
  5760. if ((string)hashtable["id"] == this.id)
  5761. {
  5762. AMTween.tweens_.RemoveAt(i);
  5763. break;
  5764. }
  5765. }
  5766. this.CameraFadeCleanup();
  5767. base.enabled = false;
  5768. this.isRunning = false;
  5769. UnityEngine.Object.Destroy(this);
  5770. }
  5771. private void ConflictCheck()
  5772. {
  5773. Component[] components = base.GetComponents(typeof(AMTween));
  5774. foreach (AMTween amtween in components)
  5775. {
  5776. if (this != amtween && amtween.isRunning && amtween.type == this.type && amtween.tweenArguments["trackid"] == this.tweenArguments["trackid"] && amtween.delay <= this.delay)
  5777. {
  5778. amtween.TweenComplete(true);
  5779. }
  5780. }
  5781. }
  5782. private void EnableKinematic()
  5783. {
  5784. }
  5785. private void DisableKinematic()
  5786. {
  5787. }
  5788. private void ResumeDelay()
  5789. {
  5790. base.StartCoroutine("TweenDelay");
  5791. }
  5792. public static float customEase(float start, float end, float value, AnimationCurve curve)
  5793. {
  5794. end -= start;
  5795. return end * curve.Evaluate(value) + start;
  5796. }
  5797. public static float linear(float start, float end, float value, AnimationCurve curve = null)
  5798. {
  5799. return Mathf.Lerp(start, end, value);
  5800. }
  5801. public static float clerp(float start, float end, float value)
  5802. {
  5803. float num = 0f;
  5804. float num2 = 360f;
  5805. float num3 = Mathf.Abs((num2 - num) / 2f);
  5806. float result;
  5807. if (end - start < -num3)
  5808. {
  5809. float num4 = (num2 - start + end) * value;
  5810. result = start + num4;
  5811. }
  5812. else if (end - start > num3)
  5813. {
  5814. float num4 = -(num2 - end + start) * value;
  5815. result = start + num4;
  5816. }
  5817. else
  5818. {
  5819. result = start + (end - start) * value;
  5820. }
  5821. return result;
  5822. }
  5823. public static float spring(float start, float end, float value, AnimationCurve curve = null)
  5824. {
  5825. value = Mathf.Clamp01(value);
  5826. value = (Mathf.Sin(value * 3.14159274f * (0.2f + 2.5f * value * value * value)) * Mathf.Pow(1f - value, 2.2f) + value) * (1f + 1.2f * (1f - value));
  5827. return start + (end - start) * value;
  5828. }
  5829. public static float stayStart(float start, float end, float value, AnimationCurve curve = null)
  5830. {
  5831. return start;
  5832. }
  5833. public static float stayEnd(float start, float end, float value, AnimationCurve curve = null)
  5834. {
  5835. return end;
  5836. }
  5837. public static float easeInQuad(float start, float end, float value, AnimationCurve curve = null)
  5838. {
  5839. end -= start;
  5840. return end * value * value + start;
  5841. }
  5842. public static float easeOutQuad(float start, float end, float value, AnimationCurve curve = null)
  5843. {
  5844. end -= start;
  5845. return -end * value * (value - 2f) + start;
  5846. }
  5847. public static float easeInOutQuad(float start, float end, float value, AnimationCurve curve = null)
  5848. {
  5849. value /= 0.5f;
  5850. end -= start;
  5851. if (value < 1f)
  5852. {
  5853. return end / 2f * value * value + start;
  5854. }
  5855. value -= 1f;
  5856. return -end / 2f * (value * (value - 2f) - 1f) + start;
  5857. }
  5858. public static float easeInCubic(float start, float end, float value, AnimationCurve curve = null)
  5859. {
  5860. end -= start;
  5861. return end * value * value * value + start;
  5862. }
  5863. public static float easeOutCubic(float start, float end, float value, AnimationCurve curve = null)
  5864. {
  5865. value -= 1f;
  5866. end -= start;
  5867. return end * (value * value * value + 1f) + start;
  5868. }
  5869. public static float easeInOutCubic(float start, float end, float value, AnimationCurve curve = null)
  5870. {
  5871. value /= 0.5f;
  5872. end -= start;
  5873. if (value < 1f)
  5874. {
  5875. return end / 2f * value * value * value + start;
  5876. }
  5877. value -= 2f;
  5878. return end / 2f * (value * value * value + 2f) + start;
  5879. }
  5880. public static float easeInQuart(float start, float end, float value, AnimationCurve curve = null)
  5881. {
  5882. end -= start;
  5883. return end * value * value * value * value + start;
  5884. }
  5885. public static float easeOutQuart(float start, float end, float value, AnimationCurve curve = null)
  5886. {
  5887. value -= 1f;
  5888. end -= start;
  5889. return -end * (value * value * value * value - 1f) + start;
  5890. }
  5891. public static float easeInOutQuart(float start, float end, float value, AnimationCurve curve = null)
  5892. {
  5893. value /= 0.5f;
  5894. end -= start;
  5895. if (value < 1f)
  5896. {
  5897. return end / 2f * value * value * value * value + start;
  5898. }
  5899. value -= 2f;
  5900. return -end / 2f * (value * value * value * value - 2f) + start;
  5901. }
  5902. public static float easeInQuint(float start, float end, float value, AnimationCurve curve = null)
  5903. {
  5904. end -= start;
  5905. return end * value * value * value * value * value + start;
  5906. }
  5907. public static float easeOutQuint(float start, float end, float value, AnimationCurve curve = null)
  5908. {
  5909. value -= 1f;
  5910. end -= start;
  5911. return end * (value * value * value * value * value + 1f) + start;
  5912. }
  5913. public static float easeInOutQuint(float start, float end, float value, AnimationCurve curve = null)
  5914. {
  5915. value /= 0.5f;
  5916. end -= start;
  5917. if (value < 1f)
  5918. {
  5919. return end / 2f * value * value * value * value * value + start;
  5920. }
  5921. value -= 2f;
  5922. return end / 2f * (value * value * value * value * value + 2f) + start;
  5923. }
  5924. public static float easeInSine(float start, float end, float value, AnimationCurve curve = null)
  5925. {
  5926. end -= start;
  5927. return -end * Mathf.Cos(value / 1f * 1.57079637f) + end + start;
  5928. }
  5929. public static float easeOutSine(float start, float end, float value, AnimationCurve curve = null)
  5930. {
  5931. end -= start;
  5932. return end * Mathf.Sin(value / 1f * 1.57079637f) + start;
  5933. }
  5934. public static float easeInOutSine(float start, float end, float value, AnimationCurve curve = null)
  5935. {
  5936. end -= start;
  5937. return -end / 2f * (Mathf.Cos(3.14159274f * value / 1f) - 1f) + start;
  5938. }
  5939. public static float easeInExpo(float start, float end, float value, AnimationCurve curve = null)
  5940. {
  5941. end -= start;
  5942. return end * Mathf.Pow(2f, 10f * (value / 1f - 1f)) + start;
  5943. }
  5944. public static float easeInExpoReveresed(float start, float end, float value, AnimationCurve curve = null)
  5945. {
  5946. end -= start;
  5947. return 1f + Mathf.Log(value - start) / (10f * Mathf.Log(2f));
  5948. }
  5949. public static float easeOutExpo(float start, float end, float value, AnimationCurve curve = null)
  5950. {
  5951. end -= start;
  5952. return end * (-Mathf.Pow(2f, -10f * value / 1f) + 1f) + start;
  5953. }
  5954. public static float easeInOutExpo(float start, float end, float value, AnimationCurve curve = null)
  5955. {
  5956. value /= 0.5f;
  5957. end -= start;
  5958. if (value < 1f)
  5959. {
  5960. return end / 2f * Mathf.Pow(2f, 10f * (value - 1f)) + start;
  5961. }
  5962. value -= 1f;
  5963. return end / 2f * (-Mathf.Pow(2f, -10f * value) + 2f) + start;
  5964. }
  5965. public static float easeInCirc(float start, float end, float value, AnimationCurve curve = null)
  5966. {
  5967. end -= start;
  5968. return -end * (Mathf.Sqrt(1f - value * value) - 1f) + start;
  5969. }
  5970. public static float easeOutCirc(float start, float end, float value, AnimationCurve curve = null)
  5971. {
  5972. value -= 1f;
  5973. end -= start;
  5974. return end * Mathf.Sqrt(1f - value * value) + start;
  5975. }
  5976. public static float easeInOutCirc(float start, float end, float value, AnimationCurve curve = null)
  5977. {
  5978. value /= 0.5f;
  5979. end -= start;
  5980. if (value < 1f)
  5981. {
  5982. return -end / 2f * (Mathf.Sqrt(1f - value * value) - 1f) + start;
  5983. }
  5984. value -= 2f;
  5985. return end / 2f * (Mathf.Sqrt(1f - value * value) + 1f) + start;
  5986. }
  5987. public static float easeInBounce(float start, float end, float value, AnimationCurve curve = null)
  5988. {
  5989. end -= start;
  5990. float num = 1f;
  5991. return end - AMTween.easeOutBounce(0f, end, num - value, null) + start;
  5992. }
  5993. public static float easeOutBounce(float start, float end, float value, AnimationCurve curve = null)
  5994. {
  5995. value /= 1f;
  5996. end -= start;
  5997. if (value < 0.363636374f)
  5998. {
  5999. return end * (7.5625f * value * value) + start;
  6000. }
  6001. if (value < 0.727272749f)
  6002. {
  6003. value -= 0.545454562f;
  6004. return end * (7.5625f * value * value + 0.75f) + start;
  6005. }
  6006. if ((double)value < 0.90909090909090906)
  6007. {
  6008. value -= 0.8181818f;
  6009. return end * (7.5625f * value * value + 0.9375f) + start;
  6010. }
  6011. value -= 0.954545438f;
  6012. return end * (7.5625f * value * value + 0.984375f) + start;
  6013. }
  6014. public static float easeInOutBounce(float start, float end, float value, AnimationCurve curve = null)
  6015. {
  6016. end -= start;
  6017. float num = 1f;
  6018. if (value < num / 2f)
  6019. {
  6020. return AMTween.easeInBounce(0f, end, value * 2f, null) * 0.5f + start;
  6021. }
  6022. return AMTween.easeOutBounce(0f, end, value * 2f - num, null) * 0.5f + end * 0.5f + start;
  6023. }
  6024. public static float easeInBack(float start, float end, float value, AnimationCurve curve = null)
  6025. {
  6026. end -= start;
  6027. value /= 1f;
  6028. float num = 1.70158f;
  6029. return end * value * value * ((num + 1f) * value - num) + start;
  6030. }
  6031. public static float easeOutBack(float start, float end, float value, AnimationCurve curve = null)
  6032. {
  6033. float num = 1.70158f;
  6034. end -= start;
  6035. value = value / 1f - 1f;
  6036. return end * (value * value * ((num + 1f) * value + num) + 1f) + start;
  6037. }
  6038. public static float easeInOutBack(float start, float end, float value, AnimationCurve curve = null)
  6039. {
  6040. float num = 1.70158f;
  6041. end -= start;
  6042. value /= 0.5f;
  6043. if (value < 1f)
  6044. {
  6045. num *= 1.525f;
  6046. return end / 2f * (value * value * ((num + 1f) * value - num)) + start;
  6047. }
  6048. value -= 2f;
  6049. num *= 1.525f;
  6050. return end / 2f * (value * value * ((num + 1f) * value + num) + 2f) + start;
  6051. }
  6052. public static float punch(float amplitude, float value, AnimationCurve curve = null)
  6053. {
  6054. if (value == 0f)
  6055. {
  6056. return 0f;
  6057. }
  6058. if (value == 1f)
  6059. {
  6060. return 0f;
  6061. }
  6062. float num = 0.3f;
  6063. float num2 = num / 6.28318548f * Mathf.Asin(0f);
  6064. return amplitude * Mathf.Pow(2f, -10f * value) * Mathf.Sin((value * 1f - num2) * 6.28318548f / num);
  6065. }
  6066. public static float easeInElastic(float start, float end, float value, AnimationCurve curve = null)
  6067. {
  6068. end -= start;
  6069. float num = 1f;
  6070. float num2 = num * 0.3f;
  6071. float num3 = 0f;
  6072. if (value == 0f)
  6073. {
  6074. return start;
  6075. }
  6076. if ((value /= num) == 1f)
  6077. {
  6078. return start + end;
  6079. }
  6080. float num4;
  6081. if (num3 == 0f || num3 < Mathf.Abs(end))
  6082. {
  6083. num3 = end;
  6084. num4 = num2 / 4f;
  6085. }
  6086. else
  6087. {
  6088. num4 = num2 / 6.28318548f * Mathf.Asin(end / num3);
  6089. }
  6090. return -(num3 * Mathf.Pow(2f, 10f * (value -= 1f)) * Mathf.Sin((value * num - num4) * 6.28318548f / num2)) + start;
  6091. }
  6092. public static float easeOutElastic(float start, float end, float value, AnimationCurve curve = null)
  6093. {
  6094. end -= start;
  6095. float num = 1f;
  6096. float num2 = num * 0.3f;
  6097. float num3 = 0f;
  6098. if (value == 0f)
  6099. {
  6100. return start;
  6101. }
  6102. if ((value /= num) == 1f)
  6103. {
  6104. return start + end;
  6105. }
  6106. float num4;
  6107. if (num3 == 0f || num3 < Mathf.Abs(end))
  6108. {
  6109. num3 = end;
  6110. num4 = num2 / 4f;
  6111. }
  6112. else
  6113. {
  6114. num4 = num2 / 6.28318548f * Mathf.Asin(end / num3);
  6115. }
  6116. return num3 * Mathf.Pow(2f, -10f * value) * Mathf.Sin((value * num - num4) * 6.28318548f / num2) + end + start;
  6117. }
  6118. public static float easeInOutElastic(float start, float end, float value, AnimationCurve curve = null)
  6119. {
  6120. end -= start;
  6121. float num = 1f;
  6122. float num2 = num * 0.3f;
  6123. float num3 = 0f;
  6124. if (value == 0f)
  6125. {
  6126. return start;
  6127. }
  6128. if ((value /= num / 2f) == 2f)
  6129. {
  6130. return start + end;
  6131. }
  6132. float num4;
  6133. if (num3 == 0f || num3 < Mathf.Abs(end))
  6134. {
  6135. num3 = end;
  6136. num4 = num2 / 4f;
  6137. }
  6138. else
  6139. {
  6140. num4 = num2 / 6.28318548f * Mathf.Asin(end / num3);
  6141. }
  6142. if (value < 1f)
  6143. {
  6144. return -0.5f * (num3 * Mathf.Pow(2f, 10f * (value -= 1f)) * Mathf.Sin((value * num - num4) * 6.28318548f / num2)) + start;
  6145. }
  6146. return num3 * Mathf.Pow(2f, -10f * (value -= 1f)) * Mathf.Sin((value * num - num4) * 6.28318548f / num2) * 0.5f + end + start;
  6147. }
  6148. public static ArrayList tweens_ = new ArrayList();
  6149. public static ArrayList disabledTweens = new ArrayList();
  6150. private static GameObject cameraFade;
  6151. public string id;
  6152. public string type;
  6153. public string method;
  6154. public AMTween.EaseType easeType;
  6155. public AnimationCurve easeCurve;
  6156. public float time;
  6157. public float delay;
  6158. public AMTween.LoopType loopType;
  6159. public bool isRunning;
  6160. public bool isPaused;
  6161. public string _name;
  6162. private float runningTime;
  6163. private float percentage;
  6164. private float delayStarted;
  6165. private bool kinematic;
  6166. private bool isLocal;
  6167. private bool loop;
  6168. private bool reverse;
  6169. private bool wasPaused;
  6170. private bool physics;
  6171. private Hashtable tweenArguments;
  6172. private Space space;
  6173. private AMTween.EasingFunction ease;
  6174. private AMTween.ApplyTween apply;
  6175. private AudioSource audioSource;
  6176. private Vector3[] vector3s;
  6177. private Vector2[] vector2s;
  6178. private Color[,] colors;
  6179. private float[] floats;
  6180. private Rect[] rects;
  6181. private float[] startMorphs;
  6182. private float[] endMorphs;
  6183. private float[] currentMorphs;
  6184. private AMTween.CRSpline path;
  6185. private Vector3 preUpdate;
  6186. private Vector3 postUpdate;
  6187. private AMTween.NamedValueColor namedcolorvalue;
  6188. private float lastRealTime;
  6189. private bool useRealTime;
  6190. public static string[] TransitionNamesDict = new string[]
  6191. {
  6192. "Crossfade",
  6193. "Venetian Blinds",
  6194. "Doors",
  6195. "Iris Box",
  6196. "Iris Round",
  6197. "None",
  6198. "Iris Shape",
  6199. "Shape Wipe",
  6200. "Linear Wipe",
  6201. "Radial Wipe",
  6202. "Wedge Wipe"
  6203. };
  6204. public static string[] TransitionNames = new string[]
  6205. {
  6206. "None",
  6207. "Crossfade",
  6208. "Doors",
  6209. "Venetian Blinds",
  6210. "Iris Box",
  6211. "Iris Round",
  6212. "Iris Shape",
  6213. "Linear Wipe",
  6214. "Shape Wipe",
  6215. "Radial Wipe",
  6216. "Wedge Wipe"
  6217. };
  6218. public static int[] TransitionOrder = new int[]
  6219. {
  6220. 5,
  6221. 0,
  6222. 2,
  6223. 1,
  6224. 3,
  6225. 4,
  6226. 6,
  6227. 8,
  6228. 7,
  6229. 9,
  6230. 10
  6231. };
  6232. public delegate float EasingFunction(float start, float end, float value, AnimationCurve curve);
  6233. private delegate void ApplyTween();
  6234. public enum EaseType
  6235. {
  6236. easeInQuad,
  6237. easeOutQuad,
  6238. easeInOutQuad,
  6239. easeInCubic,
  6240. easeOutCubic,
  6241. easeInOutCubic,
  6242. easeInQuart,
  6243. easeOutQuart,
  6244. easeInOutQuart,
  6245. easeInQuint,
  6246. easeOutQuint,
  6247. easeInOutQuint,
  6248. easeInSine,
  6249. easeOutSine,
  6250. easeInOutSine,
  6251. easeInExpo,
  6252. easeOutExpo,
  6253. easeInOutExpo,
  6254. easeInCirc,
  6255. easeOutCirc,
  6256. easeInOutCirc,
  6257. linear,
  6258. spring,
  6259. easeInBounce,
  6260. easeOutBounce,
  6261. easeInOutBounce,
  6262. easeInBack,
  6263. easeOutBack,
  6264. easeInOutBack,
  6265. easeInElastic,
  6266. easeOutElastic,
  6267. easeInOutElastic,
  6268. punch,
  6269. stayStart,
  6270. stayEnd
  6271. }
  6272. public enum LoopType
  6273. {
  6274. none,
  6275. loop,
  6276. pingPong
  6277. }
  6278. public enum NamedValueColor
  6279. {
  6280. _Color,
  6281. _SpecColor,
  6282. _Emission,
  6283. _ReflectColor
  6284. }
  6285. public enum Fade
  6286. {
  6287. CrossFade,
  6288. VenetianBlinds,
  6289. Doors,
  6290. IrisBox,
  6291. IrisRound,
  6292. None,
  6293. IrisShape,
  6294. ShapeWipe,
  6295. LinearWipe,
  6296. RadialWipe,
  6297. WedgeWipe
  6298. }
  6299. public static class Defaults
  6300. {
  6301. public static float time = 1f;
  6302. public static float delay = 0f;
  6303. public static AMTween.NamedValueColor namedColorValue = AMTween.NamedValueColor._Color;
  6304. public static AMTween.LoopType loopType = AMTween.LoopType.none;
  6305. public static AMTween.EaseType easeType = AMTween.EaseType.easeOutExpo;
  6306. public static float lookSpeed = 3f;
  6307. public static bool isLocal = false;
  6308. public static Space space = Space.Self;
  6309. public static bool orientToPath = false;
  6310. public static Color color = Color.white;
  6311. public static float updateTimePercentage = 0.05f;
  6312. public static float updateTime = 1f * AMTween.Defaults.updateTimePercentage;
  6313. public static int cameraFadeDepth = 999999;
  6314. public static float lookAhead = 0.05f;
  6315. public static bool useRealTime = false;
  6316. public static Vector3 up = Vector3.up;
  6317. }
  6318. private class CRSpline
  6319. {
  6320. public CRSpline(params Vector3[] pts)
  6321. {
  6322. this.pts = new Vector3[pts.Length];
  6323. Array.Copy(pts, this.pts, pts.Length);
  6324. }
  6325. public Vector3 Interp(float t)
  6326. {
  6327. int num = this.pts.Length - 3;
  6328. int num2 = Mathf.Min(Mathf.FloorToInt(t * (float)num), num - 1);
  6329. float num3 = t * (float)num - (float)num2;
  6330. Vector3 a = this.pts[num2];
  6331. Vector3 a2 = this.pts[num2 + 1];
  6332. Vector3 vector = this.pts[num2 + 2];
  6333. Vector3 b = this.pts[num2 + 3];
  6334. return 0.5f * ((-a + 3f * a2 - 3f * vector + b) * (num3 * num3 * num3) + (2f * a - 5f * a2 + 4f * vector - b) * (num3 * num3) + (-a + vector) * num3 + 2f * a2);
  6335. }
  6336. public Vector3[] pts;
  6337. }
  6338. }