ground material change

This commit is contained in:
2023-03-25 16:26:23 +01:00
parent 9cf8d48e4b
commit 320ab88bdf
21 changed files with 147 additions and 26 deletions

View File

@@ -0,0 +1,80 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Black
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
m_ValidKeywords: []
m_InvalidKeywords: []
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _BumpScale: 1
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _GlossMapScale: 1
- _Glossiness: 0.239
- _GlossyReflections: 1
- _Metallic: 0
- _Mode: 0
- _OcclusionStrength: 1
- _Parallax: 0.02
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _UVSec: 0
- _ZWrite: 1
m_Colors:
- _Color: {r: 0, g: 0, b: 0, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
m_BuildTextureStacks: []

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: cec427bc0abfad54ca8fe959fd2360cf
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -3276,6 +3276,12 @@ MonoBehaviour:
m_EditorClassIdentifier:
loadFrom: []
sideObjects: []
materials:
- {fileID: 2100000, guid: 97cabee3711df3b4b944878d6d30edda, type: 2}
- {fileID: 2100000, guid: 197ee10712c66054cb2f88781c8d94f4, type: 2}
- {fileID: 2100000, guid: 1afa0118e3d81e54598c9479c5e31eb9, type: 2}
- {fileID: 2100000, guid: cec427bc0abfad54ca8fe959fd2360cf, type: 2}
materialIndex: 0
groundMoveSpeed: 10
--- !u!4 &1201779183
Transform:
@@ -4777,8 +4783,8 @@ Transform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1895677325}
m_LocalRotation: {x: 0.045581307, y: -0.70516795, z: 0.045520626, w: 0.7061079}
m_LocalPosition: {x: 2.546471, y: 2.9687777, z: -22.464832}
m_LocalRotation: {x: 0.0010953943, y: 0.9979507, z: -0.06145683, w: 0.017787272}
m_LocalPosition: {x: -0.15911984, y: 2.9687777, z: -12.856641}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []

View File

@@ -7,6 +7,8 @@ public class GroundController : MonoBehaviour
private GameObject[] ground;
public GameObject[] loadFrom;
public GameObject[] sideObjects;
public Material[] materials;
public int materialIndex = 0;
public float groundMoveSpeed = 10f;
//private CollectibleSpawner cs;
@@ -40,6 +42,25 @@ public class GroundController : MonoBehaviour
//uj ground letrehozas
if(ground[ground.Length-1].transform.position.z <= 120){
CreateNewGround();
ground = GameObject.FindGameObjectsWithTag("Ground");
for(int i = 0; i < ground.Length; i++){
/*foreach (GameObject child in ground[i].transform){
if (child.name == "Lane1" || child.name == "Lane2" || child.name == "Lane3"){
Debug.Log(child.name + " " + transform.gameObject.name);
}
}*/
Transform[] lanes = new Transform[3];
lanes[0] = ground[i].transform.Find("Lane1");
lanes[1] = ground[i].transform.Find("Lane2");
lanes[2] = ground[i].transform.Find("Lane3");
foreach(var item in lanes){
item.GetComponent<MeshRenderer>().material = materials[materialIndex];
}
}
}
//ellenorzi hogy torolheto e az object || mar nem szukseges mert van egy trigger box
@@ -58,6 +79,10 @@ public class GroundController : MonoBehaviour
return arr;
}
public void changeMaterialIndex(){
}
private bool CheckGroundToDestroy(GameObject toCheck){
//z = -80 -nal lehet torolni
if(toCheck.transform.position.z <= -80){
@@ -83,7 +108,7 @@ public class GroundController : MonoBehaviour
private void CreateNewGround(){
int random = UnityEngine.Random.Range(0, loadFrom.Length);
//egy modullal elobb tolt be, annak az iranyanak megfeleloen, +80 a ket modull hossza
//egy modullal elobb tolt be, annak az iranyanak megfeleloen, +80 a ket modul hossza
Instantiate(loadFrom[random], new Vector3(0,0, ground[ground.Length-1].transform.position.z + 40), ground[ground.Length-1].transform.rotation);
}
}

View File

@@ -119,7 +119,9 @@ public class PlayerController : MonoBehaviour
}
public void jump(){
if(rb.transform.position.y <= 0.16f)
rb.AddForce(new Vector3(0, jumpforce, 0)); //ugras
Debug.Log("jumped");
rb.AddForce(new Vector3(0, jumpforce, 0)); //ugras
}
}