Commit e8398c35 by Juliper

test1

parent 0d196ccd
......@@ -108,6 +108,283 @@ NavMeshSettings:
tileSize: 256
accuratePlacement: 0
m_NavMeshData: {fileID: 0}
--- !u!1 &230910356
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 5
m_Component:
- component: {fileID: 230910358}
- component: {fileID: 230910357}
m_Layer: 0
m_Name: Background
m_TagString: Background
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!212 &230910357
SpriteRenderer:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 230910356}
m_Enabled: 1
m_CastShadows: 0
m_ReceiveShadows: 0
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_Materials:
- {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_SelectedEditorRenderState: 0
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_Sprite: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 0
m_FlipY: 0
m_DrawMode: 0
m_Size: {x: 1, y: 1}
m_AdaptiveModeThreshold: 0.5
m_SpriteTileMode: 0
m_WasSpriteAssigned: 0
m_MaskInteraction: 0
--- !u!4 &230910358
Transform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 230910356}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -50.821808, y: 7.04, z: 0}
m_LocalScale: {x: 1.4, y: 2.3, z: 1}
m_Children:
- {fileID: 292908161}
m_Father: {fileID: 0}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &292908160
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 5
m_Component:
- component: {fileID: 292908161}
- component: {fileID: 292908162}
m_Layer: 0
m_Name: BlueBackground
m_TagString: BlueBackground
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &292908161
Transform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 292908160}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 50.8, y: 1.14, z: 0}
m_LocalScale: {x: 9, y: 2.5, z: 1}
m_Children: []
m_Father: {fileID: 230910358}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!212 &292908162
SpriteRenderer:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 292908160}
m_Enabled: 1
m_CastShadows: 0
m_ReceiveShadows: 0
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_Materials:
- {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_SelectedEditorRenderState: 0
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_Sprite: {fileID: 21300000, guid: 7590c8bf40f1a8d49aa98e3926ae8167, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 0
m_FlipY: 0
m_DrawMode: 0
m_Size: {x: 13.34, y: 5.57}
m_AdaptiveModeThreshold: 0.5
m_SpriteTileMode: 0
m_WasSpriteAssigned: 1
m_MaskInteraction: 0
--- !u!1 &571440876
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 5
m_Component:
- component: {fileID: 571440881}
- component: {fileID: 571440880}
- component: {fileID: 571440879}
- component: {fileID: 571440878}
- component: {fileID: 571440877}
m_Layer: 0
m_Name: Player
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!61 &571440877
BoxCollider2D:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 571440876}
m_Enabled: 1
m_Density: 1
m_Material: {fileID: 0}
m_IsTrigger: 0
m_UsedByEffector: 0
m_UsedByComposite: 0
m_Offset: {x: 0.015841007, y: -0.73005563}
m_SpriteTilingProperty:
border: {x: 0, y: 0, z: 0, w: 0}
pivot: {x: 0.5, y: 0.5}
oldSize: {x: 8, y: 6}
newSize: {x: 1, y: 1}
adaptiveTilingThreshold: 0.5
drawMode: 0
adaptiveTiling: 0
m_AutoTiling: 0
serializedVersion: 2
m_Size: {x: 1.9516599, y: 4.539889}
m_EdgeRadius: 0
--- !u!114 &571440878
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 571440876}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 47647089dc2b0894181bf542af092654, type: 3}
m_Name:
m_EditorClassIdentifier:
minGroundNormalY: 0.65
gravityModifier: 1
maxSpeed: 10
jumpTakeOffSpeed: 10
--- !u!50 &571440879
Rigidbody2D:
serializedVersion: 4
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 571440876}
m_BodyType: 0
m_Simulated: 1
m_UseFullKinematicContacts: 0
m_UseAutoMass: 0
m_Mass: 1
m_LinearDrag: 0
m_AngularDrag: 0.05
m_GravityScale: 1
m_Material: {fileID: 0}
m_Interpolate: 0
m_SleepingMode: 1
m_CollisionDetection: 0
m_Constraints: 4
--- !u!212 &571440880
SpriteRenderer:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 571440876}
m_Enabled: 1
m_CastShadows: 0
m_ReceiveShadows: 0
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_Materials:
- {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_SelectedEditorRenderState: 0
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 4
m_Sprite: {fileID: 21300000, guid: 8377b93ce74bba944ac8cc3ed7dfcd91, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 0
m_FlipY: 0
m_DrawMode: 0
m_Size: {x: 1, y: 1}
m_AdaptiveModeThreshold: 0.5
m_SpriteTileMode: 0
m_WasSpriteAssigned: 1
m_MaskInteraction: 0
--- !u!4 &571440881
Transform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 571440876}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -57.61, y: 1.75, z: 0}
m_LocalScale: {x: 1.2, y: 1.2, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1339240411
GameObject:
m_ObjectHideFlags: 0
......
......@@ -4,11 +4,12 @@ using UnityEngine;
public class BackgroundChanger : MonoBehaviour {
private List<GameObject> backgroundGroup = new List<GameObject>();
private List<GameObject> obstacleGroup = new List<GameObject>();
private GameObject[] gameObjectGroup;
private GameObject background;
private string[] colors = {"Blue", "Green" };
private string[] colors = {"Blue", "Green", "Yellow" };
public void Start()
{
......@@ -21,20 +22,20 @@ public class BackgroundChanger : MonoBehaviour {
{
background = GameObject.FindWithTag("Background");
}
private void CollectObstacles()
{
foreach(string color in colors)
{
gameObjectGroup = GameObject.FindGameObjectsWithTag(color + "Obstacle");
foreach(GameObject obstacle in gameObjectGroup)
{
obstacleGroup.Add(obstacle);
}
}
}
private void CollectObstacles()
{
foreach(string color in colors)
{
gameObjectGroup = GameObject.FindGameObjectsWithTag(color + "Obstacle");
foreach(GameObject obstacle in gameObjectGroup)
{
obstacleGroup.Add(obstacle);
}
}
}
public void Update()
{
if (Input.GetKey(KeyCode.X))
......@@ -43,9 +44,12 @@ public class BackgroundChanger : MonoBehaviour {
} else if (Input.GetKey(KeyCode.Z))
{
UpdateBackgroud("Green");
} else if (Input.GetKey(KeyCode.C))
{
UpdateBackgroud("Yellow");
}
}
public void UpdateBackgroud(string tagColor)
{
if(tagColor == "Green")
......@@ -54,11 +58,16 @@ public class BackgroundChanger : MonoBehaviour {
} else if (tagColor == "Blue")
{
background.GetComponent<SpriteRenderer>().color = new Color32(65, 131, 215, 255);
} else if (tagColor == "Yellow")
{
background.GetComponent<SpriteRenderer>().color = new Color32(255, 193, 7, 255);
}
UpdateObstacle(tagColor);
}
private void UpdateObstacle(string tagColor)
{
foreach (GameObject obstacle in obstacleGroup)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment