123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717 |
- using System;
- using System.Collections;
- using System.Reflection;
- using UnityEngine;
- public class AMTween : MonoBehaviour
- {
- private static AMCameraFade cf
- {
- get
- {
- return AMCameraFade.getCameraFade(false);
- }
- }
- public static bool isTransitionReversed(int transition, float[] r)
- {
- switch (transition)
- {
- case 3:
- case 4:
- case 6:
- if (r.Length >= 1 && r[0] == 1f)
- {
- return true;
- }
- break;
- }
- return false;
- }
- public static void Init(GameObject target)
- {
- AMTween.MoveBy(target, Vector3.zero, 0f, string.Empty);
- }
- public static void CameraFade(AMTween.Fade type, bool useRenderTexture, float[] parameters, Hashtable args)
- {
- AMTween.CameraFade((int)type, useRenderTexture, parameters, args);
- }
- public static void CameraFade(int type, bool useRenderTexture, float[] parameters, Hashtable args)
- {
- args = AMTween.CleanArgs(args);
- bool flag = false;
- if ((type != 5 && !args.Contains("camera1") && !args.Contains("color1")) || (!args.Contains("camera2") && !args.Contains("color2")))
- {
- flag = true;
- }
- else if (type != 5 && args.Contains("camera1") && (args["camera1"] == null || args["camera1"].GetType() != typeof(Camera)))
- {
- flag = true;
- }
- else if (args.Contains("camera2") && (args["camera2"] == null || args["camera2"].GetType() != typeof(Camera)))
- {
- flag = true;
- }
- else if (type != 5 && args.Contains("color1") && (args["color1"] == null || args["color1"].GetType() != typeof(Color)))
- {
- flag = true;
- }
- else if (args.Contains("color2") && (args["color2"] == null || args["color2"].GetType() != typeof(Color)))
- {
- flag = true;
- }
- if (flag)
- {
- Debug.LogWarning("AMTween: CameraFade requires at least two arguments; Camera 'camera1' or Color 'color1' and Camera 'camera2' or Color 'color2'.");
- return;
- }
- if (!args.Contains("reversed") || args["reversed"].GetType() != typeof(bool))
- {
- args["reversed"] = false;
- }
- if (!args.Contains("allcameras") || args["allcameras"].GetType() != typeof(Camera[]))
- {
- args["allcameras"] = (Camera[])UnityEngine.Object.FindObjectsOfType(typeof(Camera));
- }
- if (args.Contains("texture"))
- {
- bool flag2 = false;
- if (args["texture"] == null)
- {
- flag2 = true;
- }
- else if (args["texture"].GetType() != typeof(Texture2D))
- {
- Debug.LogWarning("AMTween: CameraFade parameter 'irisshape' must be a Texture2D! No texture will be used.");
- flag2 = true;
- }
- if (flag2)
- {
- args.Remove("texture");
- }
- }
- AMTween.cf.incrementKeepAlives();
- args["type"] = "camerafade";
- args["camerafadetype"] = type;
- args["userendertex"] = useRenderTexture;
- args["parameters"] = parameters;
- AMTween.Launch(AMTween.cf.gameObject, args);
- }
- public static void CameraFadeFrom(float amount, float time, string trackId)
- {
- if (AMTween.cameraFade)
- {
- AMTween.CameraFadeFrom(AMTween.Hash(new object[]
- {
- "trackid",
- trackId,
- "amount",
- amount,
- "time",
- time
- }));
- }
- else
- {
- Debug.LogError("AMTween Error: You must first add a camera fade object with CameraFadeAdd() before atttempting to use camera fading.");
- }
- }
- public static void CameraFadeFrom(Hashtable args)
- {
- if (AMTween.cameraFade)
- {
- AMTween.ColorFrom(AMTween.cameraFade, args);
- }
- else
- {
- Debug.LogError("AMTween Error: You must first add a camera fade object with CameraFadeAdd() before atttempting to use camera fading.");
- }
- }
- public static void CameraFadeTo(float amount, float time, string trackId)
- {
- if (AMTween.cameraFade)
- {
- AMTween.CameraFadeTo(AMTween.Hash(new object[]
- {
- "trackid",
- trackId,
- "amount",
- amount,
- "time",
- time
- }));
- }
- else
- {
- Debug.LogError("AMTween Error: You must first add a camera fade object with CameraFadeAdd() before atttempting to use camera fading.");
- }
- }
- public static void CameraFadeTo(Hashtable args)
- {
- if (AMTween.cameraFade)
- {
- AMTween.ColorTo(AMTween.cameraFade, args);
- }
- else
- {
- Debug.LogError("AMTween Error: You must first add a camera fade object with CameraFadeAdd() before atttempting to use camera fading.");
- }
- }
- public static void ValueTo(GameObject target, Hashtable args)
- {
- args = AMTween.CleanArgs(args);
- if (!args.Contains("onupdate") || !args.Contains("from") || !args.Contains("to"))
- {
- 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!");
- return;
- }
- args["type"] = "value";
- if (args["from"].GetType() == typeof(Vector2))
- {
- args["method"] = "vector2";
- }
- else if (args["from"].GetType() == typeof(Vector3))
- {
- args["method"] = "vector3";
- }
- else if (args["from"].GetType() == typeof(Rect))
- {
- args["method"] = "rect";
- }
- else if (args["from"].GetType() == typeof(float))
- {
- args["method"] = "float";
- }
- else
- {
- if (args["from"].GetType() != typeof(Color))
- {
- Debug.LogError("AMTween Error: ValueTo() only works with interpolating Vector3s, Vector2s, floats, ints, Rects and Colors!");
- return;
- }
- args["method"] = "color";
- }
- if (!args.Contains("easetype"))
- {
- args.Add("easetype", AMTween.EaseType.linear);
- }
- AMTween.Launch(target, args);
- }
- public static void PropertyTo(Component component, Hashtable args)
- {
- args = AMTween.CleanArgs(args);
- if (!args.Contains("fieldinfo") && !args.Contains("propertyinfo") && !args.Contains("methodinfo"))
- {
- Debug.LogError("AMTween Error: PropertyTo() requires a valid 'fieldinfo', 'propertyinfo' or 'methodinfo'.");
- return;
- }
- if (!args.Contains("from") || !args.Contains("to"))
- {
- Debug.LogError("AMTween Error: PropertyTo() requires a 'from' and 'to' property.");
- return;
- }
- args["type"] = "property";
- if (args.Contains("methodtype"))
- {
- if (!((string)args["methodtype"] == "morph"))
- {
- Debug.LogError("AMTween Error: Invalid method type '" + args["methodtype"] + "' supplied!");
- return;
- }
- args["method"] = "morph";
- if (!args.Contains("from") || args["from"].GetType() != typeof(float[]) || !args.Contains("to") || args["to"].GetType() != typeof(float[]))
- {
- Debug.LogError("AMTween Error: Morph requires from and to targets of type float[]!");
- return;
- }
- }
- else if (args["from"].GetType() == typeof(Vector2))
- {
- args["method"] = "vector2";
- }
- else if (args["from"].GetType() == typeof(Vector3))
- {
- args["method"] = "vector3";
- }
- else if (args["from"].GetType() == typeof(Rect))
- {
- args["method"] = "rect";
- }
- else if (args["from"].GetType() == typeof(float))
- {
- args["method"] = "float";
- }
- else
- {
- if (args["from"].GetType() != typeof(Color))
- {
- Debug.LogError("AMTween Error: PropertyTo() only works with interpolating Vector3s, Vector2s, floats, ints, Rects and Colors!");
- return;
- }
- args["method"] = "color";
- }
- if (!args.Contains("easetype"))
- {
- args.Add("easetype", AMTween.EaseType.linear);
- }
- AMTween.Launch(component, args);
- }
- public static void InvokeMethod(Component component, Hashtable args)
- {
- args = AMTween.CleanArgs(args);
- if (!args.Contains("methodinfo"))
- {
- Debug.LogError("AMTween Error: InvokeMethod() requires a parameter 'methodinfo'.");
- return;
- }
- args["type"] = "invoke";
- args["method"] = "method";
- AMTween.Launch(component, args);
- }
- public static void FadeFrom(GameObject target, float alpha, float time, string trackId)
- {
- AMTween.FadeFrom(target, AMTween.Hash(new object[]
- {
- "trackid",
- trackId,
- "alpha",
- alpha,
- "time",
- time
- }));
- }
- public static void FadeFrom(GameObject target, Hashtable args)
- {
- AMTween.ColorFrom(target, args);
- }
- public static void FadeTo(GameObject target, float alpha, float time, string trackId)
- {
- AMTween.FadeTo(target, AMTween.Hash(new object[]
- {
- "trackid",
- trackId,
- "alpha",
- alpha,
- "time",
- time
- }));
- }
- public static void FadeTo(GameObject target, Hashtable args)
- {
- AMTween.ColorTo(target, args);
- }
- public static void ColorFrom(GameObject target, Color color, float time, string trackId)
- {
- AMTween.ColorFrom(target, AMTween.Hash(new object[]
- {
- "trackid",
- trackId,
- "color",
- color,
- "time",
- time
- }));
- }
- public static void ColorFrom(GameObject target, Hashtable args)
- {
- Color color = default(Color);
- Color color2 = default(Color);
- args = AMTween.CleanArgs(args);
- if (!args.Contains("includechildren") || (bool)args["includechildren"])
- {
- IEnumerator enumerator = target.transform.GetEnumerator();
- try
- {
- while (enumerator.MoveNext())
- {
- object obj = enumerator.Current;
- Transform transform = (Transform)obj;
- Hashtable hashtable = (Hashtable)args.Clone();
- hashtable["ischild"] = true;
- AMTween.ColorFrom(transform.gameObject, hashtable);
- }
- }
- finally
- {
- IDisposable disposable;
- if ((disposable = (enumerator as IDisposable)) != null)
- {
- disposable.Dispose();
- }
- }
- }
- if (!args.Contains("easetype"))
- {
- args.Add("easetype", AMTween.EaseType.linear);
- }
- if (target.GetComponent(typeof(GUITexture)))
- {
- color = (color2 = target.GetComponent<GUITexture>().color);
- }
- else if (target.GetComponent(typeof(GUIText)))
- {
- color = (color2 = target.GetComponent<GUIText>().material.color);
- }
- else if (target.GetComponent<Renderer>())
- {
- color = (color2 = target.GetComponent<Renderer>().material.color);
- }
- else if (target.GetComponent<Light>())
- {
- color = (color2 = target.GetComponent<Light>().color);
- }
- if (args.Contains("color"))
- {
- color = (Color)args["color"];
- }
- else
- {
- if (args.Contains("r"))
- {
- color.r = (float)args["r"];
- }
- if (args.Contains("g"))
- {
- color.g = (float)args["g"];
- }
- if (args.Contains("b"))
- {
- color.b = (float)args["b"];
- }
- if (args.Contains("a"))
- {
- color.a = (float)args["a"];
- }
- }
- if (args.Contains("amount"))
- {
- color.a = (float)args["amount"];
- args.Remove("amount");
- }
- else if (args.Contains("alpha"))
- {
- color.a = (float)args["alpha"];
- args.Remove("alpha");
- }
- if (target.GetComponent(typeof(GUITexture)))
- {
- target.GetComponent<GUITexture>().color = color;
- }
- else if (target.GetComponent(typeof(GUIText)))
- {
- target.GetComponent<GUIText>().material.color = color;
- }
- else if (target.GetComponent<Renderer>())
- {
- target.GetComponent<Renderer>().material.color = color;
- }
- else if (target.GetComponent<Light>())
- {
- target.GetComponent<Light>().color = color;
- }
- args["color"] = color2;
- args["type"] = "color";
- args["method"] = "to";
- AMTween.Launch(target, args);
- }
- public static void ColorTo(GameObject target, Color color, float time, string trackId)
- {
- AMTween.ColorTo(target, AMTween.Hash(new object[]
- {
- "trackid",
- trackId,
- "color",
- color,
- "time",
- time
- }));
- }
- public static void ColorTo(GameObject target, Hashtable args)
- {
- args = AMTween.CleanArgs(args);
- if (!args.Contains("includechildren") || (bool)args["includechildren"])
- {
- IEnumerator enumerator = target.transform.GetEnumerator();
- try
- {
- while (enumerator.MoveNext())
- {
- object obj = enumerator.Current;
- Transform transform = (Transform)obj;
- Hashtable hashtable = (Hashtable)args.Clone();
- hashtable["ischild"] = true;
- AMTween.ColorTo(transform.gameObject, hashtable);
- }
- }
- finally
- {
- IDisposable disposable;
- if ((disposable = (enumerator as IDisposable)) != null)
- {
- disposable.Dispose();
- }
- }
- }
- if (!args.Contains("easetype"))
- {
- args.Add("easetype", AMTween.EaseType.linear);
- }
- args["type"] = "color";
- args["method"] = "to";
- AMTween.Launch(target, args);
- }
- public static void AudioFrom(GameObject target, float volume, float pitch, float time, string trackId)
- {
- AMTween.AudioFrom(target, AMTween.Hash(new object[]
- {
- "trackid",
- trackId,
- "volume",
- volume,
- "pitch",
- pitch,
- "time",
- time
- }));
- }
- public static void AudioFrom(GameObject target, Hashtable args)
- {
- args = AMTween.CleanArgs(args);
- AudioSource audioSource;
- if (args.Contains("audiosource"))
- {
- audioSource = (AudioSource)args["audiosource"];
- }
- else
- {
- if (!target.GetComponent(typeof(AudioSource)))
- {
- Debug.LogError("AMTween Error: AudioFrom requires an AudioSource.");
- return;
- }
- audioSource = target.GetComponent<AudioSource>();
- }
- Vector2 vector;
- Vector2 vector2;
- vector.x = (vector2.x = audioSource.volume);
- vector.y = (vector2.y = audioSource.pitch);
- if (args.Contains("volume"))
- {
- vector2.x = (float)args["volume"];
- }
- if (args.Contains("pitch"))
- {
- vector2.y = (float)args["pitch"];
- }
- audioSource.volume = vector2.x;
- audioSource.pitch = vector2.y;
- args["volume"] = vector.x;
- args["pitch"] = vector.y;
- if (!args.Contains("easetype"))
- {
- args.Add("easetype", AMTween.EaseType.linear);
- }
- args["type"] = "audio";
- args["method"] = "to";
- AMTween.Launch(target, args);
- }
- public static void AudioTo(GameObject target, float volume, float pitch, float time, string trackId)
- {
- AMTween.AudioTo(target, AMTween.Hash(new object[]
- {
- "trackid",
- trackId,
- "volume",
- volume,
- "pitch",
- pitch,
- "time",
- time
- }));
- }
- public static void AudioTo(GameObject target, Hashtable args)
- {
- args = AMTween.CleanArgs(args);
- if (!args.Contains("easetype"))
- {
- args.Add("easetype", AMTween.EaseType.linear);
- }
- args["type"] = "audio";
- args["method"] = "to";
- AMTween.Launch(target, args);
- }
- public static void Stab(GameObject target, AudioClip audioclip, float delay, string trackId)
- {
- AMTween.Stab(target, AMTween.Hash(new object[]
- {
- "trackid",
- trackId,
- "audioclip",
- audioclip,
- "delay",
- delay
- }));
- }
- public static void Stab(GameObject target, Hashtable args)
- {
- args = AMTween.CleanArgs(args);
- args["type"] = "stab";
- AMTween.Launch(target, args);
- }
- public static void LookFrom(GameObject target, Vector3 looktarget, float time, string trackId)
- {
- AMTween.LookFrom(target, AMTween.Hash(new object[]
- {
- "trackid",
- trackId,
- "looktarget",
- looktarget,
- "time",
- time
- }));
- }
- public static void LookFrom(GameObject target, Hashtable args)
- {
- args = AMTween.CleanArgs(args);
- Vector3 eulerAngles = target.transform.eulerAngles;
- if (args["looktarget"].GetType() == typeof(Transform))
- {
- Transform transform = target.transform;
- Transform target2 = (Transform)args["looktarget"];
- Vector3? vector = (Vector3?)args["up"];
- transform.LookAt(target2, (vector == null) ? AMTween.Defaults.up : vector.Value);
- }
- else if (args["looktarget"].GetType() == typeof(Vector3))
- {
- Transform transform2 = target.transform;
- Vector3 worldPosition = (Vector3)args["looktarget"];
- Vector3? vector2 = (Vector3?)args["up"];
- transform2.LookAt(worldPosition, (vector2 == null) ? AMTween.Defaults.up : vector2.Value);
- }
- if (args.Contains("axis"))
- {
- Vector3 eulerAngles2 = target.transform.eulerAngles;
- string text = (string)args["axis"];
- if (text != null)
- {
- if (!(text == "x"))
- {
- if (!(text == "y"))
- {
- if (text == "z")
- {
- eulerAngles2.x = eulerAngles.x;
- eulerAngles2.y = eulerAngles.y;
- }
- }
- else
- {
- eulerAngles2.x = eulerAngles.x;
- eulerAngles2.z = eulerAngles.z;
- }
- }
- else
- {
- eulerAngles2.y = eulerAngles.y;
- eulerAngles2.z = eulerAngles.z;
- }
- }
- target.transform.eulerAngles = eulerAngles2;
- }
- args["rotation"] = eulerAngles;
- args["type"] = "rotate";
- args["method"] = "to";
- AMTween.Launch(target, args);
- }
- public static void LookToFollow(GameObject target, Transform looktarget, float time, string trackId)
- {
- AMTween.LookToFollow(target, AMTween.Hash(new object[]
- {
- "trackid",
- trackId,
- "looktarget",
- looktarget,
- "time",
- time
- }));
- }
- public static void LookToFollow(GameObject target, Hashtable args)
- {
- args = AMTween.CleanArgs(args);
- if (args.Contains("looktarget") && args["looktarget"].GetType() == typeof(Transform))
- {
- Transform transform = (Transform)args["looktarget"];
- args["position"] = new Vector3(transform.position.x, transform.position.y, transform.position.z);
- args["rotation"] = new Vector3(transform.eulerAngles.x, transform.eulerAngles.y, transform.eulerAngles.z);
- }
- if (args.Contains("endposition") && args["endposition"] == null)
- {
- args.Remove("endposition");
- }
- args["type"] = "look";
- args["method"] = "tofollow";
- AMTween.Launch(target, args);
- }
- public static void LookFollow(GameObject target, Transform looktarget, float time, string trackId)
- {
- AMTween.LookFollow(target, AMTween.Hash(new object[]
- {
- "trackid",
- trackId,
- "looktarget",
- looktarget,
- "time",
- time
- }));
- }
- public static void LookFollow(GameObject target, Hashtable args)
- {
- args = AMTween.CleanArgs(args);
- if (args.Contains("looktarget") && args["looktarget"].GetType() == typeof(Transform))
- {
- Transform transform = (Transform)args["looktarget"];
- args["position"] = new Vector3(transform.position.x, transform.position.y, transform.position.z);
- args["rotation"] = new Vector3(transform.eulerAngles.x, transform.eulerAngles.y, transform.eulerAngles.z);
- }
- args["type"] = "look";
- args["method"] = "follow";
- AMTween.Launch(target, args);
- }
- public static void LookTo(GameObject target, Vector3 looktarget, float time, string trackId)
- {
- AMTween.LookTo(target, AMTween.Hash(new object[]
- {
- "trackid",
- trackId,
- "looktarget",
- looktarget,
- "time",
- time
- }));
- }
- public static void LookTo(GameObject target, Hashtable args)
- {
- args = AMTween.CleanArgs(args);
- if (args.Contains("looktarget") && args["looktarget"].GetType() == typeof(Transform))
- {
- Transform transform = (Transform)args["looktarget"];
- args["position"] = new Vector3(transform.position.x, transform.position.y, transform.position.z);
- args["rotation"] = new Vector3(transform.eulerAngles.x, transform.eulerAngles.y, transform.eulerAngles.z);
- }
- args["type"] = "look";
- args["method"] = "to";
- AMTween.Launch(target, args);
- }
- public static void SendMessage(GameObject target, string methodName, object parameter, string trackId)
- {
- AMTween.SendMessage(target, AMTween.Hash(new object[]
- {
- "trackid",
- trackId,
- "methodname",
- methodName,
- "parameter",
- parameter
- }));
- }
- public static void SendMessage(GameObject target, Hashtable args)
- {
- args = AMTween.CleanArgs(args);
- if (!args.Contains("methodname"))
- {
- Debug.LogError("AMTween Error: SendMessage() requires 'methodname'.");
- return;
- }
- args["type"] = "send";
- args["method"] = "message";
- AMTween.Launch(target, args);
- }
- public static void PlayAnimation(GameObject target, string animation, WrapMode wrapmode, bool crossfade, string trackId)
- {
- AMTween.PlayAnimation(target, AMTween.Hash(new object[]
- {
- "trackid",
- trackId,
- "animation",
- animation,
- "crossfade",
- crossfade,
- "wrapmode",
- wrapmode
- }));
- }
- public static void PlayAnimation(GameObject target, Hashtable args)
- {
- args["type"] = "play";
- args["method"] = "animation";
- AMTween.Launch(target, args);
- }
- public static void PlayAudio(AudioSource audioSource, AudioClip audioClip, bool loop, string trackId)
- {
- AMTween.PlayAudio(audioSource, AMTween.Hash(new object[]
- {
- "trackid",
- trackId,
- "audiosource",
- audioSource,
- "audioclip",
- audioClip,
- "loop",
- loop
- }));
- }
- public static void PlayAudio(AudioSource audioSource, Hashtable args)
- {
- args = AMTween.CleanArgs(args);
- args["audiosource"] = audioSource;
- args["type"] = "play";
- args["method"] = "audio";
- if ((bool)args["loop"])
- {
- args["looptype"] = AMTween.LoopType.loop;
- }
- AMTween.Launch(audioSource.gameObject, args);
- }
- public static void MoveTo(GameObject target, Vector3 position, float time, string trackId)
- {
- AMTween.MoveTo(target, AMTween.Hash(new object[]
- {
- "trackid",
- trackId,
- "position",
- position,
- "time",
- time
- }));
- }
- public static void MoveTo(GameObject target, Hashtable args)
- {
- args = AMTween.CleanArgs(args);
- if (args.Contains("position") && args["position"].GetType() == typeof(Transform))
- {
- Transform transform = (Transform)args["position"];
- args["position"] = new Vector3(transform.position.x, transform.position.y, transform.position.z);
- args["rotation"] = new Vector3(transform.eulerAngles.x, transform.eulerAngles.y, transform.eulerAngles.z);
- args["scale"] = new Vector3(transform.localScale.x, transform.localScale.y, transform.localScale.z);
- }
- args["type"] = "move";
- args["method"] = "to";
- AMTween.Launch(target, args);
- }
- public static void MoveFrom(GameObject target, Vector3 position, float time, string trackId)
- {
- AMTween.MoveFrom(target, AMTween.Hash(new object[]
- {
- "trackid",
- trackId,
- "position",
- position,
- "time",
- time
- }));
- }
- public static void MoveFrom(GameObject target, Hashtable args)
- {
- args = AMTween.CleanArgs(args);
- bool flag;
- if (args.Contains("islocal"))
- {
- flag = (bool)args["islocal"];
- }
- else
- {
- flag = AMTween.Defaults.isLocal;
- }
- if (args.Contains("path"))
- {
- Vector3[] array2;
- if (args["path"].GetType() == typeof(Vector3[]))
- {
- Vector3[] array = (Vector3[])args["path"];
- array2 = new Vector3[array.Length];
- Array.Copy(array, array2, array.Length);
- }
- else
- {
- Transform[] array3 = (Transform[])args["path"];
- array2 = new Vector3[array3.Length];
- for (int i = 0; i < array3.Length; i++)
- {
- array2[i] = array3[i].position;
- }
- }
- if (array2[array2.Length - 1] != target.transform.position)
- {
- Vector3[] array4 = new Vector3[array2.Length + 1];
- Array.Copy(array2, array4, array2.Length);
- if (flag)
- {
- array4[array4.Length - 1] = target.transform.localPosition;
- target.transform.localPosition = array4[0];
- }
- else
- {
- array4[array4.Length - 1] = target.transform.position;
- target.transform.position = array4[0];
- }
- args["path"] = array4;
- }
- else
- {
- if (flag)
- {
- target.transform.localPosition = array2[0];
- }
- else
- {
- target.transform.position = array2[0];
- }
- args["path"] = array2;
- }
- }
- else
- {
- Vector3 vector2;
- Vector3 vector;
- if (flag)
- {
- vector = (vector2 = target.transform.localPosition);
- }
- else
- {
- vector = (vector2 = target.transform.position);
- }
- if (args.Contains("position"))
- {
- if (args["position"].GetType() == typeof(Transform))
- {
- Transform transform = (Transform)args["position"];
- vector = transform.position;
- }
- else if (args["position"].GetType() == typeof(Vector3))
- {
- vector = (Vector3)args["position"];
- }
- }
- else
- {
- if (args.Contains("x"))
- {
- vector.x = (float)args["x"];
- }
- if (args.Contains("y"))
- {
- vector.y = (float)args["y"];
- }
- if (args.Contains("z"))
- {
- vector.z = (float)args["z"];
- }
- }
- if (flag)
- {
- target.transform.localPosition = vector;
- }
- else
- {
- target.transform.position = vector;
- }
- args["position"] = vector2;
- }
- args["type"] = "move";
- args["method"] = "to";
- AMTween.Launch(target, args);
- }
- public static void MoveAdd(GameObject target, Vector3 amount, float time, string trackId)
- {
- AMTween.MoveAdd(target, AMTween.Hash(new object[]
- {
- "trackid",
- trackId,
- "amount",
- amount,
- "time",
- time
- }));
- }
- public static void MoveAdd(GameObject target, Hashtable args)
- {
- args = AMTween.CleanArgs(args);
- args["type"] = "move";
- args["method"] = "add";
- AMTween.Launch(target, args);
- }
- public static void MoveBy(GameObject target, Vector3 amount, float time, string trackId)
- {
- AMTween.MoveBy(target, AMTween.Hash(new object[]
- {
- "trackid",
- trackId,
- "amount",
- amount,
- "time",
- time
- }));
- }
- public static void MoveBy(GameObject target, Hashtable args)
- {
- args = AMTween.CleanArgs(args);
- args["type"] = "move";
- args["method"] = "by";
- AMTween.Launch(target, args);
- }
- public static void ScaleTo(GameObject target, Vector3 scale, float time, string trackId)
- {
- AMTween.ScaleTo(target, AMTween.Hash(new object[]
- {
- "trackid",
- trackId,
- "scale",
- scale,
- "time",
- time
- }));
- }
- public static void ScaleTo(GameObject target, Hashtable args)
- {
- args = AMTween.CleanArgs(args);
- if (args.Contains("scale") && args["scale"].GetType() == typeof(Transform))
- {
- Transform transform = (Transform)args["scale"];
- args["position"] = new Vector3(transform.position.x, transform.position.y, transform.position.z);
- args["rotation"] = new Vector3(transform.eulerAngles.x, transform.eulerAngles.y, transform.eulerAngles.z);
- args["scale"] = new Vector3(transform.localScale.x, transform.localScale.y, transform.localScale.z);
- }
- args["type"] = "scale";
- args["method"] = "to";
- AMTween.Launch(target, args);
- }
- public static void ScaleFrom(GameObject target, Vector3 scale, float time, string trackId)
- {
- AMTween.ScaleFrom(target, AMTween.Hash(new object[]
- {
- "trackid",
- trackId,
- "scale",
- scale,
- "time",
- time
- }));
- }
- public static void ScaleFrom(GameObject target, Hashtable args)
- {
- args = AMTween.CleanArgs(args);
- Vector3 localScale2;
- Vector3 localScale = localScale2 = target.transform.localScale;
- if (args.Contains("scale"))
- {
- if (args["scale"].GetType() == typeof(Transform))
- {
- Transform transform = (Transform)args["scale"];
- localScale = transform.localScale;
- }
- else if (args["scale"].GetType() == typeof(Vector3))
- {
- localScale = (Vector3)args["scale"];
- }
- }
- else
- {
- if (args.Contains("x"))
- {
- localScale.x = (float)args["x"];
- }
- if (args.Contains("y"))
- {
- localScale.y = (float)args["y"];
- }
- if (args.Contains("z"))
- {
- localScale.z = (float)args["z"];
- }
- }
- target.transform.localScale = localScale;
- args["scale"] = localScale2;
- args["type"] = "scale";
- args["method"] = "to";
- AMTween.Launch(target, args);
- }
- public static void ScaleAdd(GameObject target, Vector3 amount, float time, string trackId)
- {
- AMTween.ScaleAdd(target, AMTween.Hash(new object[]
- {
- "trackid",
- trackId,
- "amount",
- amount,
- "time",
- time
- }));
- }
- public static void ScaleAdd(GameObject target, Hashtable args)
- {
- args = AMTween.CleanArgs(args);
- args["type"] = "scale";
- args["method"] = "add";
- AMTween.Launch(target, args);
- }
- public static void ScaleBy(GameObject target, Vector3 amount, float time, string trackId)
- {
- AMTween.ScaleBy(target, AMTween.Hash(new object[]
- {
- "trackid",
- trackId,
- "amount",
- amount,
- "time",
- time
- }));
- }
- public static void ScaleBy(GameObject target, Hashtable args)
- {
- args = AMTween.CleanArgs(args);
- args["type"] = "scale";
- args["method"] = "by";
- AMTween.Launch(target, args);
- }
- public static void RotateTo(GameObject target, Vector3 rotation, float time, string trackId)
- {
- AMTween.RotateTo(target, AMTween.Hash(new object[]
- {
- "trackid",
- trackId,
- "rotation",
- rotation,
- "time",
- time
- }));
- }
- public static void RotateTo(GameObject target, Hashtable args)
- {
- args = AMTween.CleanArgs(args);
- if (args.Contains("rotation") && args["rotation"].GetType() == typeof(Transform))
- {
- Transform transform = (Transform)args["rotation"];
- args["position"] = new Vector3(transform.position.x, transform.position.y, transform.position.z);
- args["rotation"] = new Vector3(transform.eulerAngles.x, transform.eulerAngles.y, transform.eulerAngles.z);
- args["scale"] = new Vector3(transform.localScale.x, transform.localScale.y, transform.localScale.z);
- }
- args["type"] = "rotate";
- args["method"] = "to";
- AMTween.Launch(target, args);
- }
- public static void RotateFrom(GameObject target, Vector3 rotation, float time, string trackId)
- {
- AMTween.RotateFrom(target, AMTween.Hash(new object[]
- {
- "trackid",
- trackId,
- "rotation",
- rotation,
- "time",
- time
- }));
- }
- public static void RotateFrom(GameObject target, Hashtable args)
- {
- args = AMTween.CleanArgs(args);
- bool flag;
- if (args.Contains("islocal"))
- {
- flag = (bool)args["islocal"];
- }
- else
- {
- flag = AMTween.Defaults.isLocal;
- }
- Vector3 vector2;
- Vector3 vector;
- if (flag)
- {
- vector = (vector2 = target.transform.localEulerAngles);
- }
- else
- {
- vector = (vector2 = target.transform.eulerAngles);
- }
- if (args.Contains("rotation"))
- {
- if (args["rotation"].GetType() == typeof(Transform))
- {
- Transform transform = (Transform)args["rotation"];
- vector = transform.eulerAngles;
- }
- else if (args["rotation"].GetType() == typeof(Vector3))
- {
- vector = (Vector3)args["rotation"];
- }
- }
- else
- {
- if (args.Contains("x"))
- {
- vector.x = (float)args["x"];
- }
- if (args.Contains("y"))
- {
- vector.y = (float)args["y"];
- }
- if (args.Contains("z"))
- {
- vector.z = (float)args["z"];
- }
- }
- if (flag)
- {
- target.transform.localEulerAngles = vector;
- }
- else
- {
- target.transform.eulerAngles = vector;
- }
- args["rotation"] = vector2;
- args["type"] = "rotate";
- args["method"] = "to";
- AMTween.Launch(target, args);
- }
- public static void RotateAdd(GameObject target, Vector3 amount, float time, string trackId)
- {
- AMTween.RotateAdd(target, AMTween.Hash(new object[]
- {
- "trackid",
- trackId,
- "amount",
- amount,
- "time",
- time
- }));
- }
- public static void RotateAdd(GameObject target, Hashtable args)
- {
- args = AMTween.CleanArgs(args);
- args["type"] = "rotate";
- args["method"] = "add";
- AMTween.Launch(target, args);
- }
- public static void RotateBy(GameObject target, Vector3 amount, float time, string trackId)
- {
- AMTween.RotateBy(target, AMTween.Hash(new object[]
- {
- "trackid",
- trackId,
- "amount",
- amount,
- "time",
- time
- }));
- }
- public static void RotateBy(GameObject target, Hashtable args)
- {
- args = AMTween.CleanArgs(args);
- args["type"] = "rotate";
- args["method"] = "by";
- AMTween.Launch(target, args);
- }
- public static void ShakePosition(GameObject target, Vector3 amount, float time, string trackId)
- {
- AMTween.ShakePosition(target, AMTween.Hash(new object[]
- {
- "trackid",
- trackId,
- "amount",
- amount,
- "time",
- time
- }));
- }
- public static void ShakePosition(GameObject target, Hashtable args)
- {
- args = AMTween.CleanArgs(args);
- args["type"] = "shake";
- args["method"] = "position";
- AMTween.Launch(target, args);
- }
- public static void ShakeScale(GameObject target, Vector3 amount, float time, string trackId)
- {
- AMTween.ShakeScale(target, AMTween.Hash(new object[]
- {
- "trackid",
- trackId,
- "amount",
- amount,
- "time",
- time
- }));
- }
- public static void ShakeScale(GameObject target, Hashtable args)
- {
- args = AMTween.CleanArgs(args);
- args["type"] = "shake";
- args["method"] = "scale";
- AMTween.Launch(target, args);
- }
- public static void ShakeRotation(GameObject target, Vector3 amount, float time, string trackId)
- {
- AMTween.ShakeRotation(target, AMTween.Hash(new object[]
- {
- "trackid",
- trackId,
- "amount",
- amount,
- "time",
- time
- }));
- }
- public static void ShakeRotation(GameObject target, Hashtable args)
- {
- args = AMTween.CleanArgs(args);
- args["type"] = "shake";
- args["method"] = "rotation";
- AMTween.Launch(target, args);
- }
- public static void PunchPosition(GameObject target, Vector3 amount, float time, string trackId)
- {
- AMTween.PunchPosition(target, AMTween.Hash(new object[]
- {
- "trackid",
- trackId,
- "amount",
- amount,
- "time",
- time
- }));
- }
- public static void PunchPosition(GameObject target, Hashtable args)
- {
- args = AMTween.CleanArgs(args);
- args["type"] = "punch";
- args["method"] = "position";
- args["easetype"] = AMTween.EaseType.punch;
- AMTween.Launch(target, args);
- }
- public static void PunchRotation(GameObject target, Vector3 amount, float time, string trackId)
- {
- AMTween.PunchRotation(target, AMTween.Hash(new object[]
- {
- "trackid",
- trackId,
- "amount",
- amount,
- "time",
- time
- }));
- }
- public static void PunchRotation(GameObject target, Hashtable args)
- {
- args = AMTween.CleanArgs(args);
- args["type"] = "punch";
- args["method"] = "rotation";
- args["easetype"] = AMTween.EaseType.punch;
- AMTween.Launch(target, args);
- }
- public static void PunchScale(GameObject target, Vector3 amount, float time, string trackId)
- {
- AMTween.PunchScale(target, AMTween.Hash(new object[]
- {
- "trackid",
- trackId,
- "amount",
- amount,
- "time",
- time
- }));
- }
- public static void PunchScale(GameObject target, Hashtable args)
- {
- args = AMTween.CleanArgs(args);
- args["type"] = "punch";
- args["method"] = "scale";
- args["easetype"] = AMTween.EaseType.punch;
- AMTween.Launch(target, args);
- }
- private void GenerateTargets()
- {
- string text = this.type;
- switch (text)
- {
- case "value":
- {
- string text2 = this.method;
- if (text2 != null)
- {
- if (!(text2 == "float"))
- {
- if (!(text2 == "vector2"))
- {
- if (!(text2 == "vector3"))
- {
- if (!(text2 == "color"))
- {
- if (text2 == "rect")
- {
- this.GenerateRectTargets();
- this.apply = new AMTween.ApplyTween(this.ApplyRectTargets);
- }
- }
- else
- {
- this.GenerateColorTargets();
- this.apply = new AMTween.ApplyTween(this.ApplyColorTargets);
- }
- }
- else
- {
- this.GenerateVector3Targets();
- this.apply = new AMTween.ApplyTween(this.ApplyVector3Targets);
- }
- }
- else
- {
- this.GenerateVector2Targets();
- this.apply = new AMTween.ApplyTween(this.ApplyVector2Targets);
- }
- }
- else
- {
- this.GenerateFloatTargets();
- this.apply = new AMTween.ApplyTween(this.ApplyFloatTargets);
- }
- }
- break;
- }
- case "property":
- {
- string text3 = this.method;
- if (text3 != null)
- {
- if (!(text3 == "morph"))
- {
- if (!(text3 == "float"))
- {
- if (!(text3 == "vector2"))
- {
- if (!(text3 == "vector3"))
- {
- if (!(text3 == "color"))
- {
- if (text3 == "rect")
- {
- this.GenerateRectTargets();
- this.apply = new AMTween.ApplyTween(this.ApplyPropertyRectTargets);
- }
- }
- else
- {
- this.GenerateColorTargets();
- this.apply = new AMTween.ApplyTween(this.ApplyPropertyColorTargets);
- }
- }
- else
- {
- this.GenerateVector3Targets();
- this.apply = new AMTween.ApplyTween(this.ApplyPropertyVector3Targets);
- }
- }
- else
- {
- this.GenerateVector2Targets();
- this.apply = new AMTween.ApplyTween(this.ApplyPropertyVector2Targets);
- }
- }
- else
- {
- this.GenerateFloatTargets();
- this.apply = new AMTween.ApplyTween(this.ApplyPropertyFloatTargets);
- }
- }
- else
- {
- this.GenerateMorphTargets();
- this.apply = new AMTween.ApplyTween(this.ApplyPropertyMorphTargets);
- }
- }
- break;
- }
- case "color":
- {
- string text4 = this.method;
- if (text4 != null)
- {
- if (text4 == "to")
- {
- this.GenerateColorToTargets();
- this.apply = new AMTween.ApplyTween(this.ApplyColorToTargets);
- }
- }
- break;
- }
- case "audio":
- {
- string text5 = this.method;
- if (text5 != null)
- {
- if (text5 == "to")
- {
- this.GenerateAudioToTargets();
- this.apply = new AMTween.ApplyTween(this.ApplyAudioToTargets);
- }
- }
- break;
- }
- case "move":
- {
- string text6 = this.method;
- if (text6 != null)
- {
- if (!(text6 == "to"))
- {
- if (text6 == "by" || text6 == "add")
- {
- this.GenerateMoveByTargets();
- this.apply = new AMTween.ApplyTween(this.ApplyMoveByTargets);
- }
- }
- else if (this.tweenArguments.Contains("path"))
- {
- this.GenerateMoveToPathTargets();
- this.apply = new AMTween.ApplyTween(this.ApplyMoveToPathTargets);
- }
- else
- {
- this.GenerateMoveToTargets();
- this.apply = new AMTween.ApplyTween(this.ApplyMoveToTargets);
- }
- }
- break;
- }
- case "scale":
- {
- string text7 = this.method;
- if (text7 != null)
- {
- if (!(text7 == "to"))
- {
- if (!(text7 == "by"))
- {
- if (text7 == "add")
- {
- this.GenerateScaleAddTargets();
- this.apply = new AMTween.ApplyTween(this.ApplyScaleToTargets);
- }
- }
- else
- {
- this.GenerateScaleByTargets();
- this.apply = new AMTween.ApplyTween(this.ApplyScaleToTargets);
- }
- }
- else
- {
- this.GenerateScaleToTargets();
- this.apply = new AMTween.ApplyTween(this.ApplyScaleToTargets);
- }
- }
- break;
- }
- case "rotate":
- {
- string text8 = this.method;
- if (text8 != null)
- {
- if (!(text8 == "to"))
- {
- if (!(text8 == "add"))
- {
- if (text8 == "by")
- {
- this.GenerateRotateByTargets();
- this.apply = new AMTween.ApplyTween(this.ApplyRotateAddTargets);
- }
- }
- else
- {
- this.GenerateRotateAddTargets();
- this.apply = new AMTween.ApplyTween(this.ApplyRotateAddTargets);
- }
- }
- else
- {
- this.GenerateRotateToTargets();
- this.apply = new AMTween.ApplyTween(this.ApplyRotateToTargets);
- }
- }
- break;
- }
- case "shake":
- {
- string text9 = this.method;
- if (text9 != null)
- {
- if (!(text9 == "position"))
- {
- if (!(text9 == "scale"))
- {
- if (text9 == "rotation")
- {
- this.GenerateShakeRotationTargets();
- this.apply = new AMTween.ApplyTween(this.ApplyShakeRotationTargets);
- }
- }
- else
- {
- this.GenerateShakeScaleTargets();
- this.apply = new AMTween.ApplyTween(this.ApplyShakeScaleTargets);
- }
- }
- else
- {
- this.GenerateShakePositionTargets();
- this.apply = new AMTween.ApplyTween(this.ApplyShakePositionTargets);
- }
- }
- break;
- }
- case "punch":
- {
- string text10 = this.method;
- if (text10 != null)
- {
- if (!(text10 == "position"))
- {
- if (!(text10 == "rotation"))
- {
- if (text10 == "scale")
- {
- this.GeneratePunchScaleTargets();
- this.apply = new AMTween.ApplyTween(this.ApplyPunchScaleTargets);
- }
- }
- else
- {
- this.GeneratePunchRotationTargets();
- this.apply = new AMTween.ApplyTween(this.ApplyPunchRotationTargets);
- }
- }
- else
- {
- this.GeneratePunchPositionTargets();
- this.apply = new AMTween.ApplyTween(this.ApplyPunchPositionTargets);
- }
- }
- break;
- }
- case "look":
- {
- string text11 = this.method;
- if (text11 != null)
- {
- if (!(text11 == "to"))
- {
- if (!(text11 == "follow"))
- {
- if (text11 == "tofollow")
- {
- this.GenerateLookToFollowTargets();
- this.apply = new AMTween.ApplyTween(this.ApplyLookToFollowTargets);
- }
- }
- else
- {
- this.apply = new AMTween.ApplyTween(this.ApplyLookFollowTargets);
- }
- }
- else
- {
- this.GenerateLookToTargets();
- this.apply = new AMTween.ApplyTween(this.ApplyLookToTargets);
- }
- }
- break;
- }
- case "stab":
- this.GenerateStabTargets();
- this.apply = new AMTween.ApplyTween(this.ApplyStabTargets);
- break;
- case "play":
- {
- string text12 = this.method;
- if (text12 != null)
- {
- if (!(text12 == "audio"))
- {
- if (text12 == "animation")
- {
- this.GeneratePlayAnimationTargets();
- }
- }
- else
- {
- this.GeneratePlayAudioTargets();
- }
- }
- break;
- }
- case "camerafade":
- if ((int)this.tweenArguments["camerafadetype"] == 5)
- {
- this.GenerateCameraFadeNoneTargets();
- }
- else
- {
- this.GenerateCameraFadeTargets();
- this.apply = new AMTween.ApplyTween(this.ApplyCameraFadeValueTargets);
- }
- break;
- }
- }
- private void GenerateCameraFadeNoneTargets()
- {
- if (this.tweenArguments.Contains("camera2"))
- {
- AMTween.SetTopCamera((Camera)this.tweenArguments["camera2"], (Camera[])this.tweenArguments["allcameras"]);
- }
- else if (this.tweenArguments.Contains("color2"))
- {
- AMTween.ShowColor((Color)this.tweenArguments["color2"]);
- }
- this.Dispose();
- }
- private void GenerateCameraFadeTargets()
- {
- if (AMTween.cf.keepAliveColor)
- {
- AMTween.cf.keepAliveColor = false;
- }
- AMTween.cf.isReset = false;
- bool flag = (bool)this.tweenArguments["reversed"];
- Camera camera = null;
- Camera camera2 = null;
- Color? color = null;
- Color? color2 = null;
- if (!flag)
- {
- if (this.tweenArguments.Contains("camera1"))
- {
- camera = (Camera)this.tweenArguments["camera1"];
- }
- else if (this.tweenArguments.Contains("color1"))
- {
- color = new Color?((Color)this.tweenArguments["color1"]);
- }
- if (this.tweenArguments.Contains("camera2"))
- {
- camera2 = (Camera)this.tweenArguments["camera2"];
- }
- else if (this.tweenArguments.Contains("color2"))
- {
- color2 = new Color?((Color)this.tweenArguments["color2"]);
- }
- }
- else
- {
- if (this.tweenArguments.Contains("camera2"))
- {
- camera = (Camera)this.tweenArguments["camera2"];
- }
- else if (this.tweenArguments.Contains("color2"))
- {
- color = new Color?((Color)this.tweenArguments["color2"]);
- }
- if (this.tweenArguments.Contains("camera1"))
- {
- camera2 = (Camera)this.tweenArguments["camera1"];
- }
- else if (this.tweenArguments.Contains("color1"))
- {
- color2 = new Color?((Color)this.tweenArguments["color1"]);
- }
- }
- if (camera)
- {
- if ((bool)this.tweenArguments["userendertex"])
- {
- AMTween.cf.setupRenderTexture(camera);
- }
- else
- {
- AMTween.SetTopCamera(camera, (Camera[])this.tweenArguments["allcameras"]);
- camera.Render();
- AMTween.cf.clearTexture2D();
- AMTween.cf.tex2d = AMTween.GetScreenTexture();
- AMTween.cf.useRenderTexture = false;
- AMTween.cf.hasColorTex = false;
- }
- }
- else
- {
- AMTween.cf.colorTex = color.Value;
- AMTween.cf.hasColorTex = true;
- }
- if (camera2)
- {
- AMTween.SetTopCamera(camera2, (Camera[])this.tweenArguments["allcameras"]);
- AMTween.cf.hasColorBG = false;
- }
- else
- {
- AMTween.cf.colorBG = color2.Value;
- AMTween.cf.hasColorBG = true;
- }
- if (this.tweenArguments.Contains("texture"))
- {
- AMTween.cf.irisShape = (Texture2D)this.tweenArguments["texture"];
- }
- AMTween.cf.mode = (int)this.tweenArguments["camerafadetype"];
- AMTween.cf.setupMaterials();
- AMTween.cf.r = (float[])this.tweenArguments["parameters"];
- AMTween.cf.value = 1f;
- AMTween.cf.percent = 0f;
- }
- private void GeneratePlayAnimationTargets()
- {
- if ((WrapMode)this.tweenArguments["wrapmode"] != WrapMode.Once)
- {
- this.time = float.PositiveInfinity;
- }
- else
- {
- this.time = (this.tweenArguments["target"] as GameObject).GetComponent<Animation>().GetClip((string)this.tweenArguments["animation"]).length;
- }
- }
- private void GeneratePlayAudioTargets()
- {
- if ((bool)this.tweenArguments["loop"])
- {
- this.time = float.PositiveInfinity;
- }
- else
- {
- this.time = (this.tweenArguments["audioclip"] as AudioClip).length - this.runningTime;
- }
- }
- private void GenerateMorphTargets()
- {
- this.startMorphs = (float[])this.tweenArguments["from"];
- this.endMorphs = (float[])this.tweenArguments["to"];
- this.currentMorphs = new float[this.startMorphs.Length];
- for (int i = 0; i < this.startMorphs.Length; i++)
- {
- this.currentMorphs[i] = this.startMorphs[i];
- }
- if (this.tweenArguments.Contains("speed"))
- {
- float num = Math.Abs(this.floats[0] - this.floats[1]);
- this.time = num / (float)this.tweenArguments["speed"];
- }
- }
- private void GenerateRectTargets()
- {
- this.rects = new Rect[3];
- this.rects[0] = (Rect)this.tweenArguments["from"];
- this.rects[1] = (Rect)this.tweenArguments["to"];
- }
- private void GenerateColorTargets()
- {
- this.colors = new Color[1, 3];
- this.colors[0, 0] = (Color)this.tweenArguments["from"];
- this.colors[0, 1] = (Color)this.tweenArguments["to"];
- }
- private void GenerateVector3Targets()
- {
- this.vector3s = new Vector3[3];
- this.vector3s[0] = (Vector3)this.tweenArguments["from"];
- this.vector3s[1] = (Vector3)this.tweenArguments["to"];
- if (this.tweenArguments.Contains("speed"))
- {
- float num = Math.Abs(Vector3.Distance(this.vector3s[0], this.vector3s[1]));
- this.time = num / (float)this.tweenArguments["speed"];
- }
- }
- private void GenerateVector2Targets()
- {
- this.vector2s = new Vector2[3];
- this.vector2s[0] = (Vector2)this.tweenArguments["from"];
- this.vector2s[1] = (Vector2)this.tweenArguments["to"];
- if (this.tweenArguments.Contains("speed"))
- {
- Vector3 a = new Vector3(this.vector2s[0].x, this.vector2s[0].y, 0f);
- Vector3 b = new Vector3(this.vector2s[1].x, this.vector2s[1].y, 0f);
- float num = Math.Abs(Vector3.Distance(a, b));
- this.time = num / (float)this.tweenArguments["speed"];
- }
- }
- private void GenerateFloatTargets()
- {
- this.floats = new float[3];
- this.floats[0] = (float)this.tweenArguments["from"];
- this.floats[1] = (float)this.tweenArguments["to"];
- if (this.tweenArguments.Contains("speed"))
- {
- float num = Math.Abs(this.floats[0] - this.floats[1]);
- this.time = num / (float)this.tweenArguments["speed"];
- }
- }
- private void GenerateColorToTargets()
- {
- if (base.GetComponent(typeof(GUITexture)))
- {
- this.colors = new Color[1, 3];
- this.colors[0, 0] = (this.colors[0, 1] = base.GetComponent<GUITexture>().color);
- }
- else if (base.GetComponent(typeof(GUIText)))
- {
- this.colors = new Color[1, 3];
- this.colors[0, 0] = (this.colors[0, 1] = base.GetComponent<GUIText>().material.color);
- }
- else if (base.GetComponent<Renderer>())
- {
- Renderer component = base.GetComponent<Renderer>();
- this.colors = new Color[component.materials.Length, 3];
- for (int i = 0; i < component.materials.Length; i++)
- {
- this.colors[i, 0] = component.materials[i].GetColor(this.namedcolorvalue.ToString());
- this.colors[i, 1] = component.materials[i].GetColor(this.namedcolorvalue.ToString());
- }
- }
- else if (base.GetComponent<Light>())
- {
- this.colors = new Color[1, 3];
- this.colors[0, 0] = (this.colors[0, 1] = base.GetComponent<Light>().color);
- }
- else
- {
- this.colors = new Color[1, 3];
- }
- if (this.tweenArguments.Contains("color"))
- {
- for (int j = 0; j < this.colors.GetLength(0); j++)
- {
- this.colors[j, 1] = (Color)this.tweenArguments["color"];
- }
- }
- else
- {
- if (this.tweenArguments.Contains("r"))
- {
- for (int k = 0; k < this.colors.GetLength(0); k++)
- {
- this.colors[k, 1].r = (float)this.tweenArguments["r"];
- }
- }
- if (this.tweenArguments.Contains("g"))
- {
- for (int l = 0; l < this.colors.GetLength(0); l++)
- {
- this.colors[l, 1].g = (float)this.tweenArguments["g"];
- }
- }
- if (this.tweenArguments.Contains("b"))
- {
- for (int m = 0; m < this.colors.GetLength(0); m++)
- {
- this.colors[m, 1].b = (float)this.tweenArguments["b"];
- }
- }
- if (this.tweenArguments.Contains("a"))
- {
- for (int n = 0; n < this.colors.GetLength(0); n++)
- {
- this.colors[n, 1].a = (float)this.tweenArguments["a"];
- }
- }
- }
- if (this.tweenArguments.Contains("amount"))
- {
- for (int num = 0; num < this.colors.GetLength(0); num++)
- {
- this.colors[num, 1].a = (float)this.tweenArguments["amount"];
- }
- }
- else if (this.tweenArguments.Contains("alpha"))
- {
- for (int num2 = 0; num2 < this.colors.GetLength(0); num2++)
- {
- this.colors[num2, 1].a = (float)this.tweenArguments["alpha"];
- }
- }
- }
- private void GenerateAudioToTargets()
- {
- this.vector2s = new Vector2[3];
- if (this.tweenArguments.Contains("audiosource"))
- {
- this.audioSource = (AudioSource)this.tweenArguments["audiosource"];
- }
- else if (base.GetComponent(typeof(AudioSource)))
- {
- this.audioSource = base.GetComponent<AudioSource>();
- }
- else
- {
- Debug.LogError("AMTween Error: AudioTo requires an AudioSource.");
- this.Dispose();
- }
- this.vector2s[0] = (this.vector2s[1] = new Vector2(this.audioSource.volume, this.audioSource.pitch));
- if (this.tweenArguments.Contains("volume"))
- {
- this.vector2s[1].x = (float)this.tweenArguments["volume"];
- }
- if (this.tweenArguments.Contains("pitch"))
- {
- this.vector2s[1].y = (float)this.tweenArguments["pitch"];
- }
- }
- private void GenerateStabTargets()
- {
- if (this.tweenArguments.Contains("audiosource"))
- {
- this.audioSource = (AudioSource)this.tweenArguments["audiosource"];
- }
- else if (base.GetComponent(typeof(AudioSource)))
- {
- this.audioSource = base.GetComponent<AudioSource>();
- }
- else
- {
- base.gameObject.AddComponent(typeof(AudioSource));
- this.audioSource = base.GetComponent<AudioSource>();
- this.audioSource.playOnAwake = false;
- }
- this.audioSource.clip = (AudioClip)this.tweenArguments["audioclip"];
- if (this.tweenArguments.Contains("pitch"))
- {
- this.audioSource.pitch = (float)this.tweenArguments["pitch"];
- }
- if (this.tweenArguments.Contains("volume"))
- {
- this.audioSource.volume = (float)this.tweenArguments["volume"];
- }
- this.time = this.audioSource.clip.length / this.audioSource.pitch;
- }
- private void GenerateLookToFollowTargets()
- {
- this.vector3s = new Vector3[3];
- this.vector3s[0] = base.transform.eulerAngles;
- if (!this.tweenArguments.Contains("looktarget") && !this.tweenArguments.Contains("targetrotation"))
- {
- Debug.LogError("AMTween Error: LookTo needs a 'looktarget' pr 'targetrotation' property!");
- this.Dispose();
- }
- }
- private void GenerateLookToTargets()
- {
- this.vector3s = new Vector3[3];
- this.vector3s[0] = base.transform.eulerAngles;
- if (this.tweenArguments.Contains("looktarget"))
- {
- if (this.tweenArguments["looktarget"].GetType() == typeof(Transform))
- {
- Transform transform = base.transform;
- Transform target = (Transform)this.tweenArguments["looktarget"];
- Vector3? vector = (Vector3?)this.tweenArguments["up"];
- transform.LookAt(target, (vector == null) ? AMTween.Defaults.up : vector.Value);
- }
- else if (this.tweenArguments["looktarget"].GetType() == typeof(Vector3))
- {
- Transform transform2 = base.transform;
- Vector3 worldPosition = (Vector3)this.tweenArguments["looktarget"];
- Vector3? vector2 = (Vector3?)this.tweenArguments["up"];
- transform2.LookAt(worldPosition, (vector2 == null) ? AMTween.Defaults.up : vector2.Value);
- }
- }
- else
- {
- Debug.LogError("AMTween Error: LookTo needs a 'looktarget' property!");
- this.Dispose();
- }
- this.vector3s[1] = base.transform.eulerAngles;
- base.transform.eulerAngles = this.vector3s[0];
- if (this.tweenArguments.Contains("axis"))
- {
- string text = (string)this.tweenArguments["axis"];
- if (text != null)
- {
- if (!(text == "x"))
- {
- if (!(text == "y"))
- {
- if (text == "z")
- {
- this.vector3s[1].x = this.vector3s[0].x;
- this.vector3s[1].y = this.vector3s[0].y;
- }
- }
- else
- {
- this.vector3s[1].x = this.vector3s[0].x;
- this.vector3s[1].z = this.vector3s[0].z;
- }
- }
- else
- {
- this.vector3s[1].y = this.vector3s[0].y;
- this.vector3s[1].z = this.vector3s[0].z;
- }
- }
- }
- 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));
- if (this.tweenArguments.Contains("speed"))
- {
- float num = Math.Abs(Vector3.Distance(this.vector3s[0], this.vector3s[1]));
- this.time = num / (float)this.tweenArguments["speed"];
- }
- }
- private void GenerateMoveToPathTargets()
- {
- Vector3[] array2;
- if (this.tweenArguments["path"].GetType() == typeof(Vector3[]))
- {
- Vector3[] array = (Vector3[])this.tweenArguments["path"];
- if (array.Length == 1)
- {
- Debug.LogError("AMTween Error: Attempting a path movement with MoveTo requires an array of more than 1 entry!");
- this.Dispose();
- }
- array2 = new Vector3[array.Length];
- Array.Copy(array, array2, array.Length);
- }
- else
- {
- Transform[] array3 = (Transform[])this.tweenArguments["path"];
- if (array3.Length == 1)
- {
- Debug.LogError("AMTween Error: Attempting a path movement with MoveTo requires an array of more than 1 entry!");
- this.Dispose();
- }
- array2 = new Vector3[array3.Length];
- for (int i = 0; i < array3.Length; i++)
- {
- array2[i] = array3[i].position;
- }
- }
- bool flag;
- int num;
- if (base.transform.position != array2[0])
- {
- if (!this.tweenArguments.Contains("movetopath") || (bool)this.tweenArguments["movetopath"])
- {
- flag = true;
- num = 3;
- }
- else
- {
- flag = false;
- num = 2;
- }
- }
- else
- {
- flag = false;
- num = 2;
- }
- this.vector3s = new Vector3[array2.Length + num];
- if (flag)
- {
- this.vector3s[1] = base.transform.position;
- num = 2;
- }
- else
- {
- num = 1;
- }
- Array.Copy(array2, 0, this.vector3s, num, array2.Length);
- this.vector3s[0] = this.vector3s[1] + (this.vector3s[1] - this.vector3s[2]);
- this.vector3s[this.vector3s.Length - 1] = this.vector3s[this.vector3s.Length - 2] + (this.vector3s[this.vector3s.Length - 2] - this.vector3s[this.vector3s.Length - 3]);
- if (this.vector3s[1] == this.vector3s[this.vector3s.Length - 2])
- {
- Vector3[] array4 = new Vector3[this.vector3s.Length];
- Array.Copy(this.vector3s, array4, this.vector3s.Length);
- array4[0] = array4[array4.Length - 3];
- array4[array4.Length - 1] = array4[2];
- this.vector3s = new Vector3[array4.Length];
- Array.Copy(array4, this.vector3s, array4.Length);
- }
- this.path = new AMTween.CRSpline(this.vector3s);
- if (this.tweenArguments.Contains("speed"))
- {
- float num2 = AMTween.PathLength(this.vector3s);
- this.time = num2 / (float)this.tweenArguments["speed"];
- }
- }
- private void GenerateMoveToTargets()
- {
- this.vector3s = new Vector3[3];
- if (this.isLocal)
- {
- this.vector3s[0] = (this.vector3s[1] = base.transform.localPosition);
- }
- else
- {
- this.vector3s[0] = (this.vector3s[1] = base.transform.position);
- }
- if (this.tweenArguments.Contains("position"))
- {
- if (this.tweenArguments["position"].GetType() == typeof(Transform))
- {
- Transform transform = (Transform)this.tweenArguments["position"];
- this.vector3s[1] = transform.position;
- }
- else if (this.tweenArguments["position"].GetType() == typeof(Vector3))
- {
- this.vector3s[1] = (Vector3)this.tweenArguments["position"];
- }
- }
- else
- {
- if (this.tweenArguments.Contains("x"))
- {
- this.vector3s[1].x = (float)this.tweenArguments["x"];
- }
- if (this.tweenArguments.Contains("y"))
- {
- this.vector3s[1].y = (float)this.tweenArguments["y"];
- }
- if (this.tweenArguments.Contains("z"))
- {
- this.vector3s[1].z = (float)this.tweenArguments["z"];
- }
- }
- if (this.tweenArguments.Contains("orienttopath") && (bool)this.tweenArguments["orienttopath"])
- {
- this.tweenArguments["looktarget"] = this.vector3s[1];
- }
- if (this.tweenArguments.Contains("speed"))
- {
- float num = Math.Abs(Vector3.Distance(this.vector3s[0], this.vector3s[1]));
- this.time = num / (float)this.tweenArguments["speed"];
- }
- }
- private void GenerateMoveByTargets()
- {
- this.vector3s = new Vector3[6];
- this.vector3s[4] = base.transform.eulerAngles;
- this.vector3s[0] = (this.vector3s[1] = (this.vector3s[3] = base.transform.position));
- if (this.tweenArguments.Contains("amount"))
- {
- this.vector3s[1] = this.vector3s[0] + (Vector3)this.tweenArguments["amount"];
- }
- else
- {
- if (this.tweenArguments.Contains("x"))
- {
- this.vector3s[1].x = this.vector3s[0].x + (float)this.tweenArguments["x"];
- }
- if (this.tweenArguments.Contains("y"))
- {
- this.vector3s[1].y = this.vector3s[0].y + (float)this.tweenArguments["y"];
- }
- if (this.tweenArguments.Contains("z"))
- {
- this.vector3s[1].z = this.vector3s[0].z + (float)this.tweenArguments["z"];
- }
- }
- base.transform.Translate(this.vector3s[1], this.space);
- this.vector3s[5] = base.transform.position;
- base.transform.position = this.vector3s[0];
- if (this.tweenArguments.Contains("orienttopath") && (bool)this.tweenArguments["orienttopath"])
- {
- this.tweenArguments["looktarget"] = this.vector3s[1];
- }
- if (this.tweenArguments.Contains("speed"))
- {
- float num = Math.Abs(Vector3.Distance(this.vector3s[0], this.vector3s[1]));
- this.time = num / (float)this.tweenArguments["speed"];
- }
- }
- private void GenerateScaleToTargets()
- {
- this.vector3s = new Vector3[3];
- this.vector3s[0] = (this.vector3s[1] = base.transform.localScale);
- if (this.tweenArguments.Contains("scale"))
- {
- if (this.tweenArguments["scale"].GetType() == typeof(Transform))
- {
- Transform transform = (Transform)this.tweenArguments["scale"];
- this.vector3s[1] = transform.localScale;
- }
- else if (this.tweenArguments["scale"].GetType() == typeof(Vector3))
- {
- this.vector3s[1] = (Vector3)this.tweenArguments["scale"];
- }
- }
- else
- {
- if (this.tweenArguments.Contains("x"))
- {
- this.vector3s[1].x = (float)this.tweenArguments["x"];
- }
- if (this.tweenArguments.Contains("y"))
- {
- this.vector3s[1].y = (float)this.tweenArguments["y"];
- }
- if (this.tweenArguments.Contains("z"))
- {
- this.vector3s[1].z = (float)this.tweenArguments["z"];
- }
- }
- if (this.tweenArguments.Contains("speed"))
- {
- float num = Math.Abs(Vector3.Distance(this.vector3s[0], this.vector3s[1]));
- this.time = num / (float)this.tweenArguments["speed"];
- }
- }
- private void GenerateScaleByTargets()
- {
- this.vector3s = new Vector3[3];
- this.vector3s[0] = (this.vector3s[1] = base.transform.localScale);
- if (this.tweenArguments.Contains("amount"))
- {
- this.vector3s[1] = Vector3.Scale(this.vector3s[1], (Vector3)this.tweenArguments["amount"]);
- }
- else
- {
- if (this.tweenArguments.Contains("x"))
- {
- Vector3[] array = this.vector3s;
- int num = 1;
- array[num].x = array[num].x * (float)this.tweenArguments["x"];
- }
- if (this.tweenArguments.Contains("y"))
- {
- Vector3[] array2 = this.vector3s;
- int num2 = 1;
- array2[num2].y = array2[num2].y * (float)this.tweenArguments["y"];
- }
- if (this.tweenArguments.Contains("z"))
- {
- Vector3[] array3 = this.vector3s;
- int num3 = 1;
- array3[num3].z = array3[num3].z * (float)this.tweenArguments["z"];
- }
- }
- if (this.tweenArguments.Contains("speed"))
- {
- float num4 = Math.Abs(Vector3.Distance(this.vector3s[0], this.vector3s[1]));
- this.time = num4 / (float)this.tweenArguments["speed"];
- }
- }
- private void GenerateScaleAddTargets()
- {
- this.vector3s = new Vector3[3];
- this.vector3s[0] = (this.vector3s[1] = base.transform.localScale);
- if (this.tweenArguments.Contains("amount"))
- {
- this.vector3s[1] += (Vector3)this.tweenArguments["amount"];
- }
- else
- {
- if (this.tweenArguments.Contains("x"))
- {
- Vector3[] array = this.vector3s;
- int num = 1;
- array[num].x = array[num].x + (float)this.tweenArguments["x"];
- }
- if (this.tweenArguments.Contains("y"))
- {
- Vector3[] array2 = this.vector3s;
- int num2 = 1;
- array2[num2].y = array2[num2].y + (float)this.tweenArguments["y"];
- }
- if (this.tweenArguments.Contains("z"))
- {
- Vector3[] array3 = this.vector3s;
- int num3 = 1;
- array3[num3].z = array3[num3].z + (float)this.tweenArguments["z"];
- }
- }
- if (this.tweenArguments.Contains("speed"))
- {
- float num4 = Math.Abs(Vector3.Distance(this.vector3s[0], this.vector3s[1]));
- this.time = num4 / (float)this.tweenArguments["speed"];
- }
- }
- private void GenerateRotateToTargets()
- {
- this.vector3s = new Vector3[3];
- if (this.isLocal)
- {
- this.vector3s[0] = (this.vector3s[1] = base.transform.localEulerAngles);
- }
- else
- {
- this.vector3s[0] = (this.vector3s[1] = base.transform.eulerAngles);
- }
- if (this.tweenArguments.Contains("rotation"))
- {
- if (this.tweenArguments["rotation"].GetType() == typeof(Transform))
- {
- Transform transform = (Transform)this.tweenArguments["rotation"];
- this.vector3s[1] = transform.eulerAngles;
- }
- else if (this.tweenArguments["rotation"].GetType() == typeof(Vector3))
- {
- this.vector3s[1] = (Vector3)this.tweenArguments["rotation"];
- }
- }
- else
- {
- if (this.tweenArguments.Contains("x"))
- {
- this.vector3s[1].x = (float)this.tweenArguments["x"];
- }
- if (this.tweenArguments.Contains("y"))
- {
- this.vector3s[1].y = (float)this.tweenArguments["y"];
- }
- if (this.tweenArguments.Contains("z"))
- {
- this.vector3s[1].z = (float)this.tweenArguments["z"];
- }
- }
- 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));
- if (this.tweenArguments.Contains("speed"))
- {
- float num = Math.Abs(Vector3.Distance(this.vector3s[0], this.vector3s[1]));
- this.time = num / (float)this.tweenArguments["speed"];
- }
- }
- private void GenerateRotateAddTargets()
- {
- this.vector3s = new Vector3[5];
- this.vector3s[0] = (this.vector3s[1] = (this.vector3s[3] = base.transform.eulerAngles));
- if (this.tweenArguments.Contains("amount"))
- {
- this.vector3s[1] += (Vector3)this.tweenArguments["amount"];
- }
- else
- {
- if (this.tweenArguments.Contains("x"))
- {
- Vector3[] array = this.vector3s;
- int num = 1;
- array[num].x = array[num].x + (float)this.tweenArguments["x"];
- }
- if (this.tweenArguments.Contains("y"))
- {
- Vector3[] array2 = this.vector3s;
- int num2 = 1;
- array2[num2].y = array2[num2].y + (float)this.tweenArguments["y"];
- }
- if (this.tweenArguments.Contains("z"))
- {
- Vector3[] array3 = this.vector3s;
- int num3 = 1;
- array3[num3].z = array3[num3].z + (float)this.tweenArguments["z"];
- }
- }
- if (this.tweenArguments.Contains("speed"))
- {
- float num4 = Math.Abs(Vector3.Distance(this.vector3s[0], this.vector3s[1]));
- this.time = num4 / (float)this.tweenArguments["speed"];
- }
- }
- private void GenerateRotateByTargets()
- {
- this.vector3s = new Vector3[4];
- this.vector3s[0] = (this.vector3s[1] = (this.vector3s[3] = base.transform.eulerAngles));
- if (this.tweenArguments.Contains("amount"))
- {
- this.vector3s[1] += Vector3.Scale((Vector3)this.tweenArguments["amount"], new Vector3(360f, 360f, 360f));
- }
- else
- {
- if (this.tweenArguments.Contains("x"))
- {
- Vector3[] array = this.vector3s;
- int num = 1;
- array[num].x = array[num].x + 360f * (float)this.tweenArguments["x"];
- }
- if (this.tweenArguments.Contains("y"))
- {
- Vector3[] array2 = this.vector3s;
- int num2 = 1;
- array2[num2].y = array2[num2].y + 360f * (float)this.tweenArguments["y"];
- }
- if (this.tweenArguments.Contains("z"))
- {
- Vector3[] array3 = this.vector3s;
- int num3 = 1;
- array3[num3].z = array3[num3].z + 360f * (float)this.tweenArguments["z"];
- }
- }
- if (this.tweenArguments.Contains("speed"))
- {
- float num4 = Math.Abs(Vector3.Distance(this.vector3s[0], this.vector3s[1]));
- this.time = num4 / (float)this.tweenArguments["speed"];
- }
- }
- private void GenerateShakePositionTargets()
- {
- this.vector3s = new Vector3[4];
- this.vector3s[3] = base.transform.eulerAngles;
- this.vector3s[0] = base.transform.position;
- if (this.tweenArguments.Contains("amount"))
- {
- this.vector3s[1] = (Vector3)this.tweenArguments["amount"];
- }
- else
- {
- if (this.tweenArguments.Contains("x"))
- {
- this.vector3s[1].x = (float)this.tweenArguments["x"];
- }
- if (this.tweenArguments.Contains("y"))
- {
- this.vector3s[1].y = (float)this.tweenArguments["y"];
- }
- if (this.tweenArguments.Contains("z"))
- {
- this.vector3s[1].z = (float)this.tweenArguments["z"];
- }
- }
- }
- private void GenerateShakeScaleTargets()
- {
- this.vector3s = new Vector3[3];
- this.vector3s[0] = base.transform.localScale;
- if (this.tweenArguments.Contains("amount"))
- {
- this.vector3s[1] = (Vector3)this.tweenArguments["amount"];
- }
- else
- {
- if (this.tweenArguments.Contains("x"))
- {
- this.vector3s[1].x = (float)this.tweenArguments["x"];
- }
- if (this.tweenArguments.Contains("y"))
- {
- this.vector3s[1].y = (float)this.tweenArguments["y"];
- }
- if (this.tweenArguments.Contains("z"))
- {
- this.vector3s[1].z = (float)this.tweenArguments["z"];
- }
- }
- }
- private void GenerateShakeRotationTargets()
- {
- this.vector3s = new Vector3[3];
- this.vector3s[0] = base.transform.eulerAngles;
- if (this.tweenArguments.Contains("amount"))
- {
- this.vector3s[1] = (Vector3)this.tweenArguments["amount"];
- }
- else
- {
- if (this.tweenArguments.Contains("x"))
- {
- this.vector3s[1].x = (float)this.tweenArguments["x"];
- }
- if (this.tweenArguments.Contains("y"))
- {
- this.vector3s[1].y = (float)this.tweenArguments["y"];
- }
- if (this.tweenArguments.Contains("z"))
- {
- this.vector3s[1].z = (float)this.tweenArguments["z"];
- }
- }
- }
- private void GeneratePunchPositionTargets()
- {
- this.vector3s = new Vector3[5];
- this.vector3s[4] = base.transform.eulerAngles;
- this.vector3s[0] = base.transform.position;
- this.vector3s[1] = (this.vector3s[3] = Vector3.zero);
- if (this.tweenArguments.Contains("amount"))
- {
- this.vector3s[1] = (Vector3)this.tweenArguments["amount"];
- }
- else
- {
- if (this.tweenArguments.Contains("x"))
- {
- this.vector3s[1].x = (float)this.tweenArguments["x"];
- }
- if (this.tweenArguments.Contains("y"))
- {
- this.vector3s[1].y = (float)this.tweenArguments["y"];
- }
- if (this.tweenArguments.Contains("z"))
- {
- this.vector3s[1].z = (float)this.tweenArguments["z"];
- }
- }
- }
- private void GeneratePunchRotationTargets()
- {
- this.vector3s = new Vector3[4];
- this.vector3s[0] = base.transform.eulerAngles;
- this.vector3s[1] = (this.vector3s[3] = Vector3.zero);
- if (this.tweenArguments.Contains("amount"))
- {
- this.vector3s[1] = (Vector3)this.tweenArguments["amount"];
- }
- else
- {
- if (this.tweenArguments.Contains("x"))
- {
- this.vector3s[1].x = (float)this.tweenArguments["x"];
- }
- if (this.tweenArguments.Contains("y"))
- {
- this.vector3s[1].y = (float)this.tweenArguments["y"];
- }
- if (this.tweenArguments.Contains("z"))
- {
- this.vector3s[1].z = (float)this.tweenArguments["z"];
- }
- }
- }
- private void GeneratePunchScaleTargets()
- {
- this.vector3s = new Vector3[3];
- this.vector3s[0] = base.transform.localScale;
- this.vector3s[1] = Vector3.zero;
- if (this.tweenArguments.Contains("amount"))
- {
- this.vector3s[1] = (Vector3)this.tweenArguments["amount"];
- }
- else
- {
- if (this.tweenArguments.Contains("x"))
- {
- this.vector3s[1].x = (float)this.tweenArguments["x"];
- }
- if (this.tweenArguments.Contains("y"))
- {
- this.vector3s[1].y = (float)this.tweenArguments["y"];
- }
- if (this.tweenArguments.Contains("z"))
- {
- this.vector3s[1].z = (float)this.tweenArguments["z"];
- }
- }
- }
- private void ApplyPropertyMorphTargets()
- {
- float[] array = new float[this.startMorphs.Length];
- for (int i = 0; i < array.Length; i++)
- {
- if (this.endMorphs.Length > i && this.startMorphs[i] != this.endMorphs[i])
- {
- array[i] = this.ease(this.startMorphs[i], this.endMorphs[i], this.percentage, this.easeCurve);
- (this.tweenArguments["methodinfo"] as MethodInfo).Invoke(this.tweenArguments["component"] as Component, new object[]
- {
- i,
- array[i]
- });
- }
- }
- if (this.percentage == 1f)
- {
- this.tweenArguments["onupdateparams"] = this.endMorphs;
- }
- }
- private void ApplyRectTargets()
- {
- this.rects[2].x = this.ease(this.rects[0].x, this.rects[1].x, this.percentage, this.easeCurve);
- this.rects[2].y = this.ease(this.rects[0].y, this.rects[1].y, this.percentage, this.easeCurve);
- this.rects[2].width = this.ease(this.rects[0].width, this.rects[1].width, this.percentage, this.easeCurve);
- this.rects[2].height = this.ease(this.rects[0].height, this.rects[1].height, this.percentage, this.easeCurve);
- this.tweenArguments["onupdateparams"] = this.rects[2];
- if (this.percentage == 1f)
- {
- this.tweenArguments["onupdateparams"] = this.rects[1];
- }
- }
- private void ApplyPropertyRectTargets()
- {
- this.rects[2].x = this.ease(this.rects[0].x, this.rects[1].x, this.percentage, this.easeCurve);
- this.rects[2].y = this.ease(this.rects[0].y, this.rects[1].y, this.percentage, this.easeCurve);
- this.rects[2].width = this.ease(this.rects[0].width, this.rects[1].width, this.percentage, this.easeCurve);
- this.rects[2].height = this.ease(this.rects[0].height, this.rects[1].height, this.percentage, this.easeCurve);
- if (this.tweenArguments["fieldinfo"] != null)
- {
- (this.tweenArguments["fieldinfo"] as FieldInfo).SetValue(this.tweenArguments["component"] as Component, this.rects[2]);
- }
- else if (this.tweenArguments["propertyinfo"] != null)
- {
- (this.tweenArguments["propertyinfo"] as PropertyInfo).SetValue(this.tweenArguments["component"] as Component, this.rects[2], null);
- }
- if (this.percentage == 1f)
- {
- this.tweenArguments["onupdateparams"] = this.rects[1];
- }
- }
- private void ApplyColorTargets()
- {
- this.colors[0, 2].r = this.ease(this.colors[0, 0].r, this.colors[0, 1].r, this.percentage, this.easeCurve);
- this.colors[0, 2].g = this.ease(this.colors[0, 0].g, this.colors[0, 1].g, this.percentage, this.easeCurve);
- this.colors[0, 2].b = this.ease(this.colors[0, 0].b, this.colors[0, 1].b, this.percentage, this.easeCurve);
- this.colors[0, 2].a = this.ease(this.colors[0, 0].a, this.colors[0, 1].a, this.percentage, this.easeCurve);
- this.tweenArguments["onupdateparams"] = this.colors[0, 2];
- if (this.percentage == 1f)
- {
- this.tweenArguments["onupdateparams"] = this.colors[0, 1];
- }
- }
- private void ApplyPropertyColorTargets()
- {
- this.colors[0, 2].r = this.ease(this.colors[0, 0].r, this.colors[0, 1].r, this.percentage, this.easeCurve);
- this.colors[0, 2].g = this.ease(this.colors[0, 0].g, this.colors[0, 1].g, this.percentage, this.easeCurve);
- this.colors[0, 2].b = this.ease(this.colors[0, 0].b, this.colors[0, 1].b, this.percentage, this.easeCurve);
- this.colors[0, 2].a = this.ease(this.colors[0, 0].a, this.colors[0, 1].a, this.percentage, this.easeCurve);
- if (this.tweenArguments["fieldinfo"] != null)
- {
- (this.tweenArguments["fieldinfo"] as FieldInfo).SetValue(this.tweenArguments["component"] as Component, this.colors[0, 2]);
- }
- else if (this.tweenArguments["propertyinfo"] != null)
- {
- (this.tweenArguments["propertyinfo"] as PropertyInfo).SetValue(this.tweenArguments["component"] as Component, this.colors[0, 2], null);
- }
- if (this.percentage == 1f)
- {
- this.tweenArguments["onupdateparams"] = this.colors[0, 1];
- }
- }
- private void ApplyVector3Targets()
- {
- this.vector3s[2].x = this.ease(this.vector3s[0].x, this.vector3s[1].x, this.percentage, this.easeCurve);
- this.vector3s[2].y = this.ease(this.vector3s[0].y, this.vector3s[1].y, this.percentage, this.easeCurve);
- this.vector3s[2].z = this.ease(this.vector3s[0].z, this.vector3s[1].z, this.percentage, this.easeCurve);
- this.tweenArguments["onupdateparams"] = this.vector3s[2];
- if (this.percentage == 1f)
- {
- this.tweenArguments["onupdateparams"] = this.vector3s[1];
- }
- }
- private void ApplyPropertyVector3Targets()
- {
- this.vector3s[2].x = this.ease(this.vector3s[0].x, this.vector3s[1].x, this.percentage, this.easeCurve);
- this.vector3s[2].y = this.ease(this.vector3s[0].y, this.vector3s[1].y, this.percentage, this.easeCurve);
- this.vector3s[2].z = this.ease(this.vector3s[0].z, this.vector3s[1].z, this.percentage, this.easeCurve);
- if (this.tweenArguments["fieldinfo"] != null)
- {
- (this.tweenArguments["fieldinfo"] as FieldInfo).SetValue(this.tweenArguments["component"] as Component, this.vector3s[2]);
- }
- else if (this.tweenArguments["propertyinfo"] != null)
- {
- (this.tweenArguments["propertyinfo"] as PropertyInfo).SetValue(this.tweenArguments["component"] as Component, this.vector3s[2], null);
- }
- if (this.percentage == 1f)
- {
- this.tweenArguments["onupdateparams"] = this.vector3s[1];
- }
- }
- private void ApplyVector2Targets()
- {
- this.vector2s[2].x = this.ease(this.vector2s[0].x, this.vector2s[1].x, this.percentage, this.easeCurve);
- this.vector2s[2].y = this.ease(this.vector2s[0].y, this.vector2s[1].y, this.percentage, this.easeCurve);
- this.tweenArguments["onupdateparams"] = this.vector2s[2];
- if (this.percentage == 1f)
- {
- this.tweenArguments["onupdateparams"] = this.vector2s[1];
- }
- }
- private void ApplyPropertyVector2Targets()
- {
- this.vector2s[2].x = this.ease(this.vector2s[0].x, this.vector2s[1].x, this.percentage, this.easeCurve);
- this.vector2s[2].y = this.ease(this.vector2s[0].y, this.vector2s[1].y, this.percentage, this.easeCurve);
- if (this.tweenArguments["fieldinfo"] != null)
- {
- (this.tweenArguments["fieldinfo"] as FieldInfo).SetValue(this.tweenArguments["component"] as Component, this.vector2s[2]);
- }
- else if (this.tweenArguments["propertyinfo"] != null)
- {
- (this.tweenArguments["propertyinfo"] as PropertyInfo).SetValue(this.tweenArguments["component"] as Component, this.vector2s[2], null);
- }
- if (this.percentage == 1f)
- {
- this.tweenArguments["onupdateparams"] = this.vector2s[1];
- }
- }
- private void ApplyFloatTargets()
- {
- this.floats[2] = this.ease(this.floats[0], this.floats[1], this.percentage, this.easeCurve);
- this.tweenArguments["onupdateparams"] = this.floats[2];
- if (this.percentage == 1f)
- {
- this.tweenArguments["onupdateparams"] = this.floats[1];
- }
- }
- private void ApplyPropertyFloatTargets()
- {
- this.floats[2] = this.ease(this.floats[0], this.floats[1], this.percentage, this.easeCurve);
- if (this.tweenArguments["fieldinfo"] != null)
- {
- if ((this.tweenArguments["fieldinfo"] as FieldInfo).FieldType == typeof(int))
- {
- (this.tweenArguments["fieldinfo"] as FieldInfo).SetValue(this.tweenArguments["component"] as Component, (int)this.floats[2]);
- }
- else
- {
- (this.tweenArguments["fieldinfo"] as FieldInfo).SetValue(this.tweenArguments["component"] as Component, this.floats[2]);
- }
- }
- else if (this.tweenArguments["propertyinfo"] != null)
- {
- if ((this.tweenArguments["propertyinfo"] as PropertyInfo).PropertyType == typeof(int))
- {
- (this.tweenArguments["propertyinfo"] as PropertyInfo).SetValue(this.tweenArguments["component"] as Component, (int)this.floats[2], null);
- }
- else
- {
- (this.tweenArguments["propertyinfo"] as PropertyInfo).SetValue(this.tweenArguments["component"] as Component, this.floats[2], null);
- }
- }
- if (this.percentage == 1f)
- {
- this.tweenArguments["onupdateparams"] = this.floats[1];
- }
- }
- private void ApplyColorToTargets()
- {
- for (int i = 0; i < this.colors.GetLength(0); i++)
- {
- this.colors[i, 2].r = this.ease(this.colors[i, 0].r, this.colors[i, 1].r, this.percentage, this.easeCurve);
- this.colors[i, 2].g = this.ease(this.colors[i, 0].g, this.colors[i, 1].g, this.percentage, this.easeCurve);
- this.colors[i, 2].b = this.ease(this.colors[i, 0].b, this.colors[i, 1].b, this.percentage, this.easeCurve);
- this.colors[i, 2].a = this.ease(this.colors[i, 0].a, this.colors[i, 1].a, this.percentage, this.easeCurve);
- }
- if (base.GetComponent(typeof(GUITexture)))
- {
- base.GetComponent<GUITexture>().color = this.colors[0, 2];
- }
- else if (base.GetComponent(typeof(GUIText)))
- {
- base.GetComponent<GUIText>().material.color = this.colors[0, 2];
- }
- else if (base.GetComponent<Renderer>())
- {
- Renderer component = base.GetComponent<Renderer>();
- for (int j = 0; j < this.colors.GetLength(0); j++)
- {
- component.materials[j].SetColor(this.namedcolorvalue.ToString(), this.colors[j, 2]);
- }
- }
- else if (base.GetComponent<Light>())
- {
- base.GetComponent<Light>().color = this.colors[0, 2];
- }
- if (this.percentage == 1f)
- {
- if (base.GetComponent(typeof(GUITexture)))
- {
- base.GetComponent<GUITexture>().color = this.colors[0, 1];
- }
- else if (base.GetComponent(typeof(GUIText)))
- {
- base.GetComponent<GUIText>().material.color = this.colors[0, 1];
- }
- else if (base.GetComponent<Renderer>())
- {
- Renderer component2 = base.GetComponent<Renderer>();
- for (int k = 0; k < this.colors.GetLength(0); k++)
- {
- component2.materials[k].SetColor(this.namedcolorvalue.ToString(), this.colors[k, 1]);
- }
- }
- else if (base.GetComponent<Light>())
- {
- base.GetComponent<Light>().color = this.colors[0, 1];
- }
- }
- }
- private void ApplyAudioToTargets()
- {
- this.vector2s[2].x = this.ease(this.vector2s[0].x, this.vector2s[1].x, this.percentage, this.easeCurve);
- this.vector2s[2].y = this.ease(this.vector2s[0].y, this.vector2s[1].y, this.percentage, this.easeCurve);
- this.audioSource.volume = this.vector2s[2].x;
- this.audioSource.pitch = this.vector2s[2].y;
- if (this.percentage == 1f)
- {
- this.audioSource.volume = this.vector2s[1].x;
- this.audioSource.pitch = this.vector2s[1].y;
- }
- }
- private void ApplyStabTargets()
- {
- }
- private void ApplyMoveToPathTargets()
- {
- this.preUpdate = base.transform.position;
- float value = this.ease(0f, 1f, this.percentage, this.easeCurve);
- if (this.isLocal)
- {
- base.transform.localPosition = this.path.Interp(Mathf.Clamp(value, 0f, 1f));
- }
- else
- {
- base.transform.position = this.path.Interp(Mathf.Clamp(value, 0f, 1f));
- }
- if (this.tweenArguments.Contains("orienttopath") && (bool)this.tweenArguments["orienttopath"])
- {
- float num;
- if (this.tweenArguments.Contains("lookahead"))
- {
- num = (float)this.tweenArguments["lookahead"];
- }
- else
- {
- num = AMTween.Defaults.lookAhead;
- }
- float value2 = this.ease(0f, 1f, Mathf.Min(1f, this.percentage + num), this.easeCurve);
- this.tweenArguments["looktarget"] = this.path.Interp(Mathf.Clamp(value2, 0f, 1f));
- }
- this.postUpdate = base.transform.position;
- if (this.physics)
- {
- base.transform.position = this.preUpdate;
- base.GetComponent<Rigidbody>().MovePosition(this.postUpdate);
- }
- }
- private void ApplyMoveToTargets()
- {
- this.preUpdate = base.transform.position;
- this.vector3s[2].x = this.ease(this.vector3s[0].x, this.vector3s[1].x, this.percentage, this.easeCurve);
- this.vector3s[2].y = this.ease(this.vector3s[0].y, this.vector3s[1].y, this.percentage, this.easeCurve);
- this.vector3s[2].z = this.ease(this.vector3s[0].z, this.vector3s[1].z, this.percentage, this.easeCurve);
- if (this.isLocal)
- {
- base.transform.localPosition = this.vector3s[2];
- }
- else
- {
- base.transform.position = this.vector3s[2];
- }
- if (this.percentage == 1f)
- {
- if (this.isLocal)
- {
- base.transform.localPosition = this.vector3s[1];
- }
- else
- {
- base.transform.position = this.vector3s[1];
- }
- }
- this.postUpdate = base.transform.position;
- if (this.physics)
- {
- base.transform.position = this.preUpdate;
- base.GetComponent<Rigidbody>().MovePosition(this.postUpdate);
- }
- }
- private void ApplyMoveByTargets()
- {
- this.preUpdate = base.transform.position;
- Vector3 eulerAngles = default(Vector3);
- if (this.tweenArguments.Contains("looktarget"))
- {
- eulerAngles = base.transform.eulerAngles;
- base.transform.eulerAngles = this.vector3s[4];
- }
- this.vector3s[2].x = this.ease(this.vector3s[0].x, this.vector3s[1].x, this.percentage, this.easeCurve);
- this.vector3s[2].y = this.ease(this.vector3s[0].y, this.vector3s[1].y, this.percentage, this.easeCurve);
- this.vector3s[2].z = this.ease(this.vector3s[0].z, this.vector3s[1].z, this.percentage, this.easeCurve);
- base.transform.Translate(this.vector3s[2] - this.vector3s[3], this.space);
- this.vector3s[3] = this.vector3s[2];
- if (this.tweenArguments.Contains("looktarget"))
- {
- base.transform.eulerAngles = eulerAngles;
- }
- this.postUpdate = base.transform.position;
- if (this.physics)
- {
- base.transform.position = this.preUpdate;
- base.GetComponent<Rigidbody>().MovePosition(this.postUpdate);
- }
- }
- private void ApplyScaleToTargets()
- {
- this.vector3s[2].x = this.ease(this.vector3s[0].x, this.vector3s[1].x, this.percentage, this.easeCurve);
- this.vector3s[2].y = this.ease(this.vector3s[0].y, this.vector3s[1].y, this.percentage, this.easeCurve);
- this.vector3s[2].z = this.ease(this.vector3s[0].z, this.vector3s[1].z, this.percentage, this.easeCurve);
- base.transform.localScale = this.vector3s[2];
- if (this.percentage == 1f)
- {
- base.transform.localScale = this.vector3s[1];
- }
- }
- private void ApplyLookToTargets()
- {
- this.vector3s[2].x = this.ease(this.vector3s[0].x, this.vector3s[1].x, this.percentage, this.easeCurve);
- this.vector3s[2].y = this.ease(this.vector3s[0].y, this.vector3s[1].y, this.percentage, this.easeCurve);
- this.vector3s[2].z = this.ease(this.vector3s[0].z, this.vector3s[1].z, this.percentage, this.easeCurve);
- if (this.isLocal)
- {
- base.transform.localRotation = Quaternion.Euler(this.vector3s[2]);
- }
- else
- {
- base.transform.rotation = Quaternion.Euler(this.vector3s[2]);
- }
- }
- private void ApplyLookToFollowTargets()
- {
- if (this.tweenArguments.Contains("endposition"))
- {
- Vector3 position = base.transform.position;
- base.transform.position = (Vector3)this.tweenArguments["endposition"];
- base.transform.LookAt((Transform)this.tweenArguments["looktarget"]);
- base.transform.position = position;
- }
- else
- {
- base.transform.LookAt((Transform)this.tweenArguments["looktarget"]);
- }
- this.vector3s[1] = base.transform.eulerAngles;
- 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));
- this.vector3s[2].x = this.ease(this.vector3s[0].x, this.vector3s[1].x, this.percentage, this.easeCurve);
- this.vector3s[2].y = this.ease(this.vector3s[0].y, this.vector3s[1].y, this.percentage, this.easeCurve);
- this.vector3s[2].z = this.ease(this.vector3s[0].z, this.vector3s[1].z, this.percentage, this.easeCurve);
- base.transform.rotation = Quaternion.Euler(this.vector3s[2]);
- }
- private void ApplyLookFollowTargets()
- {
- base.transform.LookAt((Transform)this.tweenArguments["looktarget"]);
- }
- private void ApplyRotateToTargets()
- {
- this.preUpdate = base.transform.eulerAngles;
- this.vector3s[2].x = this.ease(this.vector3s[0].x, this.vector3s[1].x, this.percentage, this.easeCurve);
- this.vector3s[2].y = this.ease(this.vector3s[0].y, this.vector3s[1].y, this.percentage, this.easeCurve);
- this.vector3s[2].z = this.ease(this.vector3s[0].z, this.vector3s[1].z, this.percentage, this.easeCurve);
- if (this.isLocal)
- {
- base.transform.localRotation = Quaternion.Euler(this.vector3s[2]);
- }
- else
- {
- base.transform.rotation = Quaternion.Euler(this.vector3s[2]);
- }
- if (this.percentage == 1f)
- {
- if (this.isLocal)
- {
- base.transform.localRotation = Quaternion.Euler(this.vector3s[1]);
- }
- else
- {
- base.transform.rotation = Quaternion.Euler(this.vector3s[1]);
- }
- }
- this.postUpdate = base.transform.eulerAngles;
- if (this.physics)
- {
- base.transform.eulerAngles = this.preUpdate;
- base.GetComponent<Rigidbody>().MoveRotation(Quaternion.Euler(this.postUpdate));
- }
- }
- private void ApplyRotateAddTargets()
- {
- this.preUpdate = base.transform.eulerAngles;
- this.vector3s[2].x = this.ease(this.vector3s[0].x, this.vector3s[1].x, this.percentage, this.easeCurve);
- this.vector3s[2].y = this.ease(this.vector3s[0].y, this.vector3s[1].y, this.percentage, this.easeCurve);
- this.vector3s[2].z = this.ease(this.vector3s[0].z, this.vector3s[1].z, this.percentage, this.easeCurve);
- base.transform.Rotate(this.vector3s[2] - this.vector3s[3], this.space);
- this.vector3s[3] = this.vector3s[2];
- this.postUpdate = base.transform.eulerAngles;
- if (this.physics)
- {
- base.transform.eulerAngles = this.preUpdate;
- base.GetComponent<Rigidbody>().MoveRotation(Quaternion.Euler(this.postUpdate));
- }
- }
- private void ApplyShakePositionTargets()
- {
- if (this.isLocal)
- {
- this.preUpdate = base.transform.localPosition;
- }
- else
- {
- this.preUpdate = base.transform.position;
- }
- Vector3 eulerAngles = default(Vector3);
- if (this.tweenArguments.Contains("looktarget"))
- {
- eulerAngles = base.transform.eulerAngles;
- base.transform.eulerAngles = this.vector3s[3];
- }
- if (this.percentage == 0f)
- {
- base.transform.Translate(this.vector3s[1], this.space);
- }
- if (this.isLocal)
- {
- base.transform.localPosition = this.vector3s[0];
- }
- else
- {
- base.transform.position = this.vector3s[0];
- }
- float num = 1f - this.percentage;
- this.vector3s[2].x = UnityEngine.Random.Range(-this.vector3s[1].x * num, this.vector3s[1].x * num);
- this.vector3s[2].y = UnityEngine.Random.Range(-this.vector3s[1].y * num, this.vector3s[1].y * num);
- this.vector3s[2].z = UnityEngine.Random.Range(-this.vector3s[1].z * num, this.vector3s[1].z * num);
- if (this.isLocal)
- {
- base.transform.localPosition += this.vector3s[2];
- }
- else
- {
- base.transform.position += this.vector3s[2];
- }
- if (this.tweenArguments.Contains("looktarget"))
- {
- base.transform.eulerAngles = eulerAngles;
- }
- this.postUpdate = base.transform.position;
- if (this.physics)
- {
- base.transform.position = this.preUpdate;
- base.GetComponent<Rigidbody>().MovePosition(this.postUpdate);
- }
- }
- private void ApplyShakeScaleTargets()
- {
- if (this.percentage == 0f)
- {
- base.transform.localScale = this.vector3s[1];
- }
- base.transform.localScale = this.vector3s[0];
- float num = 1f - this.percentage;
- this.vector3s[2].x = UnityEngine.Random.Range(-this.vector3s[1].x * num, this.vector3s[1].x * num);
- this.vector3s[2].y = UnityEngine.Random.Range(-this.vector3s[1].y * num, this.vector3s[1].y * num);
- this.vector3s[2].z = UnityEngine.Random.Range(-this.vector3s[1].z * num, this.vector3s[1].z * num);
- base.transform.localScale += this.vector3s[2];
- }
- private void ApplyShakeRotationTargets()
- {
- this.preUpdate = base.transform.eulerAngles;
- if (this.percentage == 0f)
- {
- base.transform.Rotate(this.vector3s[1], this.space);
- }
- base.transform.eulerAngles = this.vector3s[0];
- float num = 1f - this.percentage;
- this.vector3s[2].x = UnityEngine.Random.Range(-this.vector3s[1].x * num, this.vector3s[1].x * num);
- this.vector3s[2].y = UnityEngine.Random.Range(-this.vector3s[1].y * num, this.vector3s[1].y * num);
- this.vector3s[2].z = UnityEngine.Random.Range(-this.vector3s[1].z * num, this.vector3s[1].z * num);
- base.transform.Rotate(this.vector3s[2], this.space);
- this.postUpdate = base.transform.eulerAngles;
- if (this.physics)
- {
- base.transform.eulerAngles = this.preUpdate;
- base.GetComponent<Rigidbody>().MoveRotation(Quaternion.Euler(this.postUpdate));
- }
- }
- private void ApplyPunchPositionTargets()
- {
- this.preUpdate = base.transform.position;
- Vector3 eulerAngles = default(Vector3);
- if (this.tweenArguments.Contains("looktarget"))
- {
- eulerAngles = base.transform.eulerAngles;
- base.transform.eulerAngles = this.vector3s[4];
- }
- if (this.vector3s[1].x > 0f)
- {
- this.vector3s[2].x = AMTween.punch(this.vector3s[1].x, this.percentage, null);
- }
- else if (this.vector3s[1].x < 0f)
- {
- this.vector3s[2].x = -AMTween.punch(Mathf.Abs(this.vector3s[1].x), this.percentage, null);
- }
- if (this.vector3s[1].y > 0f)
- {
- this.vector3s[2].y = AMTween.punch(this.vector3s[1].y, this.percentage, null);
- }
- else if (this.vector3s[1].y < 0f)
- {
- this.vector3s[2].y = -AMTween.punch(Mathf.Abs(this.vector3s[1].y), this.percentage, null);
- }
- if (this.vector3s[1].z > 0f)
- {
- this.vector3s[2].z = AMTween.punch(this.vector3s[1].z, this.percentage, null);
- }
- else if (this.vector3s[1].z < 0f)
- {
- this.vector3s[2].z = -AMTween.punch(Mathf.Abs(this.vector3s[1].z), this.percentage, null);
- }
- base.transform.Translate(this.vector3s[2] - this.vector3s[3], this.space);
- this.vector3s[3] = this.vector3s[2];
- if (this.tweenArguments.Contains("looktarget"))
- {
- base.transform.eulerAngles = eulerAngles;
- }
- this.postUpdate = base.transform.position;
- if (this.physics)
- {
- base.transform.position = this.preUpdate;
- base.GetComponent<Rigidbody>().MovePosition(this.postUpdate);
- }
- }
- private void ApplyPunchRotationTargets()
- {
- this.preUpdate = base.transform.eulerAngles;
- if (this.vector3s[1].x > 0f)
- {
- this.vector3s[2].x = AMTween.punch(this.vector3s[1].x, this.percentage, null);
- }
- else if (this.vector3s[1].x < 0f)
- {
- this.vector3s[2].x = -AMTween.punch(Mathf.Abs(this.vector3s[1].x), this.percentage, null);
- }
- if (this.vector3s[1].y > 0f)
- {
- this.vector3s[2].y = AMTween.punch(this.vector3s[1].y, this.percentage, null);
- }
- else if (this.vector3s[1].y < 0f)
- {
- this.vector3s[2].y = -AMTween.punch(Mathf.Abs(this.vector3s[1].y), this.percentage, null);
- }
- if (this.vector3s[1].z > 0f)
- {
- this.vector3s[2].z = AMTween.punch(this.vector3s[1].z, this.percentage, null);
- }
- else if (this.vector3s[1].z < 0f)
- {
- this.vector3s[2].z = -AMTween.punch(Mathf.Abs(this.vector3s[1].z), this.percentage, null);
- }
- base.transform.Rotate(this.vector3s[2] - this.vector3s[3], this.space);
- this.vector3s[3] = this.vector3s[2];
- this.postUpdate = base.transform.eulerAngles;
- if (this.physics)
- {
- base.transform.eulerAngles = this.preUpdate;
- base.GetComponent<Rigidbody>().MoveRotation(Quaternion.Euler(this.postUpdate));
- }
- }
- private void ApplyPunchScaleTargets()
- {
- if (this.vector3s[1].x > 0f)
- {
- this.vector3s[2].x = AMTween.punch(this.vector3s[1].x, this.percentage, null);
- }
- else if (this.vector3s[1].x < 0f)
- {
- this.vector3s[2].x = -AMTween.punch(Mathf.Abs(this.vector3s[1].x), this.percentage, null);
- }
- if (this.vector3s[1].y > 0f)
- {
- this.vector3s[2].y = AMTween.punch(this.vector3s[1].y, this.percentage, null);
- }
- else if (this.vector3s[1].y < 0f)
- {
- this.vector3s[2].y = -AMTween.punch(Mathf.Abs(this.vector3s[1].y), this.percentage, null);
- }
- if (this.vector3s[1].z > 0f)
- {
- this.vector3s[2].z = AMTween.punch(this.vector3s[1].z, this.percentage, null);
- }
- else if (this.vector3s[1].z < 0f)
- {
- this.vector3s[2].z = -AMTween.punch(Mathf.Abs(this.vector3s[1].z), this.percentage, null);
- }
- base.transform.localScale = this.vector3s[0] + this.vector3s[2];
- }
- private void ApplyCameraFadeValueTargets()
- {
- AMTween.cf.value = this.ease(1f, 0f, this.percentage, this.easeCurve);
- AMTween.cf.percent = this.percentage;
- }
- private IEnumerator TweenDelay()
- {
- this.delayStarted = NTime.time;
- while (NTime.time - this.delayStarted < this.delay)
- {
- yield return null;
- }
- if (this.wasPaused)
- {
- this.wasPaused = false;
- this.TweenStart(true);
- }
- yield break;
- }
- private void TweenStart(bool checkConflict = true)
- {
- this.CallBack("onstart");
- this.sendMessage();
- this.invokeMethod();
- this.playAnimation();
- this.playAudio();
- if (!this.loop)
- {
- if (checkConflict)
- {
- this.ConflictCheck();
- }
- this.GenerateTargets();
- }
- if (this.type == "stab")
- {
- this.audioSource.PlayOneShot(this.audioSource.clip);
- }
- if (this.type == "move" || this.type == "scale" || this.type == "rotate" || this.type == "punch" || this.type == "shake" || this.type == "curve" || this.type == "look")
- {
- this.EnableKinematic();
- }
- this.isRunning = true;
- }
- private IEnumerator TweenRestart()
- {
- if (this.delay > 0f)
- {
- this.delayStarted = NTime.time;
- while (NTime.time - this.delayStarted < this.delay)
- {
- yield return null;
- }
- }
- this.loop = true;
- this.TweenStart(true);
- yield break;
- }
- private void TweenUpdate()
- {
- if (!this.isRunning)
- {
- return;
- }
- if (this.apply != null)
- {
- this.apply();
- }
- this.CallBack("onupdate");
- this.UpdatePercentage();
- if ((string)this.tweenArguments["method"] == "animation")
- {
- GameObject gameObject = this.tweenArguments["target"] as GameObject;
- AnimationClip clip = gameObject.GetComponent<Animation>().GetClip((string)this.tweenArguments["animation"]);
- clip.SampleAnimation(gameObject, NTime.time - (this.delayStarted + this.delay));
- }
- }
- private void TweenComplete(bool end = false)
- {
- if (!this.isRunning)
- {
- return;
- }
- if (end && this.apply == null)
- {
- this.GenerateTargets();
- }
- this.isRunning = false;
- if (end || this.percentage > 0.5f)
- {
- this.percentage = 1f;
- }
- else
- {
- this.percentage = 0f;
- }
- if (this.apply != null)
- {
- this.apply();
- }
- if (this.type == "value")
- {
- this.CallBack("onupdate");
- }
- if (this.loopType == AMTween.LoopType.none)
- {
- this.Dispose();
- }
- else if ((string)this.tweenArguments["method"] != "audio")
- {
- this.TweenLoop();
- }
- this.CallBack("oncomplete");
- }
- private void TweenLoop()
- {
- if (!this.isRunning)
- {
- return;
- }
- this.DisableKinematic();
- AMTween.LoopType loopType = this.loopType;
- if (loopType != AMTween.LoopType.loop)
- {
- if (loopType == AMTween.LoopType.pingPong)
- {
- this.reverse = !this.reverse;
- this.runningTime = 0f;
- base.StartCoroutine("TweenRestart");
- }
- }
- else
- {
- this.percentage = 0f;
- this.runningTime = 0f;
- if (this.apply != null)
- {
- this.apply();
- }
- base.StartCoroutine("TweenRestart");
- }
- }
- private void resumeExtras()
- {
- if (this.delay > 0f)
- {
- return;
- }
- if ((string)this.tweenArguments["method"] == "audio")
- {
- (this.tweenArguments["audiosource"] as AudioSource).time = this.runningTime % (this.tweenArguments["audioclip"] as AudioClip).length;
- (this.tweenArguments["audiosource"] as AudioSource).Play();
- }
- else if ((string)this.tweenArguments["method"] == "animation")
- {
- (this.tweenArguments["target"] as GameObject).GetComponent<Animation>()[(string)this.tweenArguments["animation"]].time = this.runningTime;
- }
- }
- private void pauseExtras()
- {
- if (this.delay > 0f)
- {
- return;
- }
- if ((string)this.tweenArguments["method"] == "audio")
- {
- (this.tweenArguments["audiosource"] as AudioSource).Stop();
- }
- else if ((string)this.tweenArguments["method"] == "animation")
- {
- (this.tweenArguments["target"] as GameObject).GetComponent<Animation>().Stop();
- }
- }
- private void playAnimation()
- {
- if ((string)this.tweenArguments["method"] != "animation")
- {
- return;
- }
- if (this.tweenArguments["wrapmode"] != null)
- {
- (this.tweenArguments["target"] as GameObject).GetComponent<Animation>().wrapMode = (WrapMode)this.tweenArguments["wrapmode"];
- }
- if (this.tweenArguments["crossfade"] == null || (bool)this.tweenArguments["crossfade"])
- {
- }
- }
- private void playAudio()
- {
- if ((string)this.tweenArguments["method"] != "audio")
- {
- return;
- }
- if ((this.tweenArguments["audiosource"] as AudioSource).isPlaying)
- {
- (this.tweenArguments["audiosource"] as AudioSource).Stop();
- }
- if (this.tweenArguments["loop"] != null)
- {
- (this.tweenArguments["audiosource"] as AudioSource).loop = (bool)this.tweenArguments["loop"];
- }
- (this.tweenArguments["audiosource"] as AudioSource).time = this.runningTime;
- (this.tweenArguments["audiosource"] as AudioSource).clip = null;
- (this.tweenArguments["audiosource"] as AudioSource).clip = (this.tweenArguments["audioclip"] as AudioClip);
- (this.tweenArguments["audiosource"] as AudioSource).pitch = 1f;
- (this.tweenArguments["audiosource"] as AudioSource).Play();
- }
- private void sendMessage()
- {
- if ((string)this.tweenArguments["method"] != "message")
- {
- return;
- }
- if (this.tweenArguments["parameter"] != null)
- {
- object value = this.tweenArguments["parameter"];
- (this.tweenArguments["target"] as GameObject).SendMessage(this.tweenArguments["methodname"] as string, value);
- }
- else
- {
- (this.tweenArguments["target"] as GameObject).SendMessage(this.tweenArguments["methodname"] as string);
- }
- }
- private void invokeMethod()
- {
- if ((string)this.tweenArguments["type"] != "invoke")
- {
- return;
- }
- try
- {
- if (this.tweenArguments["parameters"] != null)
- {
- object[] array = this.tweenArguments["parameters"] as object[];
- ParameterInfo[] parameters = (this.tweenArguments["methodinfo"] as MethodInfo).GetParameters();
- for (int i = 0; i < parameters.Length; i++)
- {
- if (array[i].GetType() != parameters[i].ParameterType)
- {
- 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.");
- return;
- }
- }
- (this.tweenArguments["methodinfo"] as MethodInfo).Invoke(this.tweenArguments["component"] as Component, this.tweenArguments["parameters"] as object[]);
- }
- else
- {
- (this.tweenArguments["methodinfo"] as MethodInfo).Invoke(this.tweenArguments["component"] as Component, null);
- }
- }
- catch
- {
- Debug.LogWarning(string.Concat(new object[]
- {
- "AMTween: Error processing method '",
- (this.tweenArguments["methodinfo"] as MethodInfo).Name,
- "' parameters. Are you passing a null value? ",
- this.tweenArguments["trackid"],
- " at ",
- this.delayStarted,
- "s"
- }));
- }
- }
- public static Rect RectUpdate(Rect currentValue, Rect targetValue, float speed)
- {
- 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));
- return result;
- }
- public static Vector3 Vector3Update(Vector3 currentValue, Vector3 targetValue, float speed)
- {
- Vector3 a = targetValue - currentValue;
- currentValue += a * speed * NTime.deltaTime;
- return currentValue;
- }
- public static Vector2 Vector2Update(Vector2 currentValue, Vector2 targetValue, float speed)
- {
- Vector2 a = targetValue - currentValue;
- currentValue += a * speed * NTime.deltaTime;
- return currentValue;
- }
- public static float FloatUpdate(float currentValue, float targetValue, float speed)
- {
- float num = targetValue - currentValue;
- currentValue += num * speed * NTime.deltaTime;
- return currentValue;
- }
- public static void FadeUpdate(GameObject target, Hashtable args)
- {
- args["a"] = args["alpha"];
- AMTween.ColorUpdate(target, args);
- }
- public static void FadeUpdate(GameObject target, float alpha, float time, string trackId)
- {
- AMTween.FadeUpdate(target, AMTween.Hash(new object[]
- {
- "trackid",
- trackId,
- "alpha",
- alpha,
- "time",
- time
- }));
- }
- public static void ColorUpdate(GameObject target, Hashtable args)
- {
- AMTween.CleanArgs(args);
- Color[] array = new Color[4];
- if (!args.Contains("includechildren") || (bool)args["includechildren"])
- {
- IEnumerator enumerator = target.transform.GetEnumerator();
- try
- {
- while (enumerator.MoveNext())
- {
- object obj = enumerator.Current;
- Transform transform = (Transform)obj;
- AMTween.ColorUpdate(transform.gameObject, args);
- }
- }
- finally
- {
- IDisposable disposable;
- if ((disposable = (enumerator as IDisposable)) != null)
- {
- disposable.Dispose();
- }
- }
- }
- float num;
- if (args.Contains("time"))
- {
- num = (float)args["time"];
- num *= AMTween.Defaults.updateTimePercentage;
- }
- else
- {
- num = AMTween.Defaults.updateTime;
- }
- if (target.GetComponent(typeof(GUITexture)))
- {
- array[0] = (array[1] = target.GetComponent<GUITexture>().color);
- }
- else if (target.GetComponent(typeof(GUIText)))
- {
- array[0] = (array[1] = target.GetComponent<GUIText>().material.color);
- }
- else if (target.GetComponent<Renderer>())
- {
- array[0] = (array[1] = target.GetComponent<Renderer>().material.color);
- }
- else if (target.GetComponent<Light>())
- {
- array[0] = (array[1] = target.GetComponent<Light>().color);
- }
- if (args.Contains("color"))
- {
- array[1] = (Color)args["color"];
- }
- else
- {
- if (args.Contains("r"))
- {
- array[1].r = (float)args["r"];
- }
- if (args.Contains("g"))
- {
- array[1].g = (float)args["g"];
- }
- if (args.Contains("b"))
- {
- array[1].b = (float)args["b"];
- }
- if (args.Contains("a"))
- {
- array[1].a = (float)args["a"];
- }
- }
- array[3].r = Mathf.SmoothDamp(array[0].r, array[1].r, ref array[2].r, num);
- array[3].g = Mathf.SmoothDamp(array[0].g, array[1].g, ref array[2].g, num);
- array[3].b = Mathf.SmoothDamp(array[0].b, array[1].b, ref array[2].b, num);
- array[3].a = Mathf.SmoothDamp(array[0].a, array[1].a, ref array[2].a, num);
- if (target.GetComponent(typeof(GUITexture)))
- {
- target.GetComponent<GUITexture>().color = array[3];
- }
- else if (target.GetComponent(typeof(GUIText)))
- {
- target.GetComponent<GUIText>().material.color = array[3];
- }
- else if (target.GetComponent<Renderer>())
- {
- target.GetComponent<Renderer>().material.color = array[3];
- }
- else if (target.GetComponent<Light>())
- {
- target.GetComponent<Light>().color = array[3];
- }
- }
- public static void ColorUpdate(GameObject target, Color color, float time, string trackId)
- {
- AMTween.ColorUpdate(target, AMTween.Hash(new object[]
- {
- "trackid",
- trackId,
- "color",
- color,
- "time",
- time
- }));
- }
- public static void AudioUpdate(GameObject target, Hashtable args)
- {
- AMTween.CleanArgs(args);
- Vector2[] array = new Vector2[4];
- float num;
- if (args.Contains("time"))
- {
- num = (float)args["time"];
- num *= AMTween.Defaults.updateTimePercentage;
- }
- else
- {
- num = AMTween.Defaults.updateTime;
- }
- AudioSource audioSource;
- if (args.Contains("audiosource"))
- {
- audioSource = (AudioSource)args["audiosource"];
- }
- else
- {
- if (!target.GetComponent(typeof(AudioSource)))
- {
- Debug.LogError("AMTween Error: AudioUpdate requires an AudioSource.");
- return;
- }
- audioSource = target.GetComponent<AudioSource>();
- }
- array[0] = (array[1] = new Vector2(audioSource.volume, audioSource.pitch));
- if (args.Contains("volume"))
- {
- array[1].x = (float)args["volume"];
- }
- if (args.Contains("pitch"))
- {
- array[1].y = (float)args["pitch"];
- }
- array[3].x = Mathf.SmoothDampAngle(array[0].x, array[1].x, ref array[2].x, num);
- array[3].y = Mathf.SmoothDampAngle(array[0].y, array[1].y, ref array[2].y, num);
- audioSource.volume = array[3].x;
- audioSource.pitch = array[3].y;
- }
- public static void AudioUpdate(GameObject target, float volume, float pitch, float time, string trackId)
- {
- AMTween.AudioUpdate(target, AMTween.Hash(new object[]
- {
- "trackid",
- trackId,
- "volume",
- volume,
- "pitch",
- pitch,
- "time",
- time
- }));
- }
- public static void RotateUpdate(GameObject target, Hashtable args)
- {
- AMTween.CleanArgs(args);
- Vector3[] array = new Vector3[4];
- Vector3 eulerAngles = target.transform.eulerAngles;
- float num;
- if (args.Contains("time"))
- {
- num = (float)args["time"];
- num *= AMTween.Defaults.updateTimePercentage;
- }
- else
- {
- num = AMTween.Defaults.updateTime;
- }
- bool flag;
- if (args.Contains("islocal"))
- {
- flag = (bool)args["islocal"];
- }
- else
- {
- flag = AMTween.Defaults.isLocal;
- }
- if (flag)
- {
- array[0] = target.transform.localEulerAngles;
- }
- else
- {
- array[0] = target.transform.eulerAngles;
- }
- if (args.Contains("rotation"))
- {
- if (args["rotation"].GetType() == typeof(Transform))
- {
- Transform transform = (Transform)args["rotation"];
- array[1] = transform.eulerAngles;
- }
- else if (args["rotation"].GetType() == typeof(Vector3))
- {
- array[1] = (Vector3)args["rotation"];
- }
- }
- array[3].x = Mathf.SmoothDampAngle(array[0].x, array[1].x, ref array[2].x, num);
- array[3].y = Mathf.SmoothDampAngle(array[0].y, array[1].y, ref array[2].y, num);
- array[3].z = Mathf.SmoothDampAngle(array[0].z, array[1].z, ref array[2].z, num);
- if (flag)
- {
- target.transform.localEulerAngles = array[3];
- }
- else
- {
- target.transform.eulerAngles = array[3];
- }
- if (target.GetComponent<Rigidbody>() != null)
- {
- Vector3 eulerAngles2 = target.transform.eulerAngles;
- target.transform.eulerAngles = eulerAngles;
- target.GetComponent<Rigidbody>().MoveRotation(Quaternion.Euler(eulerAngles2));
- }
- }
- public static void RotateUpdate(GameObject target, Vector3 rotation, float time, string trackId)
- {
- AMTween.RotateUpdate(target, AMTween.Hash(new object[]
- {
- "trackid",
- trackId,
- "rotation",
- rotation,
- "time",
- time
- }));
- }
- public static void ScaleUpdate(GameObject target, Hashtable args)
- {
- AMTween.CleanArgs(args);
- Vector3[] array = new Vector3[4];
- float num;
- if (args.Contains("time"))
- {
- num = (float)args["time"];
- num *= AMTween.Defaults.updateTimePercentage;
- }
- else
- {
- num = AMTween.Defaults.updateTime;
- }
- array[0] = (array[1] = target.transform.localScale);
- if (args.Contains("scale"))
- {
- if (args["scale"].GetType() == typeof(Transform))
- {
- Transform transform = (Transform)args["scale"];
- array[1] = transform.localScale;
- }
- else if (args["scale"].GetType() == typeof(Vector3))
- {
- array[1] = (Vector3)args["scale"];
- }
- }
- else
- {
- if (args.Contains("x"))
- {
- array[1].x = (float)args["x"];
- }
- if (args.Contains("y"))
- {
- array[1].y = (float)args["y"];
- }
- if (args.Contains("z"))
- {
- array[1].z = (float)args["z"];
- }
- }
- array[3].x = Mathf.SmoothDamp(array[0].x, array[1].x, ref array[2].x, num);
- array[3].y = Mathf.SmoothDamp(array[0].y, array[1].y, ref array[2].y, num);
- array[3].z = Mathf.SmoothDamp(array[0].z, array[1].z, ref array[2].z, num);
- target.transform.localScale = array[3];
- }
- public static void ScaleUpdate(GameObject target, Vector3 scale, float time, string trackId)
- {
- AMTween.ScaleUpdate(target, AMTween.Hash(new object[]
- {
- "trackid",
- trackId,
- "scale",
- scale,
- "time",
- time
- }));
- }
- public static void MoveUpdate(GameObject target, Hashtable args)
- {
- AMTween.CleanArgs(args);
- Vector3[] array = new Vector3[4];
- Vector3 position = target.transform.position;
- float num;
- if (args.Contains("time"))
- {
- num = (float)args["time"];
- num *= AMTween.Defaults.updateTimePercentage;
- }
- else
- {
- num = AMTween.Defaults.updateTime;
- }
- bool flag;
- if (args.Contains("islocal"))
- {
- flag = (bool)args["islocal"];
- }
- else
- {
- flag = AMTween.Defaults.isLocal;
- }
- if (flag)
- {
- array[0] = (array[1] = target.transform.localPosition);
- }
- else
- {
- array[0] = (array[1] = target.transform.position);
- }
- if (args.Contains("position"))
- {
- if (args["position"].GetType() == typeof(Transform))
- {
- Transform transform = (Transform)args["position"];
- array[1] = transform.position;
- }
- else if (args["position"].GetType() == typeof(Vector3))
- {
- array[1] = (Vector3)args["position"];
- }
- }
- else
- {
- if (args.Contains("x"))
- {
- array[1].x = (float)args["x"];
- }
- if (args.Contains("y"))
- {
- array[1].y = (float)args["y"];
- }
- if (args.Contains("z"))
- {
- array[1].z = (float)args["z"];
- }
- }
- array[3].x = Mathf.SmoothDamp(array[0].x, array[1].x, ref array[2].x, num);
- array[3].y = Mathf.SmoothDamp(array[0].y, array[1].y, ref array[2].y, num);
- array[3].z = Mathf.SmoothDamp(array[0].z, array[1].z, ref array[2].z, num);
- if (args.Contains("orienttopath") && (bool)args["orienttopath"])
- {
- args["looktarget"] = array[3];
- }
- if (args.Contains("looktarget"))
- {
- AMTween.LookUpdate(target, args);
- }
- if (flag)
- {
- target.transform.localPosition = array[3];
- }
- else
- {
- target.transform.position = array[3];
- }
- if (target.GetComponent<Rigidbody>() != null)
- {
- Vector3 position2 = target.transform.position;
- target.transform.position = position;
- target.GetComponent<Rigidbody>().MovePosition(position2);
- }
- }
- public static void MoveUpdate(GameObject target, Vector3 position, float time, string trackId)
- {
- AMTween.MoveUpdate(target, AMTween.Hash(new object[]
- {
- "trackid",
- trackId,
- "position",
- position,
- "time",
- time
- }));
- }
- public static void LookUpdate(GameObject target, Hashtable args)
- {
- AMTween.CleanArgs(args);
- Vector3[] array = new Vector3[5];
- float num;
- if (args.Contains("looktime"))
- {
- num = (float)args["looktime"];
- num *= AMTween.Defaults.updateTimePercentage;
- }
- else if (args.Contains("time"))
- {
- num = (float)args["time"] * 0.15f;
- num *= AMTween.Defaults.updateTimePercentage;
- }
- else
- {
- num = AMTween.Defaults.updateTime;
- }
- array[0] = target.transform.eulerAngles;
- if (args.Contains("looktarget"))
- {
- if (args["looktarget"].GetType() == typeof(Transform))
- {
- Transform transform = target.transform;
- Transform target2 = (Transform)args["looktarget"];
- Vector3? vector = (Vector3?)args["up"];
- transform.LookAt(target2, (vector == null) ? AMTween.Defaults.up : vector.Value);
- }
- else if (args["looktarget"].GetType() == typeof(Vector3))
- {
- Transform transform2 = target.transform;
- Vector3 worldPosition = (Vector3)args["looktarget"];
- Vector3? vector2 = (Vector3?)args["up"];
- transform2.LookAt(worldPosition, (vector2 == null) ? AMTween.Defaults.up : vector2.Value);
- }
- array[1] = target.transform.eulerAngles;
- target.transform.eulerAngles = array[0];
- array[3].x = Mathf.SmoothDampAngle(array[0].x, array[1].x, ref array[2].x, num);
- array[3].y = Mathf.SmoothDampAngle(array[0].y, array[1].y, ref array[2].y, num);
- array[3].z = Mathf.SmoothDampAngle(array[0].z, array[1].z, ref array[2].z, num);
- target.transform.eulerAngles = array[3];
- if (args.Contains("axis"))
- {
- array[4] = target.transform.eulerAngles;
- string text = (string)args["axis"];
- if (text != null)
- {
- if (!(text == "x"))
- {
- if (!(text == "y"))
- {
- if (text == "z")
- {
- array[4].x = array[0].x;
- array[4].y = array[0].y;
- }
- }
- else
- {
- array[4].x = array[0].x;
- array[4].z = array[0].z;
- }
- }
- else
- {
- array[4].y = array[0].y;
- array[4].z = array[0].z;
- }
- }
- target.transform.eulerAngles = array[4];
- }
- return;
- }
- Debug.LogError("AMTween Error: LookUpdate needs a 'looktarget' property!");
- }
- public static void LookUpdate(GameObject target, Vector3 looktarget, float time, string trackId)
- {
- AMTween.LookUpdate(target, AMTween.Hash(new object[]
- {
- "trackid",
- trackId,
- "looktarget",
- looktarget,
- "time",
- time
- }));
- }
- public static void SetMorph(Component component, MethodInfo setPercent, float[] morph)
- {
- for (int i = 0; i < morph.Length; i++)
- {
- setPercent.Invoke(component, new object[]
- {
- i,
- morph[i]
- });
- }
- }
- public static Texture2D LoadTexture2D(string name)
- {
- return (Texture2D)Resources.Load(name);
- }
- public Vector3 getPositionAfter(float time)
- {
- return this.getPositionAtPercentage(this.getIncPercentageBy(time));
- }
- public Vector3 getPositionAtPercentage(float percentage)
- {
- float value = this.ease(0f, 1f, percentage, this.easeCurve);
- return this.path.Interp(Mathf.Clamp(value, 0f, 1f));
- }
- public static void ShowColor(Color color)
- {
- AMTween.cf.keepAliveColor = true;
- AMTween.cf.colorTex = color;
- AMTween.cf.hasColorTex = true;
- AMTween.cf.hasColorBG = false;
- AMTween.cf.mode = 0;
- AMTween.cf.value = 1f;
- AMTween.cf.isReset = false;
- }
- public static void SetTopCamera(Camera top, Camera bottom)
- {
- if (top)
- {
- top.depth = 0f;
- }
- if (bottom)
- {
- bottom.depth = -1f;
- }
- }
- public static void SetTopCamera(Camera top, Camera[] all)
- {
- top.depth = 0f;
- foreach (Camera camera in all)
- {
- if (camera != top)
- {
- camera.depth = -1f;
- }
- }
- }
- private void CameraFadeCleanup()
- {
- if ((string)this.tweenArguments["type"] != "camerafade")
- {
- return;
- }
- Color? color = null;
- if ((bool)this.tweenArguments["reversed"] && this.tweenArguments.Contains("camera2"))
- {
- AMTween.SetTopCamera((Camera)this.tweenArguments["camera2"], (Camera[])this.tweenArguments["allcameras"]);
- }
- if (this.tweenArguments.Contains("color2"))
- {
- color = new Color?((Color)this.tweenArguments["color2"]);
- }
- if (color != null)
- {
- AMTween.cf.keepAliveColor = true;
- AMTween.cf.hasColorTex = true;
- AMTween.cf.hasColorBG = false;
- AMTween.cf.colorTex = color.Value;
- AMTween.cf.mode = 0;
- AMTween.cf.value = 1f;
- }
- else
- {
- AMCameraFade.reset();
- }
- if ((bool)this.tweenArguments["userendertex"])
- {
- if (this.tweenArguments.Contains("camera1"))
- {
- (this.tweenArguments["camera1"] as Camera).targetTexture = null;
- }
- if (this.tweenArguments.Contains("camera2"))
- {
- (this.tweenArguments["camera2"] as Camera).targetTexture = null;
- }
- }
- if (AMCameraFade.hasInstance())
- {
- AMTween.cf.clearTexture2D();
- AMTween.cf.keepAlives--;
- }
- }
- public static Texture2D GetScreenTexture()
- {
- Texture2D texture2D = new Texture2D(Screen.width, Screen.height, TextureFormat.RGB24, false);
- texture2D.ReadPixels(new Rect(0f, 0f, (float)Screen.width, (float)Screen.height), 0, 0, false);
- texture2D.Apply();
- return texture2D;
- }
- public static AnimationCurve GenerateCurve(float[] keyFrameInfo)
- {
- AnimationCurve animationCurve = new AnimationCurve();
- if (keyFrameInfo.Length % 4 != 0)
- {
- Debug.LogError("AMTween: GenerateCurve requires keyframe information as a multiple of 4. (time, value, inTangent, outTangent)");
- return animationCurve;
- }
- for (int i = 0; i < keyFrameInfo.Length; i += 4)
- {
- animationCurve.AddKey(new Keyframe(keyFrameInfo[i], keyFrameInfo[i + 1], keyFrameInfo[i + 2], keyFrameInfo[i + 3]));
- }
- return animationCurve;
- }
- public static float PathLength(Transform[] path)
- {
- Vector3[] array = new Vector3[path.Length];
- float num = 0f;
- for (int i = 0; i < path.Length; i++)
- {
- array[i] = path[i].position;
- }
- Vector3[] pts = AMTween.PathControlPointGenerator(array);
- Vector3 a = AMTween.Interp(pts, 0f);
- int num2 = path.Length * 20;
- for (int j = 1; j <= num2; j++)
- {
- float t = (float)j / (float)num2;
- Vector3 vector = AMTween.Interp(pts, t);
- num += Vector3.Distance(a, vector);
- a = vector;
- }
- return num;
- }
- public static float PathLength(Vector3[] path)
- {
- float num = 0f;
- Vector3[] pts = AMTween.PathControlPointGenerator(path);
- Vector3 a = AMTween.Interp(pts, 0f);
- int num2 = path.Length * 20;
- for (int i = 1; i <= num2; i++)
- {
- float t = (float)i / (float)num2;
- Vector3 vector = AMTween.Interp(pts, t);
- num += Vector3.Distance(a, vector);
- a = vector;
- }
- return num;
- }
- public static Texture2D CameraTexture(Color color)
- {
- Texture2D texture2D = new Texture2D(Screen.width, Screen.height, TextureFormat.ARGB32, false);
- Color[] array = new Color[Screen.width * Screen.height];
- for (int i = 0; i < array.Length; i++)
- {
- array[i] = color;
- }
- texture2D.SetPixels(array);
- texture2D.Apply();
- return texture2D;
- }
- public static void PutOnPath(GameObject target, Vector3[] path, float percent)
- {
- target.transform.position = AMTween.Interp(AMTween.PathControlPointGenerator(path), percent);
- }
- public static void PutOnPath(Transform target, Vector3[] path, float percent)
- {
- target.position = AMTween.Interp(AMTween.PathControlPointGenerator(path), percent);
- }
- public static Vector3 PositionOnPath(Vector3[] path, float percent)
- {
- return AMTween.Interp(AMTween.PathControlPointGenerator(path), percent);
- }
- public static void PutOnPath(GameObject target, Transform[] path, float percent)
- {
- Vector3[] array = new Vector3[path.Length];
- for (int i = 0; i < path.Length; i++)
- {
- array[i] = path[i].position;
- }
- target.transform.position = AMTween.Interp(AMTween.PathControlPointGenerator(array), percent);
- }
- public static void PutOnPath(Transform target, Transform[] path, float percent)
- {
- Vector3[] array = new Vector3[path.Length];
- for (int i = 0; i < path.Length; i++)
- {
- array[i] = path[i].position;
- }
- target.position = AMTween.Interp(AMTween.PathControlPointGenerator(array), percent);
- }
- public static Vector3 PointOnPath(Transform[] path, float percent)
- {
- Vector3[] array = new Vector3[path.Length];
- for (int i = 0; i < path.Length; i++)
- {
- array[i] = path[i].position;
- }
- return AMTween.Interp(AMTween.PathControlPointGenerator(array), percent);
- }
- public static void DrawLine(Vector3[] line)
- {
- if (line.Length > 0)
- {
- AMTween.DrawLineHelper(line, AMTween.Defaults.color, "gizmos");
- }
- }
- public static void DrawLine(Vector3[] line, Color color)
- {
- if (line.Length > 0)
- {
- AMTween.DrawLineHelper(line, color, "gizmos");
- }
- }
- public static void DrawLine(Transform[] line)
- {
- if (line.Length > 0)
- {
- Vector3[] array = new Vector3[line.Length];
- for (int i = 0; i < line.Length; i++)
- {
- array[i] = line[i].position;
- }
- AMTween.DrawLineHelper(array, AMTween.Defaults.color, "gizmos");
- }
- }
- public static void DrawLine(Transform[] line, Color color)
- {
- if (line.Length > 0)
- {
- Vector3[] array = new Vector3[line.Length];
- for (int i = 0; i < line.Length; i++)
- {
- array[i] = line[i].position;
- }
- AMTween.DrawLineHelper(array, color, "gizmos");
- }
- }
- public static void DrawLineGizmos(Vector3[] line)
- {
- if (line.Length > 0)
- {
- AMTween.DrawLineHelper(line, AMTween.Defaults.color, "gizmos");
- }
- }
- public static void DrawLineGizmos(Vector3[] line, Color color)
- {
- if (line.Length > 0)
- {
- AMTween.DrawLineHelper(line, color, "gizmos");
- }
- }
- public static void DrawLineGizmos(Transform[] line)
- {
- if (line.Length > 0)
- {
- Vector3[] array = new Vector3[line.Length];
- for (int i = 0; i < line.Length; i++)
- {
- array[i] = line[i].position;
- }
- AMTween.DrawLineHelper(array, AMTween.Defaults.color, "gizmos");
- }
- }
- public static void DrawLineGizmos(Transform[] line, Color color)
- {
- if (line.Length > 0)
- {
- Vector3[] array = new Vector3[line.Length];
- for (int i = 0; i < line.Length; i++)
- {
- array[i] = line[i].position;
- }
- AMTween.DrawLineHelper(array, color, "gizmos");
- }
- }
- public static void DrawLineHandles(Vector3[] line)
- {
- if (line.Length > 0)
- {
- AMTween.DrawLineHelper(line, AMTween.Defaults.color, "handles");
- }
- }
- public static void DrawLineHandles(Vector3[] line, Color color)
- {
- if (line.Length > 0)
- {
- AMTween.DrawLineHelper(line, color, "handles");
- }
- }
- public static void DrawLineHandles(Transform[] line)
- {
- if (line.Length > 0)
- {
- Vector3[] array = new Vector3[line.Length];
- for (int i = 0; i < line.Length; i++)
- {
- array[i] = line[i].position;
- }
- AMTween.DrawLineHelper(array, AMTween.Defaults.color, "handles");
- }
- }
- public static void DrawLineHandles(Transform[] line, Color color)
- {
- if (line.Length > 0)
- {
- Vector3[] array = new Vector3[line.Length];
- for (int i = 0; i < line.Length; i++)
- {
- array[i] = line[i].position;
- }
- AMTween.DrawLineHelper(array, color, "handles");
- }
- }
- public static Vector3 PointOnPath(Vector3[] path, float percent)
- {
- return AMTween.Interp(AMTween.PathControlPointGenerator(path), percent);
- }
- public static void DrawPath(Vector3[] path)
- {
- if (path.Length > 0)
- {
- AMTween.DrawPathHelper(path, AMTween.Defaults.color, "gizmos");
- }
- }
- public static void DrawPath(Vector3[] path, Color color)
- {
- if (path.Length > 0)
- {
- AMTween.DrawPathHelper(path, color, "gizmos");
- }
- }
- public static void DrawPath(Transform[] path)
- {
- if (path.Length > 0)
- {
- Vector3[] array = new Vector3[path.Length];
- for (int i = 0; i < path.Length; i++)
- {
- array[i] = path[i].position;
- }
- AMTween.DrawPathHelper(array, AMTween.Defaults.color, "gizmos");
- }
- }
- public static void DrawPath(Transform[] path, Color color)
- {
- if (path.Length > 0)
- {
- Vector3[] array = new Vector3[path.Length];
- for (int i = 0; i < path.Length; i++)
- {
- array[i] = path[i].position;
- }
- AMTween.DrawPathHelper(array, color, "gizmos");
- }
- }
- public static void DrawPathGizmos(Vector3[] path)
- {
- if (path.Length > 0)
- {
- AMTween.DrawPathHelper(path, AMTween.Defaults.color, "gizmos");
- }
- }
- public static void DrawPathGizmos(Vector3[] path, Color color)
- {
- if (path.Length > 0)
- {
- AMTween.DrawPathHelper(path, color, "gizmos");
- }
- }
- public static void DrawPathGizmos(Transform[] path)
- {
- if (path.Length > 0)
- {
- Vector3[] array = new Vector3[path.Length];
- for (int i = 0; i < path.Length; i++)
- {
- array[i] = path[i].position;
- }
- AMTween.DrawPathHelper(array, AMTween.Defaults.color, "gizmos");
- }
- }
- public static void DrawPathGizmos(Transform[] path, Color color)
- {
- if (path.Length > 0)
- {
- Vector3[] array = new Vector3[path.Length];
- for (int i = 0; i < path.Length; i++)
- {
- array[i] = path[i].position;
- }
- AMTween.DrawPathHelper(array, color, "gizmos");
- }
- }
- public static void DrawPathHandles(Vector3[] path)
- {
- if (path.Length > 0)
- {
- AMTween.DrawPathHelper(path, AMTween.Defaults.color, "handles");
- }
- }
- public static void DrawPathHandles(Vector3[] path, Color color)
- {
- if (path.Length > 0)
- {
- AMTween.DrawPathHelper(path, color, "handles");
- }
- }
- public static void DrawPathHandles(Transform[] path)
- {
- if (path.Length > 0)
- {
- Vector3[] array = new Vector3[path.Length];
- for (int i = 0; i < path.Length; i++)
- {
- array[i] = path[i].position;
- }
- AMTween.DrawPathHelper(array, AMTween.Defaults.color, "handles");
- }
- }
- public static void DrawPathHandles(Transform[] path, Color color)
- {
- if (path.Length > 0)
- {
- Vector3[] array = new Vector3[path.Length];
- for (int i = 0; i < path.Length; i++)
- {
- array[i] = path[i].position;
- }
- AMTween.DrawPathHelper(array, color, "handles");
- }
- }
- public static void CameraFadeDepth(int depth)
- {
- if (AMTween.cameraFade)
- {
- AMTween.cameraFade.transform.position = new Vector3(AMTween.cameraFade.transform.position.x, AMTween.cameraFade.transform.position.y, (float)depth);
- }
- }
- public static void CameraFadeDestroy()
- {
- if (AMTween.cameraFade)
- {
- UnityEngine.Object.Destroy(AMTween.cameraFade);
- }
- }
- public static void CameraFadeSwap(Texture2D texture)
- {
- if (AMTween.cameraFade)
- {
- AMTween.cameraFade.GetComponent<GUITexture>().texture = texture;
- }
- }
- public static GameObject CameraFadeAdd(Texture2D texture, int depth)
- {
- if (AMTween.cameraFade)
- {
- return null;
- }
- AMTween.cameraFade = new GameObject("AMTween Camera Fade");
- AMTween.cameraFade.transform.position = new Vector3(0.5f, 0.5f, (float)depth);
- AMTween.cameraFade.AddComponent<GUITexture>();
- AMTween.cameraFade.GetComponent<GUITexture>().texture = texture;
- AMTween.cameraFade.GetComponent<GUITexture>().color = new Color(0.5f, 0.5f, 0.5f, 0f);
- return AMTween.cameraFade;
- }
- public static GameObject CameraFadeAdd(Texture2D texture)
- {
- if (AMTween.cameraFade)
- {
- return null;
- }
- AMTween.cameraFade = new GameObject("AMTween Camera Fade");
- AMTween.cameraFade.transform.position = new Vector3(0.5f, 0.5f, (float)AMTween.Defaults.cameraFadeDepth);
- AMTween.cameraFade.AddComponent<GUITexture>();
- AMTween.cameraFade.GetComponent<GUITexture>().texture = texture;
- AMTween.cameraFade.GetComponent<GUITexture>().color = new Color(0.5f, 0.5f, 0.5f, 0f);
- return AMTween.cameraFade;
- }
- public static GameObject CameraFadeAdd()
- {
- if (AMTween.cameraFade)
- {
- return null;
- }
- AMTween.cameraFade = new GameObject("AMTween Camera Fade");
- AMTween.cameraFade.transform.position = new Vector3(0.5f, 0.5f, (float)AMTween.Defaults.cameraFadeDepth);
- AMTween.cameraFade.AddComponent<GUITexture>();
- AMTween.cameraFade.GetComponent<GUITexture>().texture = AMTween.CameraTexture(Color.black);
- AMTween.cameraFade.GetComponent<GUITexture>().color = new Color(0.5f, 0.5f, 0.5f, 0f);
- return AMTween.cameraFade;
- }
- public static void Resume(GameObject target)
- {
- Component[] components = target.GetComponents(typeof(AMTween));
- foreach (AMTween amtween in components)
- {
- amtween.enabled = true;
- amtween.resumeExtras();
- }
- }
- public static void Resume(GameObject target, bool includechildren)
- {
- AMTween.Resume(target);
- if (includechildren)
- {
- IEnumerator enumerator = target.transform.GetEnumerator();
- try
- {
- while (enumerator.MoveNext())
- {
- object obj = enumerator.Current;
- Transform transform = (Transform)obj;
- AMTween.Resume(transform.gameObject, true);
- }
- }
- finally
- {
- IDisposable disposable;
- if ((disposable = (enumerator as IDisposable)) != null)
- {
- disposable.Dispose();
- }
- }
- }
- }
- public static void Resume(GameObject target, string type)
- {
- Component[] components = target.GetComponents(typeof(AMTween));
- foreach (AMTween amtween in components)
- {
- string text = amtween.type + amtween.method;
- text = text.Substring(0, type.Length);
- if (text.ToLower() == type.ToLower())
- {
- amtween.enabled = true;
- }
- }
- }
- public static void Resume(GameObject target, string type, bool includechildren)
- {
- Component[] components = target.GetComponents(typeof(AMTween));
- foreach (AMTween amtween in components)
- {
- string text = amtween.type + amtween.method;
- text = text.Substring(0, type.Length);
- if (text.ToLower() == type.ToLower())
- {
- amtween.enabled = true;
- }
- }
- if (includechildren)
- {
- IEnumerator enumerator = target.transform.GetEnumerator();
- try
- {
- while (enumerator.MoveNext())
- {
- object obj = enumerator.Current;
- Transform transform = (Transform)obj;
- AMTween.Resume(transform.gameObject, type, true);
- }
- }
- finally
- {
- IDisposable disposable;
- if ((disposable = (enumerator as IDisposable)) != null)
- {
- disposable.Dispose();
- }
- }
- }
- }
- public static void Resume()
- {
- for (int i = 0; i < AMTween.tweens_.Count; i++)
- {
- Hashtable hashtable = (Hashtable)AMTween.tweens_[i];
- GameObject target = (GameObject)hashtable["target"];
- AMTween.Resume(target);
- }
- }
- public static void Resume(string type)
- {
- ArrayList arrayList = new ArrayList();
- for (int i = 0; i < AMTween.tweens_.Count; i++)
- {
- Hashtable hashtable = (Hashtable)AMTween.tweens_[i];
- GameObject value = (GameObject)hashtable["target"];
- arrayList.Insert(arrayList.Count, value);
- }
- for (int j = 0; j < arrayList.Count; j++)
- {
- AMTween.Resume((GameObject)arrayList[j], type);
- }
- }
- public static void Pause(GameObject target)
- {
- Component[] components = target.GetComponents(typeof(AMTween));
- int num = 0;
- foreach (AMTween amtween in components)
- {
- num++;
- if (amtween.delay > 0f)
- {
- amtween.delay -= NTime.time - amtween.delayStarted;
- amtween.StopCoroutine("TweenDelay");
- }
- amtween.pauseExtras();
- amtween.isPaused = true;
- amtween.enabled = false;
- }
- }
- public static void Pause(GameObject target, bool includechildren)
- {
- AMTween.Pause(target);
- if (includechildren)
- {
- IEnumerator enumerator = target.transform.GetEnumerator();
- try
- {
- while (enumerator.MoveNext())
- {
- object obj = enumerator.Current;
- Transform transform = (Transform)obj;
- AMTween.Pause(transform.gameObject, true);
- }
- }
- finally
- {
- IDisposable disposable;
- if ((disposable = (enumerator as IDisposable)) != null)
- {
- disposable.Dispose();
- }
- }
- }
- }
- public static void Pause(GameObject target, string type)
- {
- Component[] components = target.GetComponents(typeof(AMTween));
- foreach (AMTween amtween in components)
- {
- string text = amtween.type + amtween.method;
- text = text.Substring(0, type.Length);
- if (text.ToLower() == type.ToLower())
- {
- if (amtween.delay > 0f)
- {
- amtween.delay -= NTime.time - amtween.delayStarted;
- amtween.StopCoroutine("TweenDelay");
- }
- amtween.isPaused = true;
- amtween.enabled = false;
- }
- }
- }
- public static void Pause(GameObject target, string type, bool includechildren)
- {
- Component[] components = target.GetComponents(typeof(AMTween));
- foreach (AMTween amtween in components)
- {
- string text = amtween.type + amtween.method;
- text = text.Substring(0, type.Length);
- if (text.ToLower() == type.ToLower())
- {
- if (amtween.delay > 0f)
- {
- amtween.delay -= NTime.time - amtween.delayStarted;
- amtween.StopCoroutine("TweenDelay");
- }
- amtween.isPaused = true;
- amtween.enabled = false;
- }
- }
- if (includechildren)
- {
- IEnumerator enumerator = target.transform.GetEnumerator();
- try
- {
- while (enumerator.MoveNext())
- {
- object obj = enumerator.Current;
- Transform transform = (Transform)obj;
- AMTween.Pause(transform.gameObject, type, true);
- }
- }
- finally
- {
- IDisposable disposable;
- if ((disposable = (enumerator as IDisposable)) != null)
- {
- disposable.Dispose();
- }
- }
- }
- }
- public static void Pause(string id, GameObject target)
- {
- Component[] components = target.GetComponents(typeof(AMTween));
- foreach (AMTween amtween in components)
- {
- string a = amtween.id;
- if (a == id)
- {
- if (amtween.delay > 0f)
- {
- amtween.delay -= NTime.time - amtween.delayStarted;
- amtween.StopCoroutine("TweenDelay");
- }
- amtween.pauseExtras();
- amtween.isPaused = true;
- amtween.enabled = false;
- }
- }
- }
- public static void Pause()
- {
- for (int i = 0; i < AMTween.tweens_.Count; i++)
- {
- Hashtable hashtable = (Hashtable)AMTween.tweens_[i];
- GameObject target = (GameObject)hashtable["target"];
- string text = (string)hashtable["id"];
- AMTween.Pause(text, target);
- }
- }
- public static void Pause(string type)
- {
- ArrayList arrayList = new ArrayList();
- for (int i = 0; i < AMTween.tweens_.Count; i++)
- {
- Hashtable hashtable = (Hashtable)AMTween.tweens_[i];
- GameObject value = (GameObject)hashtable["target"];
- arrayList.Insert(arrayList.Count, value);
- }
- for (int j = 0; j < arrayList.Count; j++)
- {
- AMTween.Pause((GameObject)arrayList[j], type);
- }
- }
- public static int Count()
- {
- return AMTween.tweens_.Count;
- }
- public static int Count(string type)
- {
- int num = 0;
- for (int i = 0; i < AMTween.tweens_.Count; i++)
- {
- Hashtable hashtable = (Hashtable)AMTween.tweens_[i];
- string text = (string)hashtable["type"] + (string)hashtable["method"];
- text = text.Substring(0, type.Length);
- if (text.ToLower() == type.ToLower())
- {
- num++;
- }
- }
- return num;
- }
- public static int Count(GameObject target)
- {
- Component[] components = target.GetComponents(typeof(AMTween));
- return components.Length;
- }
- public static int Count(GameObject target, string type)
- {
- int num = 0;
- Component[] components = target.GetComponents(typeof(AMTween));
- foreach (AMTween amtween in components)
- {
- string text = amtween.type + amtween.method;
- text = text.Substring(0, type.Length);
- if (text.ToLower() == type.ToLower())
- {
- num++;
- }
- }
- return num;
- }
- public static void StartDisabled()
- {
- IEnumerator enumerator = AMTween.disabledTweens.GetEnumerator();
- try
- {
- while (enumerator.MoveNext())
- {
- object obj = enumerator.Current;
- AMTween amtween = (AMTween)obj;
- amtween.enabled = true;
- }
- }
- finally
- {
- IDisposable disposable;
- if ((disposable = (enumerator as IDisposable)) != null)
- {
- disposable.Dispose();
- }
- }
- AMTween.disabledTweens = new ArrayList();
- }
- public static void Stop()
- {
- ArrayList arrayList = new ArrayList(AMTween.tweens_);
- for (int i = 0; i < arrayList.Count; i++)
- {
- Hashtable hashtable = (Hashtable)arrayList[i];
- GameObject target = (GameObject)hashtable["target"];
- AMTween.Stop(target);
- }
- AMTween.tweens_.Clear();
- }
- public static void Stop(string type)
- {
- ArrayList arrayList = new ArrayList();
- for (int i = 0; i < AMTween.tweens_.Count; i++)
- {
- Hashtable hashtable = (Hashtable)AMTween.tweens_[i];
- GameObject value = (GameObject)hashtable["target"];
- arrayList.Insert(arrayList.Count, value);
- }
- for (int j = 0; j < arrayList.Count; j++)
- {
- AMTween.Stop((GameObject)arrayList[j], type);
- }
- }
- public static void StopByName(string name)
- {
- ArrayList arrayList = new ArrayList();
- for (int i = 0; i < AMTween.tweens_.Count; i++)
- {
- Hashtable hashtable = (Hashtable)AMTween.tweens_[i];
- GameObject value = (GameObject)hashtable["target"];
- arrayList.Insert(arrayList.Count, value);
- }
- for (int j = 0; j < arrayList.Count; j++)
- {
- AMTween.StopByName((GameObject)arrayList[j], name);
- }
- }
- public static void Stop(GameObject target)
- {
- if (!target)
- {
- return;
- }
- Component[] components = target.GetComponents(typeof(AMTween));
- foreach (AMTween amtween in components)
- {
- amtween.Dispose();
- }
- }
- public static void Stop(GameObject target, bool includechildren)
- {
- AMTween.Stop(target);
- if (includechildren)
- {
- IEnumerator enumerator = target.transform.GetEnumerator();
- try
- {
- while (enumerator.MoveNext())
- {
- object obj = enumerator.Current;
- Transform transform = (Transform)obj;
- AMTween.Stop(transform.gameObject, true);
- }
- }
- finally
- {
- IDisposable disposable;
- if ((disposable = (enumerator as IDisposable)) != null)
- {
- disposable.Dispose();
- }
- }
- }
- }
- public static void Stop(GameObject target, string type)
- {
- Component[] components = target.GetComponents(typeof(AMTween));
- foreach (AMTween amtween in components)
- {
- string text = amtween.type + amtween.method;
- text = text.Substring(0, type.Length);
- if (text.ToLower() == type.ToLower())
- {
- amtween.Dispose();
- }
- }
- }
- public static void StopByName(GameObject target, string name)
- {
- Component[] components = target.GetComponents(typeof(AMTween));
- foreach (AMTween amtween in components)
- {
- if (amtween._name == name)
- {
- amtween.Dispose();
- }
- }
- }
- public static void Stop(GameObject target, string type, bool includechildren)
- {
- Component[] components = target.GetComponents(typeof(AMTween));
- foreach (AMTween amtween in components)
- {
- string text = amtween.type + amtween.method;
- text = text.Substring(0, type.Length);
- if (text.ToLower() == type.ToLower())
- {
- amtween.Dispose();
- }
- }
- if (includechildren)
- {
- IEnumerator enumerator = target.transform.GetEnumerator();
- try
- {
- while (enumerator.MoveNext())
- {
- object obj = enumerator.Current;
- Transform transform = (Transform)obj;
- AMTween.Stop(transform.gameObject, type, true);
- }
- }
- finally
- {
- IDisposable disposable;
- if ((disposable = (enumerator as IDisposable)) != null)
- {
- disposable.Dispose();
- }
- }
- }
- }
- public static void StopByName(GameObject target, string name, bool includechildren)
- {
- Component[] components = target.GetComponents(typeof(AMTween));
- foreach (AMTween amtween in components)
- {
- if (amtween._name == name)
- {
- amtween.Dispose();
- }
- }
- if (includechildren)
- {
- IEnumerator enumerator = target.transform.GetEnumerator();
- try
- {
- while (enumerator.MoveNext())
- {
- object obj = enumerator.Current;
- Transform transform = (Transform)obj;
- AMTween.StopByName(transform.gameObject, name, true);
- }
- }
- finally
- {
- IDisposable disposable;
- if ((disposable = (enumerator as IDisposable)) != null)
- {
- disposable.Dispose();
- }
- }
- }
- }
- public static Hashtable Hash(params object[] args)
- {
- Hashtable hashtable = new Hashtable(args.Length / 2);
- if (args.Length % 2 != 0)
- {
- Debug.LogError("Tween Error: Hash requires an even number of arguments!");
- return null;
- }
- for (int i = 0; i < args.Length - 1; i += 2)
- {
- if (hashtable.ContainsKey(args[i]))
- {
- Debug.LogError("duplicate !" + hashtable[i]);
- }
- hashtable.Add(args[i], args[i + 1]);
- }
- return hashtable;
- }
- private void Awake()
- {
- this.RetrieveArgs();
- this.lastRealTime = NTime.realtimeSinceStartup;
- }
- private IEnumerator Start()
- {
- if (this.delay > 0f)
- {
- yield return base.StartCoroutine("TweenDelay");
- }
- this.TweenStart(true);
- yield break;
- }
- private void Update()
- {
- if (this.isRunning && !this.physics)
- {
- if (!this.reverse)
- {
- if (this.percentage < 1f)
- {
- this.TweenUpdate();
- }
- else
- {
- this.TweenComplete(false);
- }
- }
- else if (this.percentage > 0f)
- {
- this.TweenUpdate();
- }
- else
- {
- this.TweenComplete(false);
- }
- }
- }
- private void FixedUpdate()
- {
- if (this.isRunning && this.physics)
- {
- if (!this.reverse)
- {
- if (this.percentage < 1f)
- {
- this.TweenUpdate();
- }
- else
- {
- this.TweenComplete(false);
- }
- }
- else if (this.percentage > 0f)
- {
- this.TweenUpdate();
- }
- else
- {
- this.TweenComplete(false);
- }
- }
- }
- private void LateUpdate()
- {
- if (this.tweenArguments.Contains("looktarget") && this.isRunning && (this.type == "move" || this.type == "shake" || this.type == "punch"))
- {
- AMTween.LookUpdate(base.gameObject, this.tweenArguments);
- }
- }
- private void OnEnable()
- {
- if (this.isRunning)
- {
- this.EnableKinematic();
- }
- if (this.isPaused)
- {
- this.isPaused = false;
- if (this.delay > 0f)
- {
- this.wasPaused = true;
- this.ResumeDelay();
- }
- }
- }
- private void OnDisable()
- {
- this.DisableKinematic();
- }
- private static void DrawLineHelper(Vector3[] line, Color color, string method)
- {
- Gizmos.color = color;
- for (int i = 0; i < line.Length - 1; i++)
- {
- if (method == "gizmos")
- {
- Gizmos.DrawLine(line[i], line[i + 1]);
- }
- else if (method == "handles")
- {
- Debug.LogError("AMTween Error: Drawing a line with Handles is temporarily disabled because of compatability issues with Unity 2.6!");
- }
- }
- }
- private static void DrawPathHelper(Vector3[] path, Color color, string method)
- {
- Vector3[] pts = AMTween.PathControlPointGenerator(path);
- Vector3 to = AMTween.Interp(pts, 0f);
- Gizmos.color = color;
- int num = path.Length * 20;
- for (int i = 1; i <= num; i++)
- {
- float t = (float)i / (float)num;
- Vector3 vector = AMTween.Interp(pts, t);
- if (method == "gizmos")
- {
- Gizmos.DrawLine(vector, to);
- }
- else if (method == "handles")
- {
- Debug.LogError("AMTween Error: Drawing a path with Handles is temporarily disabled because of compatability issues with Unity 2.6!");
- }
- to = vector;
- }
- }
- private static Vector3[] PathControlPointGenerator(Vector3[] path)
- {
- int num = 2;
- Vector3[] array = new Vector3[path.Length + num];
- Array.Copy(path, 0, array, 1, path.Length);
- array[0] = array[1] + (array[1] - array[2]);
- array[array.Length - 1] = array[array.Length - 2] + (array[array.Length - 2] - array[array.Length - 3]);
- if (array[1] == array[array.Length - 2])
- {
- Vector3[] array2 = new Vector3[array.Length];
- Array.Copy(array, array2, array.Length);
- array2[0] = array2[array2.Length - 3];
- array2[array2.Length - 1] = array2[2];
- array = new Vector3[array2.Length];
- Array.Copy(array2, array, array2.Length);
- }
- return array;
- }
- private static Vector3 Interp(Vector3[] pts, float t)
- {
- int num = pts.Length - 3;
- int num2 = Mathf.Min(Mathf.FloorToInt(t * (float)num), num - 1);
- float num3 = t * (float)num - (float)num2;
- Vector3 a = pts[num2];
- Vector3 a2 = pts[num2 + 1];
- Vector3 vector = pts[num2 + 2];
- Vector3 b = pts[num2 + 3];
- 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);
- }
- private static void Launch(GameObject target, Hashtable args)
- {
- if (!args.Contains("id"))
- {
- args["id"] = AMTween.GenerateID();
- }
- if (!args.Contains("target"))
- {
- args["target"] = target;
- }
- AMTween.tweens_.Insert(0, args);
- target.AddComponent<AMTween>();
- }
- private static void Launch(Component component, Hashtable args)
- {
- if (!args.Contains("id"))
- {
- args["id"] = AMTween.GenerateID();
- }
- if (!args.Contains("component"))
- {
- args["component"] = component;
- }
- args["target"] = component.gameObject;
- AMTween.tweens_.Insert(0, args);
- component.gameObject.AddComponent<AMTween>();
- }
- private static Hashtable CleanArgs(Hashtable args)
- {
- Hashtable hashtable = new Hashtable(args.Count);
- Hashtable hashtable2 = new Hashtable(args.Count);
- IDictionaryEnumerator enumerator = args.GetEnumerator();
- try
- {
- while (enumerator.MoveNext())
- {
- object obj = enumerator.Current;
- DictionaryEntry dictionaryEntry = (DictionaryEntry)obj;
- hashtable.Add(dictionaryEntry.Key, dictionaryEntry.Value);
- }
- }
- finally
- {
- IDisposable disposable;
- if ((disposable = (enumerator as IDisposable)) != null)
- {
- disposable.Dispose();
- }
- }
- IDictionaryEnumerator enumerator2 = hashtable.GetEnumerator();
- try
- {
- while (enumerator2.MoveNext())
- {
- object obj2 = enumerator2.Current;
- DictionaryEntry dictionaryEntry2 = (DictionaryEntry)obj2;
- if (dictionaryEntry2.Value != null)
- {
- if (dictionaryEntry2.Value.GetType() == typeof(int))
- {
- int num = (int)dictionaryEntry2.Value;
- float num2 = (float)num;
- args[dictionaryEntry2.Key] = num2;
- }
- if (dictionaryEntry2.Value.GetType() == typeof(double))
- {
- double num3 = (double)dictionaryEntry2.Value;
- float num4 = (float)num3;
- args[dictionaryEntry2.Key] = num4;
- }
- }
- }
- }
- finally
- {
- IDisposable disposable2;
- if ((disposable2 = (enumerator2 as IDisposable)) != null)
- {
- disposable2.Dispose();
- }
- }
- IDictionaryEnumerator enumerator3 = args.GetEnumerator();
- try
- {
- while (enumerator3.MoveNext())
- {
- object obj3 = enumerator3.Current;
- DictionaryEntry dictionaryEntry3 = (DictionaryEntry)obj3;
- hashtable2.Add(dictionaryEntry3.Key.ToString().ToLower(), dictionaryEntry3.Value);
- }
- }
- finally
- {
- IDisposable disposable3;
- if ((disposable3 = (enumerator3 as IDisposable)) != null)
- {
- disposable3.Dispose();
- }
- }
- args = hashtable2;
- return args;
- }
- private static string GenerateID()
- {
- int num = 15;
- char[] array = new char[]
- {
- 'a',
- 'b',
- 'c',
- 'd',
- 'e',
- 'f',
- 'g',
- 'h',
- 'i',
- 'j',
- 'k',
- 'l',
- 'm',
- 'n',
- 'o',
- 'p',
- 'q',
- 'r',
- 's',
- 't',
- 'u',
- 'v',
- 'w',
- 'x',
- 'y',
- 'z',
- 'A',
- 'B',
- 'C',
- 'D',
- 'E',
- 'F',
- 'G',
- 'H',
- 'I',
- 'J',
- 'K',
- 'L',
- 'M',
- 'N',
- 'O',
- 'P',
- 'Q',
- 'R',
- 'S',
- 'T',
- 'U',
- 'V',
- 'W',
- 'X',
- 'Y',
- 'Z',
- '0',
- '1',
- '2',
- '3',
- '4',
- '5',
- '6',
- '7',
- '8'
- };
- int max = array.Length - 1;
- string text = string.Empty;
- for (int i = 0; i < num; i++)
- {
- text += array[(int)Mathf.Floor((float)UnityEngine.Random.Range(0, max))];
- }
- return text;
- }
- private void RetrieveArgs()
- {
- IEnumerator enumerator = AMTween.tweens_.GetEnumerator();
- try
- {
- while (enumerator.MoveNext())
- {
- object obj = enumerator.Current;
- Hashtable hashtable = (Hashtable)obj;
- if ((GameObject)hashtable["target"] == base.gameObject)
- {
- this.tweenArguments = hashtable;
- break;
- }
- }
- }
- finally
- {
- IDisposable disposable;
- if ((disposable = (enumerator as IDisposable)) != null)
- {
- disposable.Dispose();
- }
- }
- this.id = (string)this.tweenArguments["id"];
- this.type = (string)this.tweenArguments["type"];
- this._name = (string)this.tweenArguments["name"];
- this.method = (string)this.tweenArguments["method"];
- if (this.tweenArguments.Contains("time"))
- {
- this.time = (float)this.tweenArguments["time"];
- }
- else
- {
- this.time = AMTween.Defaults.time;
- }
- if (base.GetComponent<Rigidbody>() != null)
- {
- this.physics = true;
- }
- if (this.tweenArguments.Contains("delay"))
- {
- this.delay = (float)this.tweenArguments["delay"];
- if (this.delay < 0f)
- {
- this.runningTime = -this.delay;
- this.delay = 0f;
- }
- }
- else
- {
- this.delay = AMTween.Defaults.delay;
- }
- if (this.tweenArguments.Contains("namedcolorvalue"))
- {
- if (this.tweenArguments["namedcolorvalue"].GetType() == typeof(AMTween.NamedValueColor))
- {
- this.namedcolorvalue = (AMTween.NamedValueColor)this.tweenArguments["namedcolorvalue"];
- }
- else
- {
- try
- {
- this.namedcolorvalue = (AMTween.NamedValueColor)Enum.Parse(typeof(AMTween.NamedValueColor), (string)this.tweenArguments["namedcolorvalue"], true);
- }
- catch
- {
- Debug.LogWarning("AMTween: Unsupported namedcolorvalue supplied! Default will be used.");
- this.namedcolorvalue = AMTween.NamedValueColor._Color;
- }
- }
- }
- else
- {
- this.namedcolorvalue = AMTween.Defaults.namedColorValue;
- }
- if (this.tweenArguments.Contains("looptype"))
- {
- if (this.tweenArguments["looptype"].GetType() == typeof(AMTween.LoopType))
- {
- this.loopType = (AMTween.LoopType)this.tweenArguments["looptype"];
- }
- else
- {
- try
- {
- this.loopType = (AMTween.LoopType)Enum.Parse(typeof(AMTween.LoopType), (string)this.tweenArguments["looptype"], true);
- }
- catch
- {
- Debug.LogWarning("AMTween: Unsupported loopType supplied! Default will be used.");
- this.loopType = AMTween.LoopType.none;
- }
- }
- }
- else
- {
- this.loopType = AMTween.LoopType.none;
- }
- if (this.tweenArguments.Contains("easetype"))
- {
- if (this.tweenArguments["easetype"].GetType() == typeof(AMTween.EaseType))
- {
- this.easeType = (AMTween.EaseType)this.tweenArguments["easetype"];
- }
- else
- {
- try
- {
- this.easeType = (AMTween.EaseType)Enum.Parse(typeof(AMTween.EaseType), (string)this.tweenArguments["easetype"], true);
- }
- catch
- {
- Debug.LogWarning("AMTween: Unsupported easeType supplied! Default will be used.");
- this.easeType = AMTween.Defaults.easeType;
- }
- }
- }
- else
- {
- this.easeType = AMTween.Defaults.easeType;
- }
- if (this.tweenArguments.Contains("easecurve") && this.tweenArguments["easecurve"] != null)
- {
- if (this.tweenArguments["easecurve"].GetType() == typeof(AnimationCurve))
- {
- this.easeCurve = (AnimationCurve)this.tweenArguments["easecurve"];
- }
- else
- {
- Debug.LogWarning("AMTween: Unsupported easeCurve supplied! Default will be used.");
- this.easeCurve = null;
- }
- }
- else
- {
- this.easeCurve = null;
- }
- if (this.tweenArguments.Contains("space"))
- {
- if (this.tweenArguments["space"].GetType() == typeof(Space))
- {
- this.space = (Space)this.tweenArguments["space"];
- }
- else
- {
- try
- {
- this.space = (Space)Enum.Parse(typeof(Space), (string)this.tweenArguments["space"], true);
- }
- catch
- {
- Debug.LogWarning("AMTween: Unsupported space supplied! Default will be used.");
- this.space = AMTween.Defaults.space;
- }
- }
- }
- else
- {
- this.space = AMTween.Defaults.space;
- }
- if (this.tweenArguments.Contains("islocal"))
- {
- this.isLocal = (bool)this.tweenArguments["islocal"];
- }
- else
- {
- this.isLocal = AMTween.Defaults.isLocal;
- }
- if (this.tweenArguments.Contains("ignoretimescale"))
- {
- this.useRealTime = (bool)this.tweenArguments["ignoretimescale"];
- }
- else
- {
- this.useRealTime = AMTween.Defaults.useRealTime;
- }
- this.GetEasingFunction();
- if (this.tweenArguments.Contains("runningtime"))
- {
- this.runningTime = (float)this.tweenArguments["runningtime"];
- }
- if (this.tweenArguments.Contains("disable") && (bool)this.tweenArguments["disable"])
- {
- AMTween.disabledTweens.Add(this);
- base.enabled = false;
- }
- }
- private void GetEasingFunction()
- {
- if (this.easeCurve != null)
- {
- this.ease = new AMTween.EasingFunction(AMTween.customEase);
- return;
- }
- switch (this.easeType)
- {
- case AMTween.EaseType.easeInQuad:
- this.ease = new AMTween.EasingFunction(AMTween.easeInQuad);
- break;
- case AMTween.EaseType.easeOutQuad:
- this.ease = new AMTween.EasingFunction(AMTween.easeOutQuad);
- break;
- case AMTween.EaseType.easeInOutQuad:
- this.ease = new AMTween.EasingFunction(AMTween.easeInOutQuad);
- break;
- case AMTween.EaseType.easeInCubic:
- this.ease = new AMTween.EasingFunction(AMTween.easeInCubic);
- break;
- case AMTween.EaseType.easeOutCubic:
- this.ease = new AMTween.EasingFunction(AMTween.easeOutCubic);
- break;
- case AMTween.EaseType.easeInOutCubic:
- this.ease = new AMTween.EasingFunction(AMTween.easeInOutCubic);
- break;
- case AMTween.EaseType.easeInQuart:
- this.ease = new AMTween.EasingFunction(AMTween.easeInQuart);
- break;
- case AMTween.EaseType.easeOutQuart:
- this.ease = new AMTween.EasingFunction(AMTween.easeOutQuart);
- break;
- case AMTween.EaseType.easeInOutQuart:
- this.ease = new AMTween.EasingFunction(AMTween.easeInOutQuart);
- break;
- case AMTween.EaseType.easeInQuint:
- this.ease = new AMTween.EasingFunction(AMTween.easeInQuint);
- break;
- case AMTween.EaseType.easeOutQuint:
- this.ease = new AMTween.EasingFunction(AMTween.easeOutQuint);
- break;
- case AMTween.EaseType.easeInOutQuint:
- this.ease = new AMTween.EasingFunction(AMTween.easeInOutQuint);
- break;
- case AMTween.EaseType.easeInSine:
- this.ease = new AMTween.EasingFunction(AMTween.easeInSine);
- break;
- case AMTween.EaseType.easeOutSine:
- this.ease = new AMTween.EasingFunction(AMTween.easeOutSine);
- break;
- case AMTween.EaseType.easeInOutSine:
- this.ease = new AMTween.EasingFunction(AMTween.easeInOutSine);
- break;
- case AMTween.EaseType.easeInExpo:
- this.ease = new AMTween.EasingFunction(AMTween.easeInExpo);
- break;
- case AMTween.EaseType.easeOutExpo:
- this.ease = new AMTween.EasingFunction(AMTween.easeOutExpo);
- break;
- case AMTween.EaseType.easeInOutExpo:
- this.ease = new AMTween.EasingFunction(AMTween.easeInOutExpo);
- break;
- case AMTween.EaseType.easeInCirc:
- this.ease = new AMTween.EasingFunction(AMTween.easeInCirc);
- break;
- case AMTween.EaseType.easeOutCirc:
- this.ease = new AMTween.EasingFunction(AMTween.easeOutCirc);
- break;
- case AMTween.EaseType.easeInOutCirc:
- this.ease = new AMTween.EasingFunction(AMTween.easeInOutCirc);
- break;
- case AMTween.EaseType.linear:
- this.ease = new AMTween.EasingFunction(AMTween.linear);
- break;
- case AMTween.EaseType.spring:
- this.ease = new AMTween.EasingFunction(AMTween.spring);
- break;
- case AMTween.EaseType.easeInBounce:
- this.ease = new AMTween.EasingFunction(AMTween.easeInBounce);
- break;
- case AMTween.EaseType.easeOutBounce:
- this.ease = new AMTween.EasingFunction(AMTween.easeOutBounce);
- break;
- case AMTween.EaseType.easeInOutBounce:
- this.ease = new AMTween.EasingFunction(AMTween.easeInOutBounce);
- break;
- case AMTween.EaseType.easeInBack:
- this.ease = new AMTween.EasingFunction(AMTween.easeInBack);
- break;
- case AMTween.EaseType.easeOutBack:
- this.ease = new AMTween.EasingFunction(AMTween.easeOutBack);
- break;
- case AMTween.EaseType.easeInOutBack:
- this.ease = new AMTween.EasingFunction(AMTween.easeInOutBack);
- break;
- case AMTween.EaseType.easeInElastic:
- this.ease = new AMTween.EasingFunction(AMTween.easeInElastic);
- break;
- case AMTween.EaseType.easeOutElastic:
- this.ease = new AMTween.EasingFunction(AMTween.easeOutElastic);
- break;
- case AMTween.EaseType.easeInOutElastic:
- this.ease = new AMTween.EasingFunction(AMTween.easeInOutElastic);
- break;
- case AMTween.EaseType.stayStart:
- this.ease = new AMTween.EasingFunction(AMTween.stayStart);
- break;
- case AMTween.EaseType.stayEnd:
- this.ease = new AMTween.EasingFunction(AMTween.stayEnd);
- break;
- }
- }
- public static AMTween.EasingFunction GetEasingFunction(AMTween.EaseType eType)
- {
- switch (eType)
- {
- case AMTween.EaseType.easeInQuad:
- return new AMTween.EasingFunction(AMTween.easeInQuad);
- case AMTween.EaseType.easeOutQuad:
- return new AMTween.EasingFunction(AMTween.easeOutQuad);
- case AMTween.EaseType.easeInOutQuad:
- return new AMTween.EasingFunction(AMTween.easeInOutQuad);
- case AMTween.EaseType.easeInCubic:
- return new AMTween.EasingFunction(AMTween.easeInCubic);
- case AMTween.EaseType.easeOutCubic:
- return new AMTween.EasingFunction(AMTween.easeOutCubic);
- case AMTween.EaseType.easeInOutCubic:
- return new AMTween.EasingFunction(AMTween.easeInOutCubic);
- case AMTween.EaseType.easeInQuart:
- return new AMTween.EasingFunction(AMTween.easeInQuart);
- case AMTween.EaseType.easeOutQuart:
- return new AMTween.EasingFunction(AMTween.easeOutQuart);
- case AMTween.EaseType.easeInOutQuart:
- return new AMTween.EasingFunction(AMTween.easeInOutQuart);
- case AMTween.EaseType.easeInQuint:
- return new AMTween.EasingFunction(AMTween.easeInQuint);
- case AMTween.EaseType.easeOutQuint:
- return new AMTween.EasingFunction(AMTween.easeOutQuint);
- case AMTween.EaseType.easeInOutQuint:
- return new AMTween.EasingFunction(AMTween.easeInOutQuint);
- case AMTween.EaseType.easeInSine:
- return new AMTween.EasingFunction(AMTween.easeInSine);
- case AMTween.EaseType.easeOutSine:
- return new AMTween.EasingFunction(AMTween.easeOutSine);
- case AMTween.EaseType.easeInOutSine:
- return new AMTween.EasingFunction(AMTween.easeInOutSine);
- case AMTween.EaseType.easeInExpo:
- return new AMTween.EasingFunction(AMTween.easeInExpo);
- case AMTween.EaseType.easeOutExpo:
- return new AMTween.EasingFunction(AMTween.easeOutExpo);
- case AMTween.EaseType.easeInOutExpo:
- return new AMTween.EasingFunction(AMTween.easeInOutExpo);
- case AMTween.EaseType.easeInCirc:
- return new AMTween.EasingFunction(AMTween.easeInCirc);
- case AMTween.EaseType.easeOutCirc:
- return new AMTween.EasingFunction(AMTween.easeOutCirc);
- case AMTween.EaseType.easeInOutCirc:
- return new AMTween.EasingFunction(AMTween.easeInOutCirc);
- case AMTween.EaseType.linear:
- return new AMTween.EasingFunction(AMTween.linear);
- case AMTween.EaseType.spring:
- return new AMTween.EasingFunction(AMTween.spring);
- case AMTween.EaseType.easeInBounce:
- return new AMTween.EasingFunction(AMTween.easeInBounce);
- case AMTween.EaseType.easeOutBounce:
- return new AMTween.EasingFunction(AMTween.easeOutBounce);
- case AMTween.EaseType.easeInOutBounce:
- return new AMTween.EasingFunction(AMTween.easeInOutBounce);
- case AMTween.EaseType.easeInBack:
- return new AMTween.EasingFunction(AMTween.easeInBack);
- case AMTween.EaseType.easeOutBack:
- return new AMTween.EasingFunction(AMTween.easeOutBack);
- case AMTween.EaseType.easeInOutBack:
- return new AMTween.EasingFunction(AMTween.easeInOutBack);
- case AMTween.EaseType.easeInElastic:
- return new AMTween.EasingFunction(AMTween.easeInElastic);
- case AMTween.EaseType.easeOutElastic:
- return new AMTween.EasingFunction(AMTween.easeOutElastic);
- case AMTween.EaseType.easeInOutElastic:
- return new AMTween.EasingFunction(AMTween.easeInOutElastic);
- case AMTween.EaseType.stayStart:
- return new AMTween.EasingFunction(AMTween.stayStart);
- case AMTween.EaseType.stayEnd:
- return new AMTween.EasingFunction(AMTween.stayEnd);
- }
- return new AMTween.EasingFunction(AMTween.linear);
- }
- private void UpdatePercentage()
- {
- if (this.useRealTime)
- {
- this.runningTime += NTime.realtimeSinceStartup - this.lastRealTime;
- }
- else
- {
- this.runningTime += NTime.deltaTime;
- }
- if (this.reverse)
- {
- this.percentage = 1f - this.runningTime / this.time;
- }
- else
- {
- this.percentage = this.runningTime / this.time;
- }
- this.lastRealTime = NTime.realtimeSinceStartup;
- }
- private float getIncPercentageBy(float _time)
- {
- return Mathf.Clamp01((this.runningTime + _time) / this.time);
- }
- private void CallBack(string callbackType)
- {
- if (this.tweenArguments.Contains(callbackType) && !this.tweenArguments.Contains("ischild"))
- {
- GameObject gameObject;
- if (this.tweenArguments.Contains(callbackType + "target"))
- {
- gameObject = (GameObject)this.tweenArguments[callbackType + "target"];
- }
- else
- {
- gameObject = base.gameObject;
- }
- if (this.tweenArguments[callbackType].GetType() == typeof(string))
- {
- gameObject.SendMessage((string)this.tweenArguments[callbackType], this.tweenArguments[callbackType + "params"], SendMessageOptions.DontRequireReceiver);
- }
- else
- {
- Debug.LogError("AMTween Error: Callback method references must be passed as a String!");
- UnityEngine.Object.Destroy(this);
- }
- }
- }
- public void Dispose()
- {
- for (int i = 0; i < AMTween.tweens_.Count; i++)
- {
- Hashtable hashtable = (Hashtable)AMTween.tweens_[i];
- if ((string)hashtable["id"] == this.id)
- {
- AMTween.tweens_.RemoveAt(i);
- break;
- }
- }
- this.CameraFadeCleanup();
- base.enabled = false;
- this.isRunning = false;
- UnityEngine.Object.Destroy(this);
- }
- private void ConflictCheck()
- {
- Component[] components = base.GetComponents(typeof(AMTween));
- foreach (AMTween amtween in components)
- {
- if (this != amtween && amtween.isRunning && amtween.type == this.type && amtween.tweenArguments["trackid"] == this.tweenArguments["trackid"] && amtween.delay <= this.delay)
- {
- amtween.TweenComplete(true);
- }
- }
- }
- private void EnableKinematic()
- {
- }
- private void DisableKinematic()
- {
- }
- private void ResumeDelay()
- {
- base.StartCoroutine("TweenDelay");
- }
- public static float customEase(float start, float end, float value, AnimationCurve curve)
- {
- end -= start;
- return end * curve.Evaluate(value) + start;
- }
- public static float linear(float start, float end, float value, AnimationCurve curve = null)
- {
- return Mathf.Lerp(start, end, value);
- }
- public static float clerp(float start, float end, float value)
- {
- float num = 0f;
- float num2 = 360f;
- float num3 = Mathf.Abs((num2 - num) / 2f);
- float result;
- if (end - start < -num3)
- {
- float num4 = (num2 - start + end) * value;
- result = start + num4;
- }
- else if (end - start > num3)
- {
- float num4 = -(num2 - end + start) * value;
- result = start + num4;
- }
- else
- {
- result = start + (end - start) * value;
- }
- return result;
- }
- public static float spring(float start, float end, float value, AnimationCurve curve = null)
- {
- value = Mathf.Clamp01(value);
- 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));
- return start + (end - start) * value;
- }
- public static float stayStart(float start, float end, float value, AnimationCurve curve = null)
- {
- return start;
- }
- public static float stayEnd(float start, float end, float value, AnimationCurve curve = null)
- {
- return end;
- }
- public static float easeInQuad(float start, float end, float value, AnimationCurve curve = null)
- {
- end -= start;
- return end * value * value + start;
- }
- public static float easeOutQuad(float start, float end, float value, AnimationCurve curve = null)
- {
- end -= start;
- return -end * value * (value - 2f) + start;
- }
- public static float easeInOutQuad(float start, float end, float value, AnimationCurve curve = null)
- {
- value /= 0.5f;
- end -= start;
- if (value < 1f)
- {
- return end / 2f * value * value + start;
- }
- value -= 1f;
- return -end / 2f * (value * (value - 2f) - 1f) + start;
- }
- public static float easeInCubic(float start, float end, float value, AnimationCurve curve = null)
- {
- end -= start;
- return end * value * value * value + start;
- }
- public static float easeOutCubic(float start, float end, float value, AnimationCurve curve = null)
- {
- value -= 1f;
- end -= start;
- return end * (value * value * value + 1f) + start;
- }
- public static float easeInOutCubic(float start, float end, float value, AnimationCurve curve = null)
- {
- value /= 0.5f;
- end -= start;
- if (value < 1f)
- {
- return end / 2f * value * value * value + start;
- }
- value -= 2f;
- return end / 2f * (value * value * value + 2f) + start;
- }
- public static float easeInQuart(float start, float end, float value, AnimationCurve curve = null)
- {
- end -= start;
- return end * value * value * value * value + start;
- }
- public static float easeOutQuart(float start, float end, float value, AnimationCurve curve = null)
- {
- value -= 1f;
- end -= start;
- return -end * (value * value * value * value - 1f) + start;
- }
- public static float easeInOutQuart(float start, float end, float value, AnimationCurve curve = null)
- {
- value /= 0.5f;
- end -= start;
- if (value < 1f)
- {
- return end / 2f * value * value * value * value + start;
- }
- value -= 2f;
- return -end / 2f * (value * value * value * value - 2f) + start;
- }
- public static float easeInQuint(float start, float end, float value, AnimationCurve curve = null)
- {
- end -= start;
- return end * value * value * value * value * value + start;
- }
- public static float easeOutQuint(float start, float end, float value, AnimationCurve curve = null)
- {
- value -= 1f;
- end -= start;
- return end * (value * value * value * value * value + 1f) + start;
- }
- public static float easeInOutQuint(float start, float end, float value, AnimationCurve curve = null)
- {
- value /= 0.5f;
- end -= start;
- if (value < 1f)
- {
- return end / 2f * value * value * value * value * value + start;
- }
- value -= 2f;
- return end / 2f * (value * value * value * value * value + 2f) + start;
- }
- public static float easeInSine(float start, float end, float value, AnimationCurve curve = null)
- {
- end -= start;
- return -end * Mathf.Cos(value / 1f * 1.57079637f) + end + start;
- }
- public static float easeOutSine(float start, float end, float value, AnimationCurve curve = null)
- {
- end -= start;
- return end * Mathf.Sin(value / 1f * 1.57079637f) + start;
- }
- public static float easeInOutSine(float start, float end, float value, AnimationCurve curve = null)
- {
- end -= start;
- return -end / 2f * (Mathf.Cos(3.14159274f * value / 1f) - 1f) + start;
- }
- public static float easeInExpo(float start, float end, float value, AnimationCurve curve = null)
- {
- end -= start;
- return end * Mathf.Pow(2f, 10f * (value / 1f - 1f)) + start;
- }
- public static float easeInExpoReveresed(float start, float end, float value, AnimationCurve curve = null)
- {
- end -= start;
- return 1f + Mathf.Log(value - start) / (10f * Mathf.Log(2f));
- }
- public static float easeOutExpo(float start, float end, float value, AnimationCurve curve = null)
- {
- end -= start;
- return end * (-Mathf.Pow(2f, -10f * value / 1f) + 1f) + start;
- }
- public static float easeInOutExpo(float start, float end, float value, AnimationCurve curve = null)
- {
- value /= 0.5f;
- end -= start;
- if (value < 1f)
- {
- return end / 2f * Mathf.Pow(2f, 10f * (value - 1f)) + start;
- }
- value -= 1f;
- return end / 2f * (-Mathf.Pow(2f, -10f * value) + 2f) + start;
- }
- public static float easeInCirc(float start, float end, float value, AnimationCurve curve = null)
- {
- end -= start;
- return -end * (Mathf.Sqrt(1f - value * value) - 1f) + start;
- }
- public static float easeOutCirc(float start, float end, float value, AnimationCurve curve = null)
- {
- value -= 1f;
- end -= start;
- return end * Mathf.Sqrt(1f - value * value) + start;
- }
- public static float easeInOutCirc(float start, float end, float value, AnimationCurve curve = null)
- {
- value /= 0.5f;
- end -= start;
- if (value < 1f)
- {
- return -end / 2f * (Mathf.Sqrt(1f - value * value) - 1f) + start;
- }
- value -= 2f;
- return end / 2f * (Mathf.Sqrt(1f - value * value) + 1f) + start;
- }
- public static float easeInBounce(float start, float end, float value, AnimationCurve curve = null)
- {
- end -= start;
- float num = 1f;
- return end - AMTween.easeOutBounce(0f, end, num - value, null) + start;
- }
- public static float easeOutBounce(float start, float end, float value, AnimationCurve curve = null)
- {
- value /= 1f;
- end -= start;
- if (value < 0.363636374f)
- {
- return end * (7.5625f * value * value) + start;
- }
- if (value < 0.727272749f)
- {
- value -= 0.545454562f;
- return end * (7.5625f * value * value + 0.75f) + start;
- }
- if ((double)value < 0.90909090909090906)
- {
- value -= 0.8181818f;
- return end * (7.5625f * value * value + 0.9375f) + start;
- }
- value -= 0.954545438f;
- return end * (7.5625f * value * value + 0.984375f) + start;
- }
- public static float easeInOutBounce(float start, float end, float value, AnimationCurve curve = null)
- {
- end -= start;
- float num = 1f;
- if (value < num / 2f)
- {
- return AMTween.easeInBounce(0f, end, value * 2f, null) * 0.5f + start;
- }
- return AMTween.easeOutBounce(0f, end, value * 2f - num, null) * 0.5f + end * 0.5f + start;
- }
- public static float easeInBack(float start, float end, float value, AnimationCurve curve = null)
- {
- end -= start;
- value /= 1f;
- float num = 1.70158f;
- return end * value * value * ((num + 1f) * value - num) + start;
- }
- public static float easeOutBack(float start, float end, float value, AnimationCurve curve = null)
- {
- float num = 1.70158f;
- end -= start;
- value = value / 1f - 1f;
- return end * (value * value * ((num + 1f) * value + num) + 1f) + start;
- }
- public static float easeInOutBack(float start, float end, float value, AnimationCurve curve = null)
- {
- float num = 1.70158f;
- end -= start;
- value /= 0.5f;
- if (value < 1f)
- {
- num *= 1.525f;
- return end / 2f * (value * value * ((num + 1f) * value - num)) + start;
- }
- value -= 2f;
- num *= 1.525f;
- return end / 2f * (value * value * ((num + 1f) * value + num) + 2f) + start;
- }
- public static float punch(float amplitude, float value, AnimationCurve curve = null)
- {
- if (value == 0f)
- {
- return 0f;
- }
- if (value == 1f)
- {
- return 0f;
- }
- float num = 0.3f;
- float num2 = num / 6.28318548f * Mathf.Asin(0f);
- return amplitude * Mathf.Pow(2f, -10f * value) * Mathf.Sin((value * 1f - num2) * 6.28318548f / num);
- }
- public static float easeInElastic(float start, float end, float value, AnimationCurve curve = null)
- {
- end -= start;
- float num = 1f;
- float num2 = num * 0.3f;
- float num3 = 0f;
- if (value == 0f)
- {
- return start;
- }
- if ((value /= num) == 1f)
- {
- return start + end;
- }
- float num4;
- if (num3 == 0f || num3 < Mathf.Abs(end))
- {
- num3 = end;
- num4 = num2 / 4f;
- }
- else
- {
- num4 = num2 / 6.28318548f * Mathf.Asin(end / num3);
- }
- return -(num3 * Mathf.Pow(2f, 10f * (value -= 1f)) * Mathf.Sin((value * num - num4) * 6.28318548f / num2)) + start;
- }
- public static float easeOutElastic(float start, float end, float value, AnimationCurve curve = null)
- {
- end -= start;
- float num = 1f;
- float num2 = num * 0.3f;
- float num3 = 0f;
- if (value == 0f)
- {
- return start;
- }
- if ((value /= num) == 1f)
- {
- return start + end;
- }
- float num4;
- if (num3 == 0f || num3 < Mathf.Abs(end))
- {
- num3 = end;
- num4 = num2 / 4f;
- }
- else
- {
- num4 = num2 / 6.28318548f * Mathf.Asin(end / num3);
- }
- return num3 * Mathf.Pow(2f, -10f * value) * Mathf.Sin((value * num - num4) * 6.28318548f / num2) + end + start;
- }
- public static float easeInOutElastic(float start, float end, float value, AnimationCurve curve = null)
- {
- end -= start;
- float num = 1f;
- float num2 = num * 0.3f;
- float num3 = 0f;
- if (value == 0f)
- {
- return start;
- }
- if ((value /= num / 2f) == 2f)
- {
- return start + end;
- }
- float num4;
- if (num3 == 0f || num3 < Mathf.Abs(end))
- {
- num3 = end;
- num4 = num2 / 4f;
- }
- else
- {
- num4 = num2 / 6.28318548f * Mathf.Asin(end / num3);
- }
- if (value < 1f)
- {
- return -0.5f * (num3 * Mathf.Pow(2f, 10f * (value -= 1f)) * Mathf.Sin((value * num - num4) * 6.28318548f / num2)) + start;
- }
- return num3 * Mathf.Pow(2f, -10f * (value -= 1f)) * Mathf.Sin((value * num - num4) * 6.28318548f / num2) * 0.5f + end + start;
- }
- public static ArrayList tweens_ = new ArrayList();
- public static ArrayList disabledTweens = new ArrayList();
- private static GameObject cameraFade;
- public string id;
- public string type;
- public string method;
- public AMTween.EaseType easeType;
- public AnimationCurve easeCurve;
- public float time;
- public float delay;
- public AMTween.LoopType loopType;
- public bool isRunning;
- public bool isPaused;
- public string _name;
- private float runningTime;
- private float percentage;
- private float delayStarted;
- private bool kinematic;
- private bool isLocal;
- private bool loop;
- private bool reverse;
- private bool wasPaused;
- private bool physics;
- private Hashtable tweenArguments;
- private Space space;
- private AMTween.EasingFunction ease;
- private AMTween.ApplyTween apply;
- private AudioSource audioSource;
- private Vector3[] vector3s;
- private Vector2[] vector2s;
- private Color[,] colors;
- private float[] floats;
- private Rect[] rects;
- private float[] startMorphs;
- private float[] endMorphs;
- private float[] currentMorphs;
- private AMTween.CRSpline path;
- private Vector3 preUpdate;
- private Vector3 postUpdate;
- private AMTween.NamedValueColor namedcolorvalue;
- private float lastRealTime;
- private bool useRealTime;
- public static string[] TransitionNamesDict = new string[]
- {
- "Crossfade",
- "Venetian Blinds",
- "Doors",
- "Iris Box",
- "Iris Round",
- "None",
- "Iris Shape",
- "Shape Wipe",
- "Linear Wipe",
- "Radial Wipe",
- "Wedge Wipe"
- };
- public static string[] TransitionNames = new string[]
- {
- "None",
- "Crossfade",
- "Doors",
- "Venetian Blinds",
- "Iris Box",
- "Iris Round",
- "Iris Shape",
- "Linear Wipe",
- "Shape Wipe",
- "Radial Wipe",
- "Wedge Wipe"
- };
- public static int[] TransitionOrder = new int[]
- {
- 5,
- 0,
- 2,
- 1,
- 3,
- 4,
- 6,
- 8,
- 7,
- 9,
- 10
- };
- public delegate float EasingFunction(float start, float end, float value, AnimationCurve curve);
- private delegate void ApplyTween();
- public enum EaseType
- {
- easeInQuad,
- easeOutQuad,
- easeInOutQuad,
- easeInCubic,
- easeOutCubic,
- easeInOutCubic,
- easeInQuart,
- easeOutQuart,
- easeInOutQuart,
- easeInQuint,
- easeOutQuint,
- easeInOutQuint,
- easeInSine,
- easeOutSine,
- easeInOutSine,
- easeInExpo,
- easeOutExpo,
- easeInOutExpo,
- easeInCirc,
- easeOutCirc,
- easeInOutCirc,
- linear,
- spring,
- easeInBounce,
- easeOutBounce,
- easeInOutBounce,
- easeInBack,
- easeOutBack,
- easeInOutBack,
- easeInElastic,
- easeOutElastic,
- easeInOutElastic,
- punch,
- stayStart,
- stayEnd
- }
- public enum LoopType
- {
- none,
- loop,
- pingPong
- }
- public enum NamedValueColor
- {
- _Color,
- _SpecColor,
- _Emission,
- _ReflectColor
- }
- public enum Fade
- {
- CrossFade,
- VenetianBlinds,
- Doors,
- IrisBox,
- IrisRound,
- None,
- IrisShape,
- ShapeWipe,
- LinearWipe,
- RadialWipe,
- WedgeWipe
- }
- public static class Defaults
- {
- public static float time = 1f;
- public static float delay = 0f;
- public static AMTween.NamedValueColor namedColorValue = AMTween.NamedValueColor._Color;
- public static AMTween.LoopType loopType = AMTween.LoopType.none;
- public static AMTween.EaseType easeType = AMTween.EaseType.easeOutExpo;
- public static float lookSpeed = 3f;
- public static bool isLocal = false;
- public static Space space = Space.Self;
- public static bool orientToPath = false;
- public static Color color = Color.white;
- public static float updateTimePercentage = 0.05f;
- public static float updateTime = 1f * AMTween.Defaults.updateTimePercentage;
- public static int cameraFadeDepth = 999999;
- public static float lookAhead = 0.05f;
- public static bool useRealTime = false;
- public static Vector3 up = Vector3.up;
- }
- private class CRSpline
- {
- public CRSpline(params Vector3[] pts)
- {
- this.pts = new Vector3[pts.Length];
- Array.Copy(pts, this.pts, pts.Length);
- }
- public Vector3 Interp(float t)
- {
- int num = this.pts.Length - 3;
- int num2 = Mathf.Min(Mathf.FloorToInt(t * (float)num), num - 1);
- float num3 = t * (float)num - (float)num2;
- Vector3 a = this.pts[num2];
- Vector3 a2 = this.pts[num2 + 1];
- Vector3 vector = this.pts[num2 + 2];
- Vector3 b = this.pts[num2 + 3];
- 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);
- }
- public Vector3[] pts;
- }
- }
|