Fixed apples spawning on top of each other
This commit is contained in:
parent
a965d51446
commit
d9ec878132
80
Assets/Materials/Mat_GoldenApple.mat
Normal file
80
Assets/Materials/Mat_GoldenApple.mat
Normal 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: Mat_GoldenApple
|
||||||
|
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.5
|
||||||
|
- _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.8015952, g: 0.8490566, b: 0.020024916, a: 1}
|
||||||
|
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
|
||||||
|
m_BuildTextureStacks: []
|
8
Assets/Materials/Mat_GoldenApple.mat.meta
Normal file
8
Assets/Materials/Mat_GoldenApple.mat.meta
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 55548ebb6b250a39ba3c37a846f83224
|
||||||
|
NativeFormatImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
mainObjectFileID: 2100000
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
129
Assets/Prefabs/GoldenApple.prefab
Normal file
129
Assets/Prefabs/GoldenApple.prefab
Normal file
@ -0,0 +1,129 @@
|
|||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!1 &1428767985013339637
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 1428767985013339632}
|
||||||
|
- component: {fileID: 1428767985013339633}
|
||||||
|
- component: {fileID: 1428767985013339634}
|
||||||
|
- component: {fileID: 1428767985013339635}
|
||||||
|
- component: {fileID: 1428767985013339636}
|
||||||
|
- component: {fileID: -2558008178231210607}
|
||||||
|
m_Layer: 12
|
||||||
|
m_Name: GoldenApple
|
||||||
|
m_TagString: GoldenApple
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!4 &1428767985013339632
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1428767985013339637}
|
||||||
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
|
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||||
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
|
m_ConstrainProportionsScale: 0
|
||||||
|
m_Children: []
|
||||||
|
m_Father: {fileID: 0}
|
||||||
|
m_RootOrder: 0
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
--- !u!33 &1428767985013339633
|
||||||
|
MeshFilter:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1428767985013339637}
|
||||||
|
m_Mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0}
|
||||||
|
--- !u!23 &1428767985013339634
|
||||||
|
MeshRenderer:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1428767985013339637}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_CastShadows: 1
|
||||||
|
m_ReceiveShadows: 1
|
||||||
|
m_DynamicOccludee: 1
|
||||||
|
m_StaticShadowCaster: 0
|
||||||
|
m_MotionVectors: 1
|
||||||
|
m_LightProbeUsage: 1
|
||||||
|
m_ReflectionProbeUsage: 1
|
||||||
|
m_RayTracingMode: 2
|
||||||
|
m_RayTraceProcedural: 0
|
||||||
|
m_RenderingLayerMask: 1
|
||||||
|
m_RendererPriority: 0
|
||||||
|
m_Materials:
|
||||||
|
- {fileID: 2100000, guid: 55548ebb6b250a39ba3c37a846f83224, type: 2}
|
||||||
|
m_StaticBatchInfo:
|
||||||
|
firstSubMesh: 0
|
||||||
|
subMeshCount: 0
|
||||||
|
m_StaticBatchRoot: {fileID: 0}
|
||||||
|
m_ProbeAnchor: {fileID: 0}
|
||||||
|
m_LightProbeVolumeOverride: {fileID: 0}
|
||||||
|
m_ScaleInLightmap: 1
|
||||||
|
m_ReceiveGI: 1
|
||||||
|
m_PreserveUVs: 0
|
||||||
|
m_IgnoreNormalsForChartDetection: 0
|
||||||
|
m_ImportantGI: 0
|
||||||
|
m_StitchLightmapSeams: 1
|
||||||
|
m_SelectedEditorRenderState: 3
|
||||||
|
m_MinimumChartSize: 4
|
||||||
|
m_AutoUVMaxDistance: 0.5
|
||||||
|
m_AutoUVMaxAngle: 89
|
||||||
|
m_LightmapParameters: {fileID: 0}
|
||||||
|
m_SortingLayerID: 0
|
||||||
|
m_SortingLayer: 0
|
||||||
|
m_SortingOrder: 0
|
||||||
|
m_AdditionalVertexStreams: {fileID: 0}
|
||||||
|
--- !u!135 &1428767985013339635
|
||||||
|
SphereCollider:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1428767985013339637}
|
||||||
|
m_Material: {fileID: 0}
|
||||||
|
m_IsTrigger: 0
|
||||||
|
m_Enabled: 1
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Radius: 0.5
|
||||||
|
m_Center: {x: 0, y: 0, z: 0}
|
||||||
|
--- !u!54 &1428767985013339636
|
||||||
|
Rigidbody:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1428767985013339637}
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Mass: 1
|
||||||
|
m_Drag: 0
|
||||||
|
m_AngularDrag: 0.05
|
||||||
|
m_UseGravity: 1
|
||||||
|
m_IsKinematic: 0
|
||||||
|
m_Interpolate: 0
|
||||||
|
m_Constraints: 0
|
||||||
|
m_CollisionDetection: 0
|
||||||
|
--- !u!114 &-2558008178231210607
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1428767985013339637}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 735ca23f10b0eb1b4b902456bc9536b3, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
7
Assets/Prefabs/GoldenApple.prefab.meta
Normal file
7
Assets/Prefabs/GoldenApple.prefab.meta
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: db7d7f53e4b04e16596115dbcc4f31c1
|
||||||
|
PrefabImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: db7d7f53e4b04e16596115dbcc4f31c1
|
guid: 5a3f43c14ed51073380e9516bd98d47c
|
||||||
PrefabImporter:
|
PrefabImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
userData:
|
userData:
|
||||||
|
@ -977,6 +977,10 @@ PrefabInstance:
|
|||||||
propertyPath: m_Name
|
propertyPath: m_Name
|
||||||
value: AppleTree
|
value: AppleTree
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 2963219029695693475, guid: 7f43e61e14d39c9608ac9a44321a0dc8, type: 3}
|
||||||
|
propertyPath: m_TagString
|
||||||
|
value: AppleTree
|
||||||
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 2963219029695693477, guid: 7f43e61e14d39c9608ac9a44321a0dc8, type: 3}
|
- target: {fileID: 2963219029695693477, guid: 7f43e61e14d39c9608ac9a44321a0dc8, type: 3}
|
||||||
propertyPath: m_RootOrder
|
propertyPath: m_RootOrder
|
||||||
value: 2
|
value: 2
|
||||||
@ -1034,9 +1038,13 @@ PrefabInstance:
|
|||||||
value: 20
|
value: 20
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 8871816599865554133, guid: 7f43e61e14d39c9608ac9a44321a0dc8, type: 3}
|
- target: {fileID: 8871816599865554133, guid: 7f43e61e14d39c9608ac9a44321a0dc8, type: 3}
|
||||||
propertyPath: rottenApplePrefab
|
propertyPath: goldenApplePrefab
|
||||||
value:
|
value:
|
||||||
objectReference: {fileID: 1428767985013339637, guid: db7d7f53e4b04e16596115dbcc4f31c1, type: 3}
|
objectReference: {fileID: 1428767985013339637, guid: db7d7f53e4b04e16596115dbcc4f31c1, type: 3}
|
||||||
|
- target: {fileID: 8871816599865554133, guid: 7f43e61e14d39c9608ac9a44321a0dc8, type: 3}
|
||||||
|
propertyPath: rottenApplePrefab
|
||||||
|
value:
|
||||||
|
objectReference: {fileID: 1428767985013339637, guid: 5a3f43c14ed51073380e9516bd98d47c, type: 3}
|
||||||
- target: {fileID: 8871816599865554133, guid: 7f43e61e14d39c9608ac9a44321a0dc8, type: 3}
|
- target: {fileID: 8871816599865554133, guid: 7f43e61e14d39c9608ac9a44321a0dc8, type: 3}
|
||||||
propertyPath: chanceToChangeDirections
|
propertyPath: chanceToChangeDirections
|
||||||
value: 0.02
|
value: 0.02
|
||||||
|
@ -65,6 +65,11 @@ public class ApplePicker : MonoBehaviour
|
|||||||
GameOver();
|
GameOver();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void GoldenAppleDestroyed() {
|
||||||
|
AppleTree appleTree = GameObject.FindGameObjectWithTag("AppleTree").GetComponent<AppleTree>();
|
||||||
|
appleTree.GoldenAppleTimeStart();
|
||||||
|
}
|
||||||
|
|
||||||
public void GameOver() {
|
public void GameOver() {
|
||||||
Time.timeScale = 0;
|
Time.timeScale = 0;
|
||||||
roundGT.text = "Game Over";
|
roundGT.text = "Game Over";
|
||||||
|
@ -9,6 +9,7 @@ public class AppleTree : MonoBehaviour
|
|||||||
// Prefab for instantiating apples
|
// Prefab for instantiating apples
|
||||||
public GameObject applePrefab;
|
public GameObject applePrefab;
|
||||||
public GameObject rottenApplePrefab;
|
public GameObject rottenApplePrefab;
|
||||||
|
public GameObject goldenApplePrefab;
|
||||||
// Speed at which the AppleTree moves
|
// Speed at which the AppleTree moves
|
||||||
public float speed = 1f;
|
public float speed = 1f;
|
||||||
// Distance where AppleTree turns around
|
// Distance where AppleTree turns around
|
||||||
@ -18,15 +19,21 @@ public class AppleTree : MonoBehaviour
|
|||||||
// Rate at which Apples will be instantiated
|
// Rate at which Apples will be instantiated
|
||||||
public float secondsBetweenAppleDrops = 1f;
|
public float secondsBetweenAppleDrops = 1f;
|
||||||
// Rate at which RottenApples will be instantiated
|
// Rate at which RottenApples will be instantiated
|
||||||
public float secondsBetweenRottenAppleDrops = 3f;
|
public float secondsBetweenRottenAppleDrops = 2f;
|
||||||
|
// Rate at which RottenApples will be instantiated
|
||||||
|
public float secondsBetweenGoldenAppleDrops = 4f;
|
||||||
|
public bool goldenAppleTime = false;
|
||||||
|
public float goldenAppleTimeCurrent = 0f;
|
||||||
|
public float goldenAppleTimeLimit = 5f;
|
||||||
// Start is called before the first frame update
|
// Start is called before the first frame update
|
||||||
void Start()
|
void Start()
|
||||||
{
|
{
|
||||||
// Dropping apples every second
|
// Dropping apples every second
|
||||||
Invoke("DropApple", 2f);
|
Invoke("DropApple", 1f);
|
||||||
if (SceneManager.GetActiveScene().name == "_Scene_2") { return; }
|
if (SceneManager.GetActiveScene().name == "_Scene_2") { return; }
|
||||||
// Dropping rotten apples every 3 seconds
|
// Dropping rotten apples every 3 seconds
|
||||||
Invoke("DropRottenApple", 2f);
|
Invoke("DropRottenApple", 2f);
|
||||||
|
Invoke("DropGoldenApple", 4f);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DropApple() {
|
void DropApple() {
|
||||||
@ -41,6 +48,29 @@ public class AppleTree : MonoBehaviour
|
|||||||
Invoke("DropRottenApple", secondsBetweenRottenAppleDrops);
|
Invoke("DropRottenApple", secondsBetweenRottenAppleDrops);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DropGoldenApple() {
|
||||||
|
GameObject goldenApple = Instantiate<GameObject>(goldenApplePrefab);
|
||||||
|
goldenApple.transform.position = transform.position;
|
||||||
|
if (goldenAppleTime) {
|
||||||
|
Invoke("DropGoldenApple", secondsBetweenGoldenAppleDrops + goldenAppleTimeLimit);
|
||||||
|
} else {
|
||||||
|
Invoke("DropGoldenApple", secondsBetweenGoldenAppleDrops);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void GoldenAppleTimeStart() {
|
||||||
|
AppleTree atScript = Camera.main.GetComponent<AppleTree>();
|
||||||
|
atScript.goldenAppleTime = true;
|
||||||
|
atScript.secondsBetweenAppleDrops *= 0.25f;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void GoldenAppleTimeEnd() {
|
||||||
|
AppleTree atScript = Camera.main.GetComponent<AppleTree>();
|
||||||
|
atScript.goldenAppleTime = false;
|
||||||
|
goldenAppleTimeCurrent = 0f;
|
||||||
|
atScript.secondsBetweenAppleDrops *= 4;
|
||||||
|
}
|
||||||
|
|
||||||
// Update is called once per frame
|
// Update is called once per frame
|
||||||
void Update()
|
void Update()
|
||||||
{
|
{
|
||||||
@ -54,6 +84,13 @@ public class AppleTree : MonoBehaviour
|
|||||||
} else if (pos.x > leftAndRightEdge) {
|
} else if (pos.x > leftAndRightEdge) {
|
||||||
speed = -Mathf.Abs(speed);
|
speed = -Mathf.Abs(speed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (goldenAppleTime) {
|
||||||
|
goldenAppleTimeCurrent += Time.deltaTime;
|
||||||
|
if (goldenAppleTimeCurrent > goldenAppleTimeLimit) {
|
||||||
|
GoldenAppleTimeEnd();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update exactly 50 times per second
|
// Update exactly 50 times per second
|
||||||
|
@ -61,7 +61,17 @@ public class Basket : MonoBehaviour
|
|||||||
void OnCollisionEnter(Collision coll) {
|
void OnCollisionEnter(Collision coll) {
|
||||||
// Find out what hit this basket
|
// Find out what hit this basket
|
||||||
GameObject collidedWith = coll.gameObject;
|
GameObject collidedWith = coll.gameObject;
|
||||||
|
ApplePicker apScript = Camera.main.GetComponent<ApplePicker>();
|
||||||
switch (collidedWith.tag) {
|
switch (collidedWith.tag) {
|
||||||
|
case "RottenApple":
|
||||||
|
Destroy(collidedWith);
|
||||||
|
if (SceneManager.GetActiveScene().name == "_Scene_2") { return; }
|
||||||
|
apScript.RottenAppleDestroyed();
|
||||||
|
break;
|
||||||
|
case "GoldenApple":
|
||||||
|
Destroy(collidedWith);
|
||||||
|
apScript.GoldenAppleDestroyed();
|
||||||
|
break;
|
||||||
case "Apple":
|
case "Apple":
|
||||||
Destroy(collidedWith);
|
Destroy(collidedWith);
|
||||||
if (SceneManager.GetActiveScene().name == "_Scene_2") { return; }
|
if (SceneManager.GetActiveScene().name == "_Scene_2") { return; }
|
||||||
@ -74,12 +84,6 @@ public class Basket : MonoBehaviour
|
|||||||
// Track the high score
|
// Track the high score
|
||||||
if (score > HighScore.score) { HighScore.score = score; }
|
if (score > HighScore.score) { HighScore.score = score; }
|
||||||
break;
|
break;
|
||||||
case "RottenApple":
|
|
||||||
Destroy(collidedWith);
|
|
||||||
if (SceneManager.GetActiveScene().name == "_Scene_2") { return; }
|
|
||||||
ApplePicker apScript = Camera.main.GetComponent<ApplePicker>();
|
|
||||||
apScript.RottenAppleDestroyed();
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
22
Assets/Scripts/GoldenApple.cs
Normal file
22
Assets/Scripts/GoldenApple.cs
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
public class GoldenApple : MonoBehaviour
|
||||||
|
{
|
||||||
|
public static float bottomY = -20f;
|
||||||
|
// Start is called before the first frame update
|
||||||
|
void Start()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update is called once per frame
|
||||||
|
void Update()
|
||||||
|
{
|
||||||
|
if (transform.position.y < bottomY) {
|
||||||
|
Destroy(this.gameObject);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
11
Assets/Scripts/GoldenApple.cs.meta
Normal file
11
Assets/Scripts/GoldenApple.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 735ca23f10b0eb1b4b902456bc9536b3
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@ -18,7 +18,7 @@ PhysicsManager:
|
|||||||
m_ClothInterCollisionDistance: 0
|
m_ClothInterCollisionDistance: 0
|
||||||
m_ClothInterCollisionStiffness: 0
|
m_ClothInterCollisionStiffness: 0
|
||||||
m_ContactsGeneration: 1
|
m_ContactsGeneration: 1
|
||||||
m_LayerCollisionMatrix: fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffdfffffffcffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
|
m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe5ffffffe4ffffffffffffffe4ffffffe4ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
|
||||||
m_AutoSimulation: 1
|
m_AutoSimulation: 1
|
||||||
m_AutoSyncTransforms: 0
|
m_AutoSyncTransforms: 0
|
||||||
m_ReuseCollisionCallbacks: 1
|
m_ReuseCollisionCallbacks: 1
|
||||||
|
@ -6,7 +6,8 @@ TagManager:
|
|||||||
tags:
|
tags:
|
||||||
- Apple
|
- Apple
|
||||||
- RottenApple
|
- RottenApple
|
||||||
- Undefined
|
- GoldenApple
|
||||||
|
- AppleTree
|
||||||
layers:
|
layers:
|
||||||
- Default
|
- Default
|
||||||
- TransparentFX
|
- TransparentFX
|
||||||
@ -20,7 +21,7 @@ TagManager:
|
|||||||
- Apple
|
- Apple
|
||||||
- Basket
|
- Basket
|
||||||
- RottenApple
|
- RottenApple
|
||||||
-
|
- GoldenApple
|
||||||
-
|
-
|
||||||
-
|
-
|
||||||
-
|
-
|
||||||
|
Loading…
Reference in New Issue
Block a user