Commit e8b17ab4 authored by Manuel Buß's avatar Manuel Buß
Browse files

Solution A6

parent dc838b4a
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!62 &6200000
PhysicsMaterial2D:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Ball
friction: 0
bounciness: 1.1
fileFormatVersion: 2
guid: 4e9e4ee4c0792f44b85ccb1fe96e96ec
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 6200000
userData:
assetBundleName:
assetBundleVariant:
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &1497791176711212348
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 5327317936299510030}
- component: {fileID: 6047817367362875766}
- component: {fileID: 7076633765201108699}
- component: {fileID: 7986366262906127875}
- component: {fileID: 3930011882176210989}
m_Layer: 11
m_Name: Ball
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &5327317936299510030
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1497791176711212348}
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_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!212 &6047817367362875766
SpriteRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1497791176711212348}
m_Enabled: 1
m_CastShadows: 0
m_ReceiveShadows: 0
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RenderingLayerMask: 1
m_RendererPriority: 0
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_StitchLightmapSeams: 0
m_SelectedEditorRenderState: 0
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: -46518359
m_SortingLayer: 5
m_SortingOrder: 0
m_Sprite: {fileID: 21300000, guid: 2f13003d08a96bd44a6f9e49d680a3b1, 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
m_SpriteSortPoint: 0
--- !u!58 &7076633765201108699
CircleCollider2D:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1497791176711212348}
m_Enabled: 1
m_Density: 1
m_Material: {fileID: 0}
m_IsTrigger: 0
m_UsedByEffector: 0
m_UsedByComposite: 0
m_Offset: {x: 0, y: 0}
serializedVersion: 2
m_Radius: 0.5
--- !u!50 &7986366262906127875
Rigidbody2D:
serializedVersion: 4
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1497791176711212348}
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: 6200000, guid: 4e9e4ee4c0792f44b85ccb1fe96e96ec, type: 2}
m_Interpolate: 0
m_SleepingMode: 1
m_CollisionDetection: 1
m_Constraints: 0
--- !u!114 &3930011882176210989
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1497791176711212348}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 635546fef5a3a124794b37c2c82306d2, type: 3}
m_Name:
m_EditorClassIdentifier:
maxVelocity: 10
fileFormatVersion: 2
guid: bbefa251abdacad45a00e0adadcf83ef
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
......@@ -140,7 +140,7 @@ Rigidbody2D:
m_Simulated: 1
m_UseFullKinematicContacts: 0
m_UseAutoMass: 0
m_Mass: 1
m_Mass: 1000000
m_LinearDrag: 0
m_AngularDrag: 0.05
m_GravityScale: 1
......
......@@ -90,7 +90,7 @@ BoxCollider2D:
m_GameObject: {fileID: 8322222211348776601}
m_Enabled: 1
m_Density: 1
m_Material: {fileID: 0}
m_Material: {fileID: 6200000, guid: 281a21493f9e0e444ba904a21ffd1203, type: 2}
m_IsTrigger: 0
m_UsedByEffector: 0
m_UsedByComposite: 0
......@@ -116,7 +116,7 @@ BoxCollider2D:
m_GameObject: {fileID: 8322222211348776601}
m_Enabled: 1
m_Density: 1
m_Material: {fileID: 0}
m_Material: {fileID: 6200000, guid: 281a21493f9e0e444ba904a21ffd1203, type: 2}
m_IsTrigger: 0
m_UsedByEffector: 0
m_UsedByComposite: 0
......
......@@ -40,7 +40,7 @@ BoxCollider2D:
m_GameObject: {fileID: 6908758277759170283}
m_Enabled: 1
m_Density: 1
m_Material: {fileID: 0}
m_Material: {fileID: 6200000, guid: 281a21493f9e0e444ba904a21ffd1203, type: 2}
m_IsTrigger: 0
m_UsedByEffector: 0
m_UsedByComposite: 0
......
......@@ -555,6 +555,80 @@ Transform:
m_Father: {fileID: 0}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1001 &557118742487009051
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 1497791176711212348, guid: bbefa251abdacad45a00e0adadcf83ef,
type: 3}
propertyPath: m_Name
value: Ball
objectReference: {fileID: 0}
- target: {fileID: 1497791176711212348, guid: bbefa251abdacad45a00e0adadcf83ef,
type: 3}
propertyPath: m_TagString
value: Ball
objectReference: {fileID: 0}
- target: {fileID: 5327317936299510030, guid: bbefa251abdacad45a00e0adadcf83ef,
type: 3}
propertyPath: m_LocalPosition.x
value: -5.85
objectReference: {fileID: 0}
- target: {fileID: 5327317936299510030, guid: bbefa251abdacad45a00e0adadcf83ef,
type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5327317936299510030, guid: bbefa251abdacad45a00e0adadcf83ef,
type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5327317936299510030, guid: bbefa251abdacad45a00e0adadcf83ef,
type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5327317936299510030, guid: bbefa251abdacad45a00e0adadcf83ef,
type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5327317936299510030, guid: bbefa251abdacad45a00e0adadcf83ef,
type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5327317936299510030, guid: bbefa251abdacad45a00e0adadcf83ef,
type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 5327317936299510030, guid: bbefa251abdacad45a00e0adadcf83ef,
type: 3}
propertyPath: m_RootOrder
value: 7
objectReference: {fileID: 0}
- target: {fileID: 5327317936299510030, guid: bbefa251abdacad45a00e0adadcf83ef,
type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5327317936299510030, guid: bbefa251abdacad45a00e0adadcf83ef,
type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5327317936299510030, guid: bbefa251abdacad45a00e0adadcf83ef,
type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: bbefa251abdacad45a00e0adadcf83ef, type: 3}
--- !u!4 &810669729809223504 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 810669729809223504, guid: e585ca1a7d8ee6e4980dda3aa82153c3,
......@@ -628,11 +702,6 @@ PrefabInstance:
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5938868358341713651, guid: 40c6cd0e710ebc44fa3d278099f9a85c,
type: 3}
propertyPath: m_Enabled
value: 1
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 40c6cd0e710ebc44fa3d278099f9a85c, type: 3}
--- !u!1001 &3578180947197286935
......@@ -709,6 +778,28 @@ PrefabInstance:
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: a1da377d3a985bc4b95e3d994a387f4e, type: 3}
--- !u!1 &4702233790945130544 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 4702233790945130544, guid: a1da377d3a985bc4b95e3d994a387f4e,
type: 3}
m_PrefabInstance: {fileID: 3578180947197286935}
m_PrefabAsset: {fileID: 0}
--- !u!114 &4702233790945130546
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4702233790945130544}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: c22e8e5953e411946aaf721124fa7764, type: 3}
m_Name:
m_EditorClassIdentifier:
leftValue: 0
rightValue: 0
spawnLeft: {x: -6, y: 1}
spawnRight: {x: 6, y: 1}
--- !u!1001 &5646315729808804356
PrefabInstance:
m_ObjectHideFlags: 0
......
using UnityEngine;
public class ClampVelocity : MonoBehaviour
{
[SerializeField] private float maxVelocity;
private Rigidbody2D rb;
private void Start()
{
rb = GetComponent<Rigidbody2D>();
}
private void FixedUpdate()
{
if (rb.velocity.sqrMagnitude > maxVelocity * maxVelocity)
{
rb.velocity = rb.velocity.normalized * maxVelocity;
}
}
}
\ No newline at end of file
fileFormatVersion: 2
guid: 635546fef5a3a124794b37c2c82306d2
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine;
public class PlayerInputProvider : MonoBehaviour, IInputProvider
{
......
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine;
public class PlayerMovement : MonoBehaviour
{
......
using UnityEngine;
public class Score : MonoBehaviour
{
[SerializeField]private int leftValue;
[SerializeField]private int rightValue;
[SerializeField]private Vector2 spawnLeft;
[SerializeField]private Vector2 spawnRight;
private void Start()
{
leftValue = 0;
rightValue = 0;
}
private void OnCollisionEnter2D(Collision2D other)
{
if (!other.gameObject.CompareTag("Ball")) return;
if (other.transform.position.x < 0)
{
rightValue++;
other.transform.position = spawnRight;
}
else
{
leftValue++;
other.transform.position = spawnLeft;
}
other.gameObject.GetComponent<Rigidbody2D>().velocity = Vector2.zero;
}
}
fileFormatVersion: 2
guid: c22e8e5953e411946aaf721124fa7764
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!62 &6200000
PhysicsMaterial2D:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Wall
friction: 0
bounciness: 0
fileFormatVersion: 2
guid: 281a21493f9e0e444ba904a21ffd1203
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 6200000
userData:
assetBundleName:
assetBundleVariant:
......@@ -3,7 +3,8 @@
--- !u!78 &1
TagManager:
serializedVersion: 2
tags: []
tags:
- Ball
layers:
- Default
- TransparentFX
......@@ -16,7 +17,7 @@ TagManager:
- Ground
- Wall
- Player
-
- Ball
-
-
-
......@@ -53,3 +54,6 @@ TagManager:
- name: Player
uniqueID: 596051127
locked: 0
- name: Ball
uniqueID: 4248448937
locked: 0
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