/*
 *	RailSim II Train Plugin
 *	Copyright (c) 2009 インターネット停留所
 */

PluginHeader{
	RailSimVersion = 2.00;
	PluginType = Train;
	PluginName = "【東京地下鉄(東京メトロ)】半蔵門線08系先頭車";
	PluginAuthor = "篠ノ之隼(IS学園産業デザイン部RailSim課)";
	IconTexture = "../common_hayabusa/metro_icon.png";
	Description = "";

}

TrainInfo{
	FrontLimit = 10.15;	//	前方連結位置 Z 座標
	TailLimit = -10.2;	//	後方連結位置 Z 座標
	MaxVelocity = 120.0;	//	最高速度
	MaxAcceleration = 3.0;	//	最高加速度
	MaxDeceleration = 4.0;	//	最高減速度
	TiltSpeed = 0.1;	//	振り子反応速度
	DoorClosingTime = 6.0;	//	ドア閉め所要時間
}
DefineSwitch "前照灯"{
GroupCommon = "前照灯";
	Entry = "ON";
	Entry = "OFF";
}
DefineSwitch "種別"{
GroupCommon = "種別";
	Entry = "表示無";
	Entry = "急行";
	Entry = "準急";
	Entry = "区間準急";
	Entry = "通勤準急";
	Entry = "試運転";
	Entry = "回送";
}
DefineSwitch "行先"{
GroupCommon = "行先";
	Entry = "表示無";
	Entry = "中央林間";
	Entry = "長津田";
	Entry = "鷺沼";
	Entry = "渋谷";
	Entry = "半蔵門";
	Entry = "清澄白河";
	Entry = "押上";
	Entry = "久喜";
	Entry = "南栗橋";
}
DefineSwitch "列番3桁"{
GroupCommon = "列番3桁";
	Entry = "表示無";
	Entry = "0";
	Entry = "1";
	Entry = "2";
	Entry = "3";
	Entry = "4";
	Entry = "5";
	Entry = "6";
	Entry = "7";
	Entry = "8";
	Entry = "9";
}
DefineSwitch "列番2桁"{
GroupCommon = "列番2桁";
	Entry = "表示無";
	Entry = "0";
	Entry = "1";
	Entry = "2";
	Entry = "3";
	Entry = "4";
	Entry = "5";
	Entry = "6";
	Entry = "7";
	Entry = "8";
	Entry = "9";
}
DefineSwitch "列番1桁"{
GroupCommon = "列番1桁";
	Entry = "表示無";
	Entry = "S";
	Entry = "T";
	Entry = "K";
}
DefineSwitch "車両"{
	Entry = "1号車";
	Entry = "10号車";
}
DefineSwitch "ドア"{
GroupCommon = "ドア";
	Entry = "自動";
	Entry = "左";
	Entry = "右";
}
DefineSwitch "サウンド"{
GroupCommon = "サウンド";
	Entry = "OFF";
	Entry = "ON";
}
DefineSwitch "簡易シャドウ"{
GroupCommon = "簡易シャドウ";
	Entry = "無";
	Entry = "有";
}

PrimaryAssembly{
	Axle "Wheel1"{
		ModelFileName = "Wheel.x";
		ModelScale = 1.0;
		Diameter = 0.8;
		Symmetric = 8;
		Coord = (8.1, 0.4);
	}
	Axle "Wheel2"{
		ModelFileName = "Wheel.x";
		ModelScale = 1.0;
		Diameter = 0.8;
		Symmetric = 8;
		Coord = (5.9, 0.4);
	}
	Axle "Wheel3"{
		ModelFileName = "Wheel.x";
		ModelScale = 1.0;
		Diameter = 0.8;
		Symmetric = 8;
		Coord = (-5.9, 0.4);
	}
	Axle "Wheel4"{
		ModelFileName = "Wheel.x";
		ModelScale = 1.0;
		Diameter = 0.8;
		Symmetric = 8;
		Coord = (-8.1, 0.4);
	}
	Body "Bogie1"{
		ModelFileName = "Bogie1.x";
		ModelScale = 1.0;
		JointZY "Wheel1"{
			AttachCoord = (0.0, 0.0);
			LocalCoord = (1.0, 0.0);
		}
		JointZY "Wheel2"{
			AttachCoord = (0.0, 0.0);
			LocalCoord = (-1.0, 0.0);
		}
	}
	Body "Bogie2"{
		ModelFileName = "Bogie.x";
		ModelScale = 1.0;
		Turn = yes;
		JointZY "Wheel3"{
			AttachCoord = (0.0, 0.0);
			LocalCoord = (-1.0, 0.0);
		}
		JointZY "Wheel4"{
			AttachCoord = (0.0, 0.0);
			LocalCoord = (1.0, 0.0);
		}
	}
	Body "MainBody"{
		ModelFileName = "body.x";
		ModelScale = 1.0;
		Turn = yes;
		AlphaZeroTest = 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20;
		ApplySwitch "行先"{
		Case 0:
			ChangeTexture = 3,"../common_hayabusa/hayabusa_metro08_tex/LED表示/側面行先/Non.png";
			ChangeTexture = 4,"../common_hayabusa/hayabusa_metro08_tex/LED表示/行先/Non.png";
			ChangeTexture = 5,"../common_hayabusa/hayabusa_metro08_tex/LED表示/側面行先(種別表示の際に使用)/Non.png";
			ChangeTexture = 7,"../common_hayabusa/hayabusa_metro08_tex/LED表示/前面行先/Non.png";
		Case 1:
			ChangeTexture = 3,"../common_hayabusa/hayabusa_metro08_tex/LED表示/側面行先/中央林間.png";
			ChangeTexture = 4,"../common_hayabusa/hayabusa_metro08_tex/LED表示/行先/中央林間.png";
			ChangeTexture = 5,"../common_hayabusa/hayabusa_metro08_tex/LED表示/側面行先(種別表示の際に使用)/中央林間.png";
			ChangeTexture = 7,"../common_hayabusa/hayabusa_metro08_tex/LED表示/前面行先/中央林間.png";
		Case 2:
			ChangeTexture = 3,"../common_hayabusa/hayabusa_metro08_tex/LED表示/側面行先/長津田.png";
			ChangeTexture = 4,"../common_hayabusa/hayabusa_metro08_tex/LED表示/行先/長津田.png";
			ChangeTexture = 5,"../common_hayabusa/hayabusa_metro08_tex/LED表示/側面行先(種別表示の際に使用)/長津田.png";
			ChangeTexture = 7,"../common_hayabusa/hayabusa_metro08_tex/LED表示/前面行先/長津田.png";
		Case 3:
			ChangeTexture = 3,"../common_hayabusa/hayabusa_metro08_tex/LED表示/側面行先/鷺沼.png";
			ChangeTexture = 4,"../common_hayabusa/hayabusa_metro08_tex/LED表示/行先/鷺沼.png";
			ChangeTexture = 5,"../common_hayabusa/hayabusa_metro08_tex/LED表示/側面行先(種別表示の際に使用)/鷺沼.png";
			ChangeTexture = 7,"../common_hayabusa/hayabusa_metro08_tex/LED表示/前面行先/鷺沼.png";
		Case 4:
			ChangeTexture = 3,"../common_hayabusa/hayabusa_metro08_tex/LED表示/側面行先/渋谷.png";
			ChangeTexture = 4,"../common_hayabusa/hayabusa_metro08_tex/LED表示/行先/渋谷.png";
			ChangeTexture = 5,"../common_hayabusa/hayabusa_metro08_tex/LED表示/側面行先(種別表示の際に使用)/渋谷.png";
			ChangeTexture = 7,"../common_hayabusa/hayabusa_metro08_tex/LED表示/前面行先/渋谷.png";
		Case 5:
			ChangeTexture = 3,"../common_hayabusa/hayabusa_metro08_tex/LED表示/側面行先/半蔵門.png";
			ChangeTexture = 4,"../common_hayabusa/hayabusa_metro08_tex/LED表示/行先/半蔵門.png";
			ChangeTexture = 5,"../common_hayabusa/hayabusa_metro08_tex/LED表示/側面行先(種別表示の際に使用)/半蔵門.png";
			ChangeTexture = 7,"../common_hayabusa/hayabusa_metro08_tex/LED表示/前面行先/半蔵門.png";
		Case 6:
			ChangeTexture = 3,"../common_hayabusa/hayabusa_metro08_tex/LED表示/側面行先/清澄白河.png";
			ChangeTexture = 4,"../common_hayabusa/hayabusa_metro08_tex/LED表示/行先/清澄白河.png";
			ChangeTexture = 5,"../common_hayabusa/hayabusa_metro08_tex/LED表示/側面行先(種別表示の際に使用)/清澄白河.png";
			ChangeTexture = 7,"../common_hayabusa/hayabusa_metro08_tex/LED表示/前面行先/清澄白河.png";
		Case 7:
			ChangeTexture = 3,"../common_hayabusa/hayabusa_metro08_tex/LED表示/側面行先/押上.png";
			ChangeTexture = 4,"../common_hayabusa/hayabusa_metro08_tex/LED表示/行先/押上.png";
			ChangeTexture = 5,"../common_hayabusa/hayabusa_metro08_tex/LED表示/側面行先(種別表示の際に使用)/押上.png";
			ChangeTexture = 7,"../common_hayabusa/hayabusa_metro08_tex/LED表示/前面行先/押上.png";
		Case 8:
			ChangeTexture = 3,"../common_hayabusa/hayabusa_metro08_tex/LED表示/側面行先/久喜.png";
			ChangeTexture = 4,"../common_hayabusa/hayabusa_metro08_tex/LED表示/行先/久喜.png";
			ChangeTexture = 5,"../common_hayabusa/hayabusa_metro08_tex/LED表示/側面行先(種別表示の際に使用)/久喜.png";
			ChangeTexture = 7,"../common_hayabusa/hayabusa_metro08_tex/LED表示/前面行先/久喜.png";
		Case 9:
			ChangeTexture = 3,"../common_hayabusa/hayabusa_metro08_tex/LED表示/側面行先/南栗橋.png";
			ChangeTexture = 4,"../common_hayabusa/hayabusa_metro08_tex/LED表示/行先/南栗橋.png";
			ChangeTexture = 5,"../common_hayabusa/hayabusa_metro08_tex/LED表示/側面行先(種別表示の際に使用)/南栗橋.png";
			ChangeTexture = 7,"../common_hayabusa/hayabusa_metro08_tex/LED表示/前面行先/南栗橋.png";
                      }
		ApplySwitch "種別"{
		Case 0:
			ChangeTexture = 6,"../common_hayabusa/hayabusa_metro08_tex/LED表示/種別/Non.png";
		Case 1:
			ChangeTexture = 6,"../common_hayabusa/hayabusa_metro08_tex/LED表示/種別/急行.png";
			ChangeTexture = 11,"../common_hayabusa/hayabusa_metro08_tex/LED表示/前面種別表示/急行.png";
			ChangeTexture = 3,"../common_hayabusa/hayabusa_metro08_tex/LED表示/側面行先/Non1.png";
			ChangeTexture = 7,"../common_hayabusa/hayabusa_metro08_tex/LED表示/側面行先/Non1.png";
		Case 2:
			ChangeTexture = 6,"../common_hayabusa/hayabusa_metro08_tex/LED表示/種別/準急.png";
			ChangeTexture = 11,"../common_hayabusa/hayabusa_metro08_tex/LED表示/前面種別表示/準急.png";
			ChangeTexture = 3,"../common_hayabusa/hayabusa_metro08_tex/LED表示/側面行先/Non1.png";
			ChangeTexture = 7,"../common_hayabusa/hayabusa_metro08_tex/LED表示/側面行先/Non1.png";
		Case 3:
			ChangeTexture = 6,"../common_hayabusa/hayabusa_metro08_tex/LED表示/種別/区間準急.png";
			ChangeTexture = 11,"../common_hayabusa/hayabusa_metro08_tex/LED表示/前面種別表示/区間準急.png";
			ChangeTexture = 3,"../common_hayabusa/hayabusa_metro08_tex/LED表示/側面行先/Non1.png";
			ChangeTexture = 7,"../common_hayabusa/hayabusa_metro08_tex/LED表示/側面行先/Non1.png";
		Case 4:
			ChangeTexture = 6,"../common_hayabusa/hayabusa_metro08_tex/LED表示/種別/通勤準急.png";
			ChangeTexture = 11,"../common_hayabusa/hayabusa_metro08_tex/LED表示/前面種別表示/通勤準急.png";
			ChangeTexture = 3,"../common_hayabusa/hayabusa_metro08_tex/LED表示/側面行先/Non1.png";
			ChangeTexture = 7,"../common_hayabusa/hayabusa_metro08_tex/LED表示/側面行先/Non1.png";
                      }
		ApplySwitch "列番3桁"{	
                Case 0:
			ChangeTexture = 8,"../common_hayabusa/hayabusa_metro08_tex/LED表示/列番/Non.png";	
                Case 1:
			ChangeTexture = 8,"../common_hayabusa/hayabusa_metro08_tex/LED表示/列番/0.png";
                Case 2:
			ChangeTexture = 8,"../common_hayabusa/hayabusa_metro08_tex/LED表示/列番/1.png";
                Case 3:
			ChangeTexture = 8,"../common_hayabusa/hayabusa_metro08_tex/LED表示/列番/2.png";
                Case 4:
			ChangeTexture = 8,"../common_hayabusa/hayabusa_metro08_tex/LED表示/列番/3.png";
                Case 5:
			ChangeTexture = 8,"../common_hayabusa/hayabusa_metro08_tex/LED表示/列番/4.png";
                Case 6:
			ChangeTexture = 8,"../common_hayabusa/hayabusa_metro08_tex/LED表示/列番/5.png";
                Case 7:
			ChangeTexture = 8,"../common_hayabusa/hayabusa_metro08_tex/LED表示/列番/6.png";
                Case 8:
			ChangeTexture = 8,"../common_hayabusa/hayabusa_metro08_tex/LED表示/列番/7.png";
                Case 9:
			ChangeTexture = 8,"../common_hayabusa/hayabusa_metro08_tex/LED表示/列番/8.png";
                Case 10:
			ChangeTexture = 8,"../common_hayabusa/hayabusa_metro08_tex/LED表示/列番/9.png";
                      }
		ApplySwitch "列番2桁"{
                Case 0:
			ChangeTexture = 9,"../common_hayabusa/hayabusa_metro08_tex/LED表示/列番/Non.png";	
                Case 1:
			ChangeTexture = 9,"../common_hayabusa/hayabusa_metro08_tex/LED表示/列番/0.png";
                Case 2:
			ChangeTexture = 9,"../common_hayabusa/hayabusa_metro08_tex/LED表示/列番/1.png";
                Case 3:
			ChangeTexture = 9,"../common_hayabusa/hayabusa_metro08_tex/LED表示/列番/2.png";
                Case 4:
			ChangeTexture = 9,"../common_hayabusa/hayabusa_metro08_tex/LED表示/列番/3.png";
                Case 5:
			ChangeTexture = 9,"../common_hayabusa/hayabusa_metro08_tex/LED表示/列番/4.png";
                Case 6:
			ChangeTexture = 9,"../common_hayabusa/hayabusa_metro08_tex/LED表示/列番/5.png";
                Case 7:
			ChangeTexture = 9,"../common_hayabusa/hayabusa_metro08_tex/LED表示/列番/6.png";
                Case 8:
			ChangeTexture = 9,"../common_hayabusa/hayabusa_metro08_tex/LED表示/列番/7.png";
                Case 9:
			ChangeTexture = 9,"../common_hayabusa/hayabusa_metro08_tex/LED表示/列番/8.png";
                Case 10:
			ChangeTexture = 9,"../common_hayabusa/hayabusa_metro08_tex/LED表示/列番/9.png";
                      }
		ApplySwitch "列番1桁"{
                Case 0:
			ChangeTexture = 10,"../common_hayabusa/hayabusa_metro08_tex/LED表示/列番/Non.png";
                Case 1:
			ChangeTexture = 10,"../common_hayabusa/hayabusa_metro08_tex/LED表示/列番/S.png";
                Case 2:
			ChangeTexture = 10,"../common_hayabusa/hayabusa_metro08_tex/LED表示/列番/T.png";
                Case 3:
			ChangeTexture = 10,"../common_hayabusa/hayabusa_metro08_tex/LED表示/列番/K.png";
                      }
		
		//	照明スイッチ
		ApplySwitch "前照灯"{
		Case 0:
			ApplySwitch "_CONNECT1"{
			Case 0:
				ApplySwitch "_FRONT"{
				Case 0:
				ChangeTexture = 1,"../common_hayabusa/hayabusa_metro08_tex/head2.png";
                       ChangeMaterial{
                                     MaterialID = 1;
                                        Emissive = 1.00, 1.00, 1.00; 
}
				Case 1:
				ChangeTexture = 2,"../common_hayabusa/hayabusa_metro08_tex/tail1.png";
                       ChangeMaterial{
                                     MaterialID = 2;
                                         Emissive = 1.00, 1.00, 1.00; 
			}
		}
	}
}
	
		JointZY "Bogie1"{
			AttachCoord = (0.0, 0.6);
			LocalCoord = (-7.5, 1.0);
		}
		JointZY "Bogie2"{
			AttachCoord = (0.0, 0.6);
			LocalCoord = (7.5, 1.0);
		}
	}
	Object3D "woman_only"{
		ModelFileName = "";
		ModelScale = 1.0;
		Turn = yes;
		ApplySwitch "車両"{
		Case 0:
　　　　　　　　　　　　ChangeModel = "woman_only.x",1.0;
		Case 1:
　　　　　　　　　　　　ChangeModel = "woman_only2.x",1.0;
		}
		Joint3D "MainBody"{
			AttachCoord = (0.0, 0.0, 0.0);
			}
		}
	Object3D "shadow"{
		ModelFileName = "shadow.x";
		ModelScale = 1.0;
		Turn = yes;
		ApplySwitch "簡易シャドウ"{
		Case 0:
　　　　　　　　　　　　ChangeModel = "",1.0;
			}
		Joint3D "MainBody"{
			AttachCoord = (0.0, 0.0, 0.0);
			}
		}
	Object3D "DoorL"{
		ModelFileName = "doorl-l.x";
		ModelScale = 1.0;
		AlphaZeroTest = 0,1;
		If("_DOOR1" && "ドア"==0) || ("車両"==0 && "ドア"==1) || ("車両"==1 && "ドア"==2){
				StaticMove{
				Displacement = (0.0, 0.0, 0.75);
				PreAnimationDelay = 0.5;
				AnimationTime = 3.0;
			}
		}
		
		Joint3D "MainBody"{
			AttachCoord = (0.0, 0.0, 0.0);
		}
	}
	Object3D "DoorL2"{
		ModelFileName = "doorl-r.x";
		ModelScale = 1.0;
		AlphaZeroTest = 0,1;
		If("_DOOR1" && "ドア"==0) || ("車両"==0 && "ドア"==1) || ("車両"==1 && "ドア"==2){
				StaticMove{
				Displacement = (0.0, 0.0, -0.75);
				PreAnimationDelay = 0.5;
				AnimationTime = 3.0;
			}
		}
		
		Joint3D "MainBody"{
			AttachCoord = (0.0, 0.0, 0.0);

		}
	}
	
	Object3D "DoorR"{
		ModelFileName = "doorr-l.x";
		ModelScale = 1.0;
		AlphaZeroTest = 0,1;
		If("_DOOR2" && "ドア"==0) || ("車両"==0 && "ドア"==2) || ("車両"==1 && "ドア"==1){
				StaticMove{
				Displacement = (-0.0, 0.0, 0.75);
				PreAnimationDelay = 0.5;
				AnimationTime = 3.0;
			}
		}
		
		Joint3D "MainBody"{
			AttachCoord = (0.0, 0.0, 0.0);
			AttachDir = (0.0, 0.0, -1.0);
		}
	}
	Object3D "DoorR2"{
		ModelFileName = "doorr-r.x";
		ModelScale = 1.0;
		AlphaZeroTest = 0,1;
		If("_DOOR2" && "ドア"==0) || ("車両"==0 && "ドア"==2) || ("車両"==1 && "ドア"==1){
			StaticMove{
				Displacement = (-0.0, 0.0, -0.75);
				PreAnimationDelay = 0.5;
				AnimationTime = 3.0;
			}
		}
		
		Joint3D "MainBody"{
			AttachCoord = (0.0, 0.0, 0.0);
			AttachDir = (0.0, 0.0, -1.0);
		}
	}
	Object3D "doorlampL"{
		ModelFileName = "車側灯.x";
		ModelScale = 1.0;
		NoShadow = 0,1;

		If("_DOOR1" && "ドア"==0) || ("車両"==0 && "ドア"==1) || ("車両"==1 && "ドア"==2){
			StaticRotation{
				RotationAxis = (0.0, -1.0, 0.0);
				RotationAngle = 180;
				PreAnimationDelay = 0.4;
				PreReverseDelay = 3.2;
			}
		}
		Joint3D "MainBody"{
			AttachCoord = (1.4, 0.0, 0.0);
		}
	}

	Object3D "doorlampR"{
		ModelFileName = "車側灯.x";
		ModelScale = 1.0;
		NoShadow = 0,1;


		StaticRotation{
			RotationAxis = (0.0, 1.0, 0.0);
			RotationAngle = 180;
		}

		If("_DOOR2" && "ドア"==0) || ("車両"==0 && "ドア"==2) || ("車両"==1 && "ドア"==1){
			StaticRotation{
				RotationAxis = (0.0, -1.0, 0.0);
				RotationAngle = 180;
				PreAnimationDelay = 0.4;
				PreReverseDelay = 3.2;
			}
		}
		Joint3D "MainBody"{
			AttachCoord = (-1.4, 0.0, 0.3);
		}
	}

//	照明スイッチ
	ApplySwitch "前照灯"{
	Case 0:
		//	前方に車輌が接続されていないときのみ点灯
		ApplySwitch "_CONNECT1"{
		Case 0:
			//	進行方向を判定
			ApplySwitch "_FRONT"{
			Case 0:

//	ヘッドライト
				Headlight{
					AttachObject = "MainBody";
					SourceCoord = (0.84, 1.42, -10.0);
					Direction = (0.0, 0.0, -1.0);
					MaxDistance = 50.0;
					LensFlare{
						StartAngle = 100.0;
						Twinkle = 0.1;
						Texture{
							Distance = 0.0;
							Radius = 0.4;
							TexFileName = "../common_hayabusa/hayabusa_metro08_tex/Flare.png";
						}
					}
				}
				Headlight{
					AttachObject = "MainBody";
					SourceCoord = (-0.84, 1.42, -10.0);
					Direction = (0.0, 0.0, -1.0);
					MaxDistance = 10.0;
				}

			Case 1:
		}
	}
}
//サウンドエフェクト
	
//ドア
If ("サウンド"==1 && "ドア"==0) || ("サウンド"==1 && "ドア"==1) || ("サウンド"==1 && "ドア"==2){
	ApplySwitch "_DOOR1"|"_DOOR2"{
	Case 0:
	If 0=="_VELOCITY"{
		SoundEffect{
		WaveFileName = "../common_hayabusa/hayabusa_metro08_tex/sound/doorcls.wav";
		AttachObject = "MainBody";
		SourceCoord = (0.0, 3.0 ,0.0);
		Loop = no;
		}
	}
	Case 1:
		SoundEffect{
		WaveFileName = "../common_hayabusa/hayabusa_metro08_tex/sound/dooropn.wav";
		AttachObject = "MainBody";
		SourceCoord = (0.0, 3.0 ,0.0);
		Loop = no;
		}
	}
}
	FrontCabin{
		Joint3D "MainBody"{
			AttachCoord = (0.3, 2.9, -9.50);
			DirLink = "Bogie1";
		}
	}
}
