local state=0 --0みじかい 1ながい local color_state=0 --0 白   他 色の状態 local to_color = Color.__new(1,0,0,1)--オリジナルカラー local Anime = vci.assets.GetTransform("light_forstage") local SubitemAnime = Anime.GetAnimation() function onUse(use) --同期処理-------------------------------- if vci.state.Get("STATE")==nil then--状態 stateの同期 vci.state.Set("STATE",state) else state=vci.state.Get("STATE")--グリップ時に共通変数で同期取得 end if vci.state.Get("COLOR_STATE")==nil then--状態 light_stateの同期 vci.state.Set("COLOR_STATE",color_state) else color_state=vci.state.Get("COLOR_STATE")--グリップ時に共通変数で同期取得 end --光の形状の状態------ベース部分を掴んだ場合の処理--------------- if use=="light_forstage" then print("base_grab_OK")--------------- if state==0 then SubitemAnime._ALL_PlayFromName("light_long",false) state=1 vci.state.Set("STATE",state) elseif state==1 then SubitemAnime._ALL_PlayFromName("light_short",false) state=0 vci.state.Set("STATE",state) end end --ライトコントローラーを掴んだ場合の処理------------------------- if use=="light_controller" then color_state=color_state+1 print("light_grab_OK")--------------- if color_state>7 then color_state=0--オリジナルカラーに end vci.state.Set("COLOR_STATE",color_state)--同期 if color_state==0 then to_color = Color.__new(1,1,1,0.2)--オリジナルカラー vci.assets.material._ALL_SetColor ("light_light",to_color) vci.assets.material._ALL_SetColor ("light_noshadow",to_color) elseif color_state==1 then to_color = Color.__new(1,0,0,0.2)--red vci.assets.material._ALL_SetColor ("light_light",to_color) vci.assets.material._ALL_SetColor ("light_noshadow",to_color) elseif color_state==2 then to_color = Color.__new(1,0.65,0,0.2)--orange vci.assets.material._ALL_SetColor ("light_light",to_color) vci.assets.material._ALL_SetColor ("light_noshadow",to_color) elseif color_state==3 then to_color = Color.__new(1,1,0,0.2)--yellow vci.assets.material._ALL_SetColor ("light_light",to_color) vci.assets.material._ALL_SetColor ("light_noshadow",to_color) elseif color_state==4 then to_color = Color.__new(0,0.5,0,0.2)--green vci.assets.material._ALL_SetColor ("light_light",to_color) vci.assets.material._ALL_SetColor ("light_noshadow",to_color) elseif color_state==5 then to_color = Color.__new(0,1,1,0.2)--blue vci.assets.material._ALL_SetColor ("light_light",to_color) vci.assets.material._ALL_SetColor ("light_noshadow",to_color) elseif color_state==6 then to_color = Color.__new(0,0,1,0.2)--indigo vci.assets.material._ALL_SetColor ("light_light",to_color) vci.assets.material._ALL_SetColor ("light_noshadow",to_color) elseif color_state==7 then to_color = Color.__new(0.5,0,0.5,0.2)--violet vci.assets.material._ALL_SetColor ("light_light",to_color) vci.assets.material._ALL_SetColor ("light_noshadow",to_color) else ----何もしない end end----------- end