1
Fork 0
mirror of https://github.com/Steffo99/mission-failed.git synced 2024-12-04 22:04:17 +00:00
This commit is contained in:
Steffo 2018-12-01 18:46:41 +01:00
parent a831353f28
commit 1e50fc05d0
19 changed files with 477 additions and 13 deletions

8
Assets/PhysMats.meta Normal file
View file

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

View file

@ -0,0 +1,10 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!62 &6200000
PhysicsMaterial2D:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: A bit more of Friction
friction: 0.4
bounciness: 0

View file

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

View file

@ -0,0 +1,10 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!62 &6200000
PhysicsMaterial2D:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: Almost one Friction
friction: 0.8
bounciness: 0

View file

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

View file

@ -0,0 +1,10 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!62 &6200000
PhysicsMaterial2D:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: How about even more Friction
friction: 0.6
bounciness: 0

View file

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

View file

@ -0,0 +1,10 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!62 &6200000
PhysicsMaterial2D:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: Maybe a bit of Friction
friction: 0.2
bounciness: 0

View file

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

View file

@ -0,0 +1,10 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!62 &6200000
PhysicsMaterial2D:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: No Friction
friction: 0
bounciness: 0

View file

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

View file

@ -0,0 +1,10 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!62 &6200000
PhysicsMaterial2D:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: One Friction
friction: 1
bounciness: 0

View file

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

View file

@ -190,6 +190,250 @@ Transform:
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 0 m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1404513268
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1404513272}
- component: {fileID: 1404513271}
- component: {fileID: 1404513270}
- component: {fileID: 1404513269}
m_Layer: 0
m_Name: BlankSquare
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!50 &1404513269
Rigidbody2D:
serializedVersion: 4
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1404513268}
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: 0}
m_Interpolate: 0
m_SleepingMode: 1
m_CollisionDetection: 0
m_Constraints: 0
--- !u!61 &1404513270
BoxCollider2D:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1404513268}
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}
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!212 &1404513271
SpriteRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1404513268}
m_Enabled: 1
m_CastShadows: 0
m_ReceiveShadows: 0
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RenderingLayerMask: 4294967295
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: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_Sprite: {fileID: 21300000, guid: a085a1d8dd249e44ab3240f69b09b723, type: 3}
m_Color: {r: 0.5188679, g: 0.5188679, b: 0.5188679, 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!4 &1404513272
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1404513268}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -1.1, y: -4.04, z: 0}
m_LocalScale: {x: 9.302, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1691113317
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1691113321}
- component: {fileID: 1691113320}
- component: {fileID: 1691113319}
- component: {fileID: 1691113318}
m_Layer: 0
m_Name: BlankSquare (1)
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!50 &1691113318
Rigidbody2D:
serializedVersion: 4
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1691113317}
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: 0}
m_Interpolate: 0
m_SleepingMode: 1
m_CollisionDetection: 0
m_Constraints: 0
--- !u!61 &1691113319
BoxCollider2D:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1691113317}
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}
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!212 &1691113320
SpriteRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1691113317}
m_Enabled: 1
m_CastShadows: 0
m_ReceiveShadows: 0
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RenderingLayerMask: 4294967295
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: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_Sprite: {fileID: 21300000, guid: a085a1d8dd249e44ab3240f69b09b723, type: 3}
m_Color: {r: 0.5188679, g: 0.5188679, b: 0.5188679, 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!4 &1691113321
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1691113317}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 4.09, y: -1.64, z: 0}
m_LocalScale: {x: 9.302, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1757104811 --- !u!1 &1757104811
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -201,9 +445,11 @@ GameObject:
- component: {fileID: 1757104814} - component: {fileID: 1757104814}
- component: {fileID: 1757104813} - component: {fileID: 1757104813}
- component: {fileID: 1757104812} - component: {fileID: 1757104812}
- component: {fileID: 1757104817}
- component: {fileID: 1757104816}
m_Layer: 0 m_Layer: 0
m_Name: Player m_Name: Player
m_TagString: Untagged m_TagString: Player
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
m_StaticEditorFlags: 0 m_StaticEditorFlags: 0
@ -312,3 +558,30 @@ Transform:
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 1 m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &1757104816
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1757104811}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 99a09fb4b7b83b84b90ddaa3bbb2ade5, type: 3}
m_Name:
m_EditorClassIdentifier:
currentHealth: 100
maximumHealth: 100
--- !u!114 &1757104817
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1757104811}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d344a42c03e782945beb225928941a40, type: 3}
m_Name:
m_EditorClassIdentifier:
movementSpeed: 2
initialJumpForce: 400
pushDownOnReleaseForce: 200

View file

@ -4,13 +4,44 @@ using UnityEngine;
public class PlayerController : MonoBehaviour { public class PlayerController : MonoBehaviour {
// Use this for initialization public float movementSpeed = 1f;
void Start () { public float initialJumpForce = 10f;
public float pushDownOnReleaseForce = 5f;
} public bool jumpAvailable = true;
// Update is called once per frame private new Rigidbody2D rigidbody;
void Update () {
private void Start()
{
rigidbody = GetComponent<Rigidbody2D>();
}
private void FixedUpdate () {
float horizontalMovement = 0;
if(Input.GetKey(KeyCode.A)) {
horizontalMovement -= movementSpeed;
}
if(Input.GetKey(KeyCode.D))
{
horizontalMovement += movementSpeed;
}
if(jumpAvailable && Input.GetKeyDown(KeyCode.W))
{
jumpAvailable = false;
rigidbody.AddForce(Vector2.up * initialJumpForce);
}
if(Input.GetKeyUp(KeyCode.W))
{
rigidbody.AddForce(Vector2.down * pushDownOnReleaseForce);
}
rigidbody.velocity = new Vector3(horizontalMovement * movementSpeed, rigidbody.velocity.y);
} }
private void OnCollisionEnter2D(Collision2D collision)
{
if(collision.gameObject.CompareTag("Terrain"))
{
jumpAvailable = true;
}
}
} }

View file

@ -0,0 +1,15 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class RotateTowardsMouse : MonoBehaviour {
//Circa qualcosa così
void Update() {
//Trova la direzione tra il transform e il braccio
Vector2 screenPosition = Camera.main.WorldToScreenPoint(transform.position);
Vector2 direction = (Vector2)Input.mousePosition - screenPosition;
//Cambia la rotazione dell'oggetto
transform.rotation = Quaternion.identity;
}
}

View file

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

View file

@ -13,9 +13,9 @@ InputManager:
positiveButton: right positiveButton: right
altNegativeButton: a altNegativeButton: a
altPositiveButton: d altPositiveButton: d
gravity: 3 gravity: 100000000
dead: 0.001 dead: 0.001
sensitivity: 3 sensitivity: 100000000
snap: 1 snap: 1
invert: 0 invert: 0
type: 0 type: 0

View file

@ -5,7 +5,7 @@ Physics2DSettings:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
serializedVersion: 3 serializedVersion: 3
m_Gravity: {x: 0, y: -9.81} m_Gravity: {x: 0, y: -9.81}
m_DefaultMaterial: {fileID: 0} m_DefaultMaterial: {fileID: 6200000, guid: fbaa84dbda1fd274a8d3d7f5ed845199, type: 2}
m_VelocityIterations: 8 m_VelocityIterations: 8
m_PositionIterations: 3 m_PositionIterations: 3
m_VelocityThreshold: 1 m_VelocityThreshold: 1
@ -19,10 +19,28 @@ Physics2DSettings:
m_LinearSleepTolerance: 0.01 m_LinearSleepTolerance: 0.01
m_AngularSleepTolerance: 2 m_AngularSleepTolerance: 2
m_DefaultContactOffset: 0.01 m_DefaultContactOffset: 0.01
m_JobOptions:
serializedVersion: 2
useMultithreading: 0
useConsistencySorting: 0
m_InterpolationPosesPerJob: 100
m_NewContactsPerJob: 30
m_CollideContactsPerJob: 100
m_ClearFlagsPerJob: 200
m_ClearBodyForcesPerJob: 200
m_SyncDiscreteFixturesPerJob: 50
m_SyncContinuousFixturesPerJob: 50
m_FindNearestContactsPerJob: 100
m_UpdateTriggerContactsPerJob: 100
m_IslandSolverCostThreshold: 100
m_IslandSolverBodyCostScale: 1
m_IslandSolverContactCostScale: 10
m_IslandSolverJointCostScale: 10
m_IslandSolverBodiesPerJob: 50
m_IslandSolverContactsPerJob: 50
m_AutoSimulation: 1 m_AutoSimulation: 1
m_QueriesHitTriggers: 1 m_QueriesHitTriggers: 1
m_QueriesStartInColliders: 1 m_QueriesStartInColliders: 1
m_ChangeStopsCallbacks: 0
m_CallbacksOnDisable: 1 m_CallbacksOnDisable: 1
m_AutoSyncTransforms: 1 m_AutoSyncTransforms: 1
m_AlwaysShowColliders: 0 m_AlwaysShowColliders: 0