Added camera tracking and movement

This commit is contained in:
Bruno Rybársky 2021-07-19 11:45:08 +02:00
parent a9d82d1783
commit cfc51abde4
14 changed files with 366 additions and 56 deletions

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 157d3a5431e824d49aff4eafe5ec9943
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

@ -0,0 +1,11 @@
%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: NotSlippery
friction: 1
bounciness: 0

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 1431532fb1c75214a9a8c9b1199fe80b
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 6200000
userData:
assetBundleName:
assetBundleVariant:

@ -123,6 +123,37 @@ NavMeshSettings:
debug:
m_Flags: 0
m_NavMeshData: {fileID: 0}
--- !u!1 &8146525
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 8146526}
m_Layer: 0
m_Name: Level
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &8146526
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8146525}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -3.6252284, y: -0.21090557, z: -0.70835644}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 2103537546}
m_Father: {fileID: 0}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &519420028
GameObject:
m_ObjectHideFlags: 0
@ -134,6 +165,7 @@ GameObject:
- component: {fileID: 519420032}
- component: {fileID: 519420031}
- component: {fileID: 519420029}
- component: {fileID: 519420030}
m_Layer: 0
m_Name: Main Camera
m_TagString: MainCamera
@ -149,6 +181,19 @@ AudioListener:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 519420028}
m_Enabled: 1
--- !u!114 &519420030
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 519420028}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 9f3d4f7e2abaa2249bfa4476927789a2, type: 3}
m_Name:
m_EditorClassIdentifier:
player: {fileID: 2122779912}
--- !u!20 &519420031
Camera:
m_ObjectHideFlags: 0
@ -216,7 +261,9 @@ GameObject:
m_Component:
- component: {fileID: 2103537546}
- component: {fileID: 2103537545}
m_Layer: 0
- component: {fileID: 2103537548}
- component: {fileID: 2103537547}
m_Layer: 3
m_Name: Floor
m_TagString: Untagged
m_Icon: {fileID: 0}
@ -264,7 +311,7 @@ SpriteRenderer:
m_SortingLayer: 0
m_SortingOrder: 0
m_Sprite: {fileID: 7482667652216324306, guid: 48e93eef0688c4a259cb0eddcd8661f7, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_Color: {r: 1, g: 0.9696269, b: 0, a: 1}
m_FlipX: 0
m_FlipY: 0
m_DrawMode: 0
@ -281,13 +328,60 @@ Transform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2103537544}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0.0836, y: -2.5525, z: 0}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 3.7088284, y: -2.3415945, z: 0.70835644}
m_LocalScale: {x: 17.397755, y: 1.9050395, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 1
m_Father: {fileID: 8146526}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!50 &2103537547
Rigidbody2D:
serializedVersion: 4
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2103537544}
m_BodyType: 2
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: 1431532fb1c75214a9a8c9b1199fe80b, type: 2}
m_Interpolate: 0
m_SleepingMode: 1
m_CollisionDetection: 0
m_Constraints: 0
--- !u!61 &2103537548
BoxCollider2D:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2103537544}
m_Enabled: 1
m_Density: 1
m_Material: {fileID: 6200000, guid: 1431532fb1c75214a9a8c9b1199fe80b, type: 2}
m_IsTrigger: 0
m_UsedByEffector: 0
m_UsedByComposite: 0
m_Offset: {x: 0, y: 0}
m_SpriteTilingProperty:
border: {x: 0, y: 0, z: 0, w: 0}
pivot: {x: 0.5, y: 0.5}
oldSize: {x: 1, y: 1}
newSize: {x: 1, y: 1}
adaptiveTilingThreshold: 0.5
drawMode: 0
adaptiveTiling: 0
m_AutoTiling: 0
serializedVersion: 2
m_Size: {x: 1, y: 1}
m_EdgeRadius: 0
--- !u!1 &2122779910
GameObject:
m_ObjectHideFlags: 0
@ -298,6 +392,10 @@ GameObject:
m_Component:
- component: {fileID: 2122779912}
- component: {fileID: 2122779911}
- component: {fileID: 2122779916}
- component: {fileID: 2122779915}
- component: {fileID: 2122779914}
- component: {fileID: 2122779913}
m_Layer: 0
m_Name: Bean
m_TagString: Untagged
@ -368,5 +466,77 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 2
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!58 &2122779913
CircleCollider2D:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2122779910}
m_Enabled: 1
m_Density: 1
m_Material: {fileID: 6200000, guid: 1431532fb1c75214a9a8c9b1199fe80b, type: 2}
m_IsTrigger: 0
m_UsedByEffector: 0
m_UsedByComposite: 0
m_Offset: {x: 0, y: -0.7}
serializedVersion: 2
m_Radius: 0.32974005
--- !u!50 &2122779914
Rigidbody2D:
serializedVersion: 4
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2122779910}
m_BodyType: 0
m_Simulated: 1
m_UseFullKinematicContacts: 0
m_UseAutoMass: 0
m_Mass: 100
m_LinearDrag: 0
m_AngularDrag: 0.05
m_GravityScale: 1
m_Material: {fileID: 6200000, guid: 1431532fb1c75214a9a8c9b1199fe80b, type: 2}
m_Interpolate: 0
m_SleepingMode: 1
m_CollisionDetection: 0
m_Constraints: 4
--- !u!70 &2122779915
CapsuleCollider2D:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2122779910}
m_Enabled: 1
m_Density: 1
m_Material: {fileID: 6200000, guid: 1431532fb1c75214a9a8c9b1199fe80b, type: 2}
m_IsTrigger: 0
m_UsedByEffector: 0
m_UsedByComposite: 0
m_Offset: {x: 0, y: 0}
m_Size: {x: 1, y: 2}
m_Direction: 0
--- !u!114 &2122779916
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2122779910}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 18f3e7f51c3b5da4090d81c28486d6dc, type: 3}
m_Name:
m_EditorClassIdentifier:
rb: {fileID: 2122779914}
circ: {fileID: 2122779913}
LVLMask:
serializedVersion: 2
m_Bits: 8
walking_speed: 80000
jump_power: 40000

8
Assets/Scripts.meta Normal file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: f3034f89a03cf4047a2776e41569f2a4
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

@ -0,0 +1,21 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CameraTracking : MonoBehaviour
{
public Transform player;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
Vector3 playpos = player.transform.position;
playpos.z = playpos.z - 10;
transform.position = playpos;
}
}

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 9f3d4f7e2abaa2249bfa4476927789a2
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

@ -0,0 +1,34 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerControls : MonoBehaviour
{
public Rigidbody2D rb;
public CircleCollider2D circ;
public LayerMask LVLMask;
public float walking_speed;
public float jump_power;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
float speed = Input.GetAxisRaw("Horizontal") * Time.deltaTime;
Vector2 movement = new Vector2(0, 0);
movement.x = walking_speed * speed;
if (Input.GetButtonDown("Jump") || Input.GetAxisRaw("Vertical") > 0)
{
if (circ.IsTouchingLayers(LVLMask)){
movement.x = movement.x / 10;
movement.y = jump_power;
}
}
rb.AddRelativeForce(movement);
}
}

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 18f3e7f51c3b5da4090d81c28486d6dc
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

@ -623,7 +623,14 @@ PlayerSettings:
XboxOneOverrideIdentityName:
XboxOneOverrideIdentityPublisher:
vrEditorSettings: {}
cloudServicesEnabled: {}
cloudServicesEnabled:
Analytics: 1
Build: 0
Collab: 0
Game Performance: 1
Purchasing: 0
UDP: 0
Unity Ads: 0
luminIcon:
m_Name:
m_ModelFolderPath:
@ -637,11 +644,11 @@ PlayerSettings:
m_VersionName:
apiCompatibilityLevel: 6
activeInputHandler: 0
cloudProjectId:
cloudProjectId: aaeee619-bf1b-4ed2-8f27-f05a28f13e35
framebufferDepthMemorylessMode: 0
qualitySettingsNames: []
projectName:
organizationId:
projectName: GeoJam2021
organizationId: brnsystems
cloudEnabled: 0
legacyClampBlendShapeWeights: 0
virtualTexturingSupportEnabled: 0

@ -1,43 +1,43 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!78 &1
TagManager:
serializedVersion: 2
tags: []
layers:
- Default
- TransparentFX
- Ignore Raycast
-
- Water
- UI
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
m_SortingLayers:
- name: Default
uniqueID: 0
locked: 0
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!78 &1
TagManager:
serializedVersion: 2
tags: []
layers:
- Default
- TransparentFX
- Ignore Raycast
- Level
- Water
- UI
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
m_SortingLayers:
- name: Default
uniqueID: 0
locked: 0

@ -0,0 +1,15 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &1
MonoBehaviour:
m_ObjectHideFlags: 61
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: a287be6c49135cd4f9b2b8666c39d999, type: 3}
m_Name:
m_EditorClassIdentifier:
assetDefaultFramerate: 60

@ -13,14 +13,14 @@ UnityConnectSettings:
m_TestInitMode: 0
CrashReportingSettings:
m_EventUrl: https://perf-events.cloud.unity3d.com
m_Enabled: 0
m_Enabled: 1
m_LogBufferSize: 10
m_CaptureEditorExceptions: 1
UnityPurchasingSettings:
m_Enabled: 0
m_TestMode: 0
UnityAnalyticsSettings:
m_Enabled: 0
m_Enabled: 1
m_TestMode: 0
m_InitializeOnStartup: 1
UnityAdsSettings:

@ -8,6 +8,12 @@ EditorUserSettings:
RecentlyUsedScenePath-0:
value: 22424703114646680e0b0227036c6c111b07142f1f2b233e2867083debf42d
flags: 0
UnityRemoteCompression:
value: 337f73
flags: 0
UnityRemoteDevice:
value: 225f4d46245b0d4902070862342649191512
flags: 0
vcSharedLogLevel:
value: 0d5e400f0650
flags: 0