



 

Shader "Custom/Shader_VertexColor" {
	Properties {
			_MainTex ("Albedo", 2D) = "white" { }
			_Color      ("Color"     , Color      ) = (1, 1, 1, 1)
			_MetallicGlossMap("Gloss Map", 2D) = "white" {}	//追加
			_Metallic   ("Metallic"  , Range(0, 1)) = 0.0
			_Glossiness ("Smoothness", Range(0, 1)) = 0.5
			_Occlusion  ("Occlusion" , Range(0, 1)) = 1.0
		 	_BumpScale ("Scale", Float) = 1
 			_BumpMap ("Normal Map", 2D) = "bump" { } 			 
			_DetailAlbedoMap("Detail Albedo x2", 2D) = "white" {}
			_DetailNormalMapScale("Scale", Float) = 1.0
			_DetailNormalMap("Normal Map", 2D) = "bump" {}
			_DetailMask("Detail Mask", 2D) = "black" {}
	}
	SubShader {
		Tags {
			"Queue"      = "Geometry"
			"RenderType" = "Opaque"
			}
		
		CGPROGRAM
			#pragma target 3.0
			#pragma surface surf Standard fullforwardshadows
			
			fixed4 _Color;
			
			sampler2D _MainTex;
			sampler2D _BumpMap; 
			sampler2D _DetailAlbedoMap;
			sampler2D _DetailNormalMap;			
			sampler2D _DetailMask;
			sampler2D   _MetallicGlossMap;	//追加
 			half _BumpScale; 
			half _Glossiness;
			half _Metallic;
			half _Occlusion;
 			half _DetailNormalMapScale; 
			struct Input {
				float2 uv_MainTex;
				float2 uv2_DetailAlbedoMap;
				fixed4 color : COLOR;
			};
			void surf (Input IN, inout SurfaceOutputStandard o) {
				fixed4 c1 = tex2D(_MainTex, IN.uv_MainTex) * _Color;
				fixed4 c2 = tex2D(_DetailAlbedoMap, IN.uv2_DetailAlbedoMap) * _Color;
				fixed4 m = tex2D(_DetailMask, IN.uv_MainTex);
				o.Albedo     = lerp(c1, c2, m) * lerp(1, IN.color, _Occlusion);
				half4 glossmap = tex2D(_MetallicGlossMap, IN.uv_MainTex);	//追加
				o.Metallic = glossmap.r * _Metallic;	//修正
				o.Smoothness = glossmap.a * _Glossiness;	//修正
				fixed3 n  = UnpackScaleNormal(tex2D(_BumpMap, IN.uv_MainTex), _BumpScale);
				fixed3 n2 = UnpackScaleNormal(tex2D(_DetailNormalMap, IN.uv2_DetailAlbedoMap), _DetailNormalMapScale);
				o.Normal= BlendNormals(n, n2);
			}
		ENDCG
	}
	FallBack "Diffuse"
}

 

this.frame = this.ab.LoadAsset("frame.prefab") as GameObject;
this.frame = UnityEngine.Object.Instantiate<GameObject>(this.frame);
UnityEngine.Object.Destroy(this.frame);
GameObject.Find("JONNEZ ES(Clone)/MESH/frame").GetComponent<MeshFilter>().sharedMesh = this.frame.GetComponentInChildren<MeshFilter>().sharedMesh;
GameObject.Find("JONNEZ ES(Clone)/MESH/frame").GetComponent<MeshRenderer>().sharedMaterials = this.frame.GetComponent<MeshRenderer>().sharedMaterials;   
this.ext = this.ab.LoadAsset("ext.prefab") as GameObject;
this.ext = UnityEngine.Object.Instantiate<GameObject>(this.ext);
this.ext.transform.SetParent(GameObject.Find("JONNEZ ES(Clone)/MESH/frame").transform);
this.ext.transform.localPosition = new Vector3(0f, 0f, 0f);
this.ext.transform.localEulerAngles = new Vector3(0f, 0f, 0f);
this.ext.transform.localScale = new Vector3(1f, 1f, 1f);
this.col = this.ab.LoadAsset("col.fbx") as GameObject;
this.col = UnityEngine.Object.Instantiate<GameObject>(this.col);
UnityEngine.Object.Destroy(this.col);
GameObject.Find("JONNEZ ES(Clone)/Colliders/Coll").GetComponent<MeshCollider>().sharedMesh = this.col.GetComponentInChildren<MeshFilter>().mesh;
public override void OnLoad()
	{
		//タイヤの位置設定
		GameObject.Find("JONNEZ ES(Clone)/Wheels/Moped_wheelFL").transform.localPosition = new Vector3(-0.02f, 0f, 0.4698f);
		GameObject.Find("JONNEZ ES(Clone)/Wheels/Moped_wheelFR").transform.localPosition = new Vector3(0.02f, 0f, 0.4698f);
		GameObject.Find("JONNEZ ES(Clone)/Wheels/Moped_wheelRL").transform.localPosition = new Vector3(-0.02f, 0f, -0.47435f);
		GameObject.Find("JONNEZ ES(Clone)/Wheels/Moped_wheelRR").transform.localPosition = new Vector3(0.02f, 0f, -0.47435f);
	}
	
public override void Update()
	{
		//タイヤのコリジョン設定
		JONNEZ = GameObject.Find("JONNEZ ES(Clone)");
		JONNEZ.GetComponent<Axles>().frontAxle.leftWheel.radius = 0.21f;
		JONNEZ.GetComponent<Axles>().frontAxle.rightWheel.radius = 0.21f;
		JONNEZ.GetComponent<Axles>().rearAxle.leftWheel.radius = 0.21f;
		JONNEZ.GetComponent<Axles>().rearAxle.rightWheel.radius = 0.21f;
	}

 

Shader "Custom/Shader_VertexColor" {
	Properties {
			_MainTex ("Albedo", 2D) = "white" { }
			_Color      ("Color"     , Color      ) = (1, 1, 1, 1)
			_Metallic   ("Metallic"  , Range(0, 1)) = 0.0
			_Glossiness ("Smoothness", Range(0, 1)) = 0.5
			_Occlusion  ("Occlusion" , Range(0, 1)) = 1.0
		 	_BumpScale ("Scale", Float) = 1
 			_BumpMap ("Normal Map", 2D) = "bump" { } 			 
			_DetailAlbedoMap("Detail Albedo x2", 2D) = "white" {}
			_DetailNormalMapScale("Scale", Float) = 1.0
			_DetailNormalMap("Normal Map", 2D) = "bump" {}
			_DetailMask("Detail Mask", 2D) = "white" {}
	}
	SubShader {
		Tags {
			"Queue"      = "Geometry"
			"RenderType" = "Opaque"
			}
		
		CGPROGRAM
			#pragma target 3.0
			#pragma surface surf Standard fullforwardshadows
			
			fixed4 _Color;
			
			sampler2D _MainTex;
			sampler2D _BumpMap; 
			sampler2D _DetailAlbedoMap;
			sampler2D _DetailNormalMap;
			sampler2D _DetailMask;
 			half _BumpScale; 
			half _Glossiness;
			half _Metallic;
			half _Occlusion;
 			half _DetailNormalMapScale; 
			struct Input {
				float2 uv_MainTex;
				float2 uv2_DetailAlbedoMap;
				fixed4 color : COLOR;
			};
			void surf (Input IN, inout SurfaceOutputStandard o) {
				fixed4 c1 = tex2D(_MainTex, IN.uv_MainTex) * _Color;
				fixed4 c2 = tex2D(_DetailAlbedoMap, IN.uv2_DetailAlbedoMap) * _Color;
				fixed4 m = tex2D(_DetailMask, IN.uv_MainTex);
				o.Albedo     = lerp(c1, c2, m) * lerp(1, IN.color, _Occlusion);
				o.Metallic   = _Metallic;
				o.Smoothness = _Glossiness;
				fixed3 n  = UnpackScaleNormal(tex2D(_BumpMap, IN.uv_MainTex), _BumpScale);
				fixed3 n2 = UnpackScaleNormal(tex2D(_DetailNormalMap, IN.uv2_DetailAlbedoMap), _DetailNormalMapScale);
				o.Normal= BlendNormals(n, n2);
			}
		ENDCG
	}
	FallBack "Diffuse"
}

 

using System;
using MSCLoader;
using UnityEngine;
using Object = System.Object;
namespace NSR50
{
	public class NSR50 : Mod
	{
		public override string ID => "g_NSR50"; //Your mod ID (unique)
		public override string Name => "g_NSR50"; //You mod name
		public override string Author => "gosuke"; //Your Username
		public override string Version => "1.0"; //Version
		// Set this to true if you will be load custom assets from Assets folder.
		// This will create subfolder in Assets folder for your mod.
		public override bool UseAssetsFolder
		{
			get
			{
				return true;
			}
		}
	public override void OnNewGame()
		{
			// Called once, when starting a New Game, you can reset your saves here
		}
		public override void OnLoad()
		{
			// Called once, when mod is loading after game is fully loaded
			//アセットの読み込み
			this.ab = LoadAssets.LoadBundle(this, "nsr50.unity3d");
			
			//メッシュの読み込み
        	this.frame = this.ab.LoadAsset("frame.fbx") as GameObject;
			
			//マテリアルの読み込み
			this.nsrMat = this.ab.LoadAsset("nsrMat.mat") as Material;
			this.ab.Unload(false);
			this.frame = UnityEngine.Object.Instantiate<GameObject>(this.frame);
			UnityEngine.Object.Destroy(this.frame);
			//メッシュの置き換え
			GameObject.Find("JONNEZ ES(Clone)/MESH/frame").GetComponent<MeshFilter>().sharedMesh = this.frame.GetComponentInChildren<MeshFilter>().sharedMesh;
			//マテリアルの置き換え
			GameObject.Find("JONNEZ ES(Clone)/MESH/frame").GetComponent<MeshRenderer>().sharedMaterial = this.nsrMat;
			//位置・向き・スケールの設定
			GameObject.Find("JONNEZ ES(Clone)/MESH/frame").transform.localPosition = new Vector3(0f, 0f, 0f);
			GameObject.Find("JONNEZ ES(Clone)/MESH/frame").transform.localEulerAngles = new Vector3(0f, 0f, 0f);
			GameObject.Find("JONNEZ ES(Clone)/MESH/frame").transform.localScale = new Vector3(1f, 1f, 1f);
			}
		private AssetBundle ab;
		private GameObject frame;
		private Material nsrMat;
    }
}


Shader "Custom/Shader_VertexColor" {
	Properties {
			_MainTex ("Albedo", 2D) = "white" { }
			_Color      ("Color"     , Color      ) = (1, 1, 1, 1)
			_Metallic   ("Metallic"  , Range(0, 1)) = 0.0
			_Glossiness ("Smoothness", Range(0, 1)) = 0.5
			_Occlusion  ("Occlusion" , Range(0, 1)) = 1.0
		 	_BumpScale ("Scale", Float) = 1
 			_BumpMap ("Normal Map", 2D) = "bump" { }
	}
	SubShader {
		Tags {
			"Queue"      = "Geometry"
			"RenderType" = "Opaque"
			}
		
		CGPROGRAM
			#pragma target 3.0
			#pragma surface surf Standard fullforwardshadows
			fixed4 _Color;
			sampler2D _MainTex;
			sampler2D _BumpMap; 
 			half _BumpScale; 
			half _Glossiness;
			half _Metallic;
			half _Occlusion;
			struct Input {
			float2 uv_MainTex;
				fixed4 color : COLOR;
			};
			void surf (Input IN, inout SurfaceOutputStandard o) {
				fixed4 c = tex2D(_MainTex, IN.uv_MainTex) * _Color;
				o.Albedo     = c.rgb * lerp(1, IN.color, _Occlusion);
				o.Metallic   = _Metallic;
				o.Smoothness = _Glossiness;
				fixed4 n = tex2D(_BumpMap, IN.uv_MainTex); 
				o.Normal = UnpackScaleNormal(n, _BumpScale); 
			}
		ENDCG
	}
	FallBack "Diffuse"
}











