fuck moving platforms
This commit is contained in:
parent
75ea014fbf
commit
07a542a990
@ -95,19 +95,19 @@ Rigidbody2D:
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3453266731971349118}
|
||||
m_BodyType: 2
|
||||
m_BodyType: 1
|
||||
m_Simulated: 1
|
||||
m_UseFullKinematicContacts: 0
|
||||
m_UseAutoMass: 0
|
||||
m_Mass: 1
|
||||
m_LinearDrag: 0
|
||||
m_AngularDrag: 0.05
|
||||
m_GravityScale: 1
|
||||
m_GravityScale: 0
|
||||
m_Material: {fileID: 0}
|
||||
m_Interpolate: 0
|
||||
m_Interpolate: 1
|
||||
m_SleepingMode: 1
|
||||
m_CollisionDetection: 0
|
||||
m_Constraints: 0
|
||||
m_CollisionDetection: 1
|
||||
m_Constraints: 4
|
||||
--- !u!61 &3453266731971349116
|
||||
BoxCollider2D:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -146,5 +146,6 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: 1637c8c06cf9fae4eb7bfa1a0ebb0e55, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
xOffset: 10
|
||||
xOffset: 5
|
||||
yOffset: 0
|
||||
speed: 0.05
|
||||
|
@ -26,7 +26,7 @@ Transform:
|
||||
m_GameObject: {fileID: 698768804}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: -0.5, y: 0, z: 0}
|
||||
m_LocalScale: {x: 0.1, y: 2, z: 1}
|
||||
m_LocalScale: {x: 0.1, y: 1.3, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 7008207192594766311}
|
||||
@ -73,7 +73,7 @@ Transform:
|
||||
m_GameObject: {fileID: 2083070160}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0.5, y: 0, z: 0}
|
||||
m_LocalScale: {x: 0.1, y: 2, z: 1}
|
||||
m_LocalScale: {x: 0.1, y: 1.3, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 7008207192594766311}
|
||||
|
@ -176,31 +176,11 @@ PrefabInstance:
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3453266731971349115, guid: 821831f062ee52848b6bda27fba0b001, type: 3}
|
||||
propertyPath: m_BodyType
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3453266731971349115, guid: 821831f062ee52848b6bda27fba0b001, type: 3}
|
||||
propertyPath: m_Constraints
|
||||
value: 4
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3453266731971349115, guid: 821831f062ee52848b6bda27fba0b001, type: 3}
|
||||
propertyPath: m_Interpolate
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3453266731971349115, guid: 821831f062ee52848b6bda27fba0b001, type: 3}
|
||||
propertyPath: m_GravityScale
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3453266731971349115, guid: 821831f062ee52848b6bda27fba0b001, type: 3}
|
||||
propertyPath: m_CollisionDetection
|
||||
value: 1
|
||||
value: 2
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3453266731971349117, guid: 821831f062ee52848b6bda27fba0b001, type: 3}
|
||||
propertyPath: speed
|
||||
value: 0.05
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3453266731971349117, guid: 821831f062ee52848b6bda27fba0b001, type: 3}
|
||||
propertyPath: xOffset
|
||||
value: 5
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3453266731971349118, guid: 821831f062ee52848b6bda27fba0b001, type: 3}
|
||||
propertyPath: m_Name
|
||||
@ -208,6 +188,11 @@ PrefabInstance:
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_SourcePrefab: {fileID: 100100000, guid: 821831f062ee52848b6bda27fba0b001, type: 3}
|
||||
--- !u!4 &175005001 stripped
|
||||
Transform:
|
||||
m_CorrespondingSourceObject: {fileID: 3453266731971349113, guid: 821831f062ee52848b6bda27fba0b001, type: 3}
|
||||
m_PrefabInstance: {fileID: 53543450}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!1 &387708699
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -2610,6 +2595,53 @@ PrefabInstance:
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_SourcePrefab: {fileID: 100100000, guid: 85e13cc38c9c13145bdb0c612c6e2cbe, type: 3}
|
||||
--- !u!1 &1023957098
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1023957099}
|
||||
- component: {fileID: 1023957100}
|
||||
m_Layer: 3
|
||||
m_Name: MovingPlatformTrigger
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &1023957099
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1023957098}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0.55, z: 0}
|
||||
m_LocalScale: {x: 6, y: 0.1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 175005001}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &1023957100
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1023957098}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 7000c8c0eb91b2d4cb9a0e3ee1b609a7, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
layerMask:
|
||||
serializedVersion: 2
|
||||
m_Bits: 4294966848
|
||||
--- !u!4 &1053905692 stripped
|
||||
Transform:
|
||||
m_CorrespondingSourceObject: {fileID: 7008207192594766311, guid: 2ed6bfce9ad3e19428cb9bef743e0fa3, type: 3}
|
||||
@ -3056,22 +3088,10 @@ PrefabInstance:
|
||||
m_Modification:
|
||||
m_TransformParent: {fileID: 0}
|
||||
m_Modifications:
|
||||
- target: {fileID: 698768805, guid: 2ed6bfce9ad3e19428cb9bef743e0fa3, type: 3}
|
||||
propertyPath: m_LocalScale.y
|
||||
value: 1.5
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2083070161, guid: 2ed6bfce9ad3e19428cb9bef743e0fa3, type: 3}
|
||||
propertyPath: m_LocalScale.y
|
||||
value: 1.5
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7008207192594766305, guid: 2ed6bfce9ad3e19428cb9bef743e0fa3, type: 3}
|
||||
propertyPath: m_Name
|
||||
value: Player
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7008207192594766310, guid: 2ed6bfce9ad3e19428cb9bef743e0fa3, type: 3}
|
||||
propertyPath: m_Enabled
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7008207192594766311, guid: 2ed6bfce9ad3e19428cb9bef743e0fa3, type: 3}
|
||||
propertyPath: m_RootOrder
|
||||
value: 2
|
||||
|
@ -17,10 +17,12 @@ namespace Platforms
|
||||
private bool _goingToFuturePos;
|
||||
|
||||
private Rigidbody2D _platformRigidbody;
|
||||
private CollisionChecker _movingPlatformTrigger;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
_platformRigidbody = GetComponent<Rigidbody2D>();
|
||||
_movingPlatformTrigger = GetComponentInChildren<CollisionChecker>();
|
||||
}
|
||||
|
||||
private void Start()
|
||||
@ -58,19 +60,22 @@ namespace Platforms
|
||||
|
||||
public void Move(float value)
|
||||
{
|
||||
var position = transform.position;
|
||||
//var position = transform.position;
|
||||
switch (_goingToFuturePos)
|
||||
{
|
||||
case true:
|
||||
_platformRigidbody.MovePosition(new Vector2(position.x + speed * GetDecision(xOffset),
|
||||
position.y + speed * GetDecision(yOffset)));
|
||||
//_platformRigidbody.MovePosition(new Vector2(position.x + speed * GetDecision(xOffset),
|
||||
//position.y + speed * GetDecision(yOffset)));
|
||||
|
||||
transform.position = Vector3.MoveTowards(transform.position, _futurePos, speed * Time.deltaTime);
|
||||
if (Math.Abs(_futurePos.x - transform.position.x) < VerificationOffset &&
|
||||
Math.Abs(_futurePos.y - transform.position.y) < VerificationOffset)
|
||||
_goingToFuturePos = false;
|
||||
break;
|
||||
case false:
|
||||
_platformRigidbody.MovePosition(new Vector2(position.x + speed * -GetDecision(xOffset),
|
||||
position.y + speed * -GetDecision(yOffset)));
|
||||
//_platformRigidbody.MovePosition(new Vector2(position.x + speed * -GetDecision(xOffset),
|
||||
//position.y + speed * -GetDecision(yOffset)));
|
||||
transform.position = Vector3.MoveTowards(transform.position, _originalPos, speed * Time.deltaTime);
|
||||
if (Math.Abs(_originalPos.x - transform.position.x) < VerificationOffset &&
|
||||
Math.Abs(_originalPos.y - transform.position.y) < VerificationOffset)
|
||||
_goingToFuturePos = true;
|
||||
|
@ -25,7 +25,7 @@ MonoBehaviour:
|
||||
m_MinSize: {x: 300, y: 200}
|
||||
m_MaxSize: {x: 24288, y: 16192}
|
||||
vertical: 0
|
||||
controlID: 12715
|
||||
controlID: 20106
|
||||
--- !u!114 &2
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 52
|
||||
@ -142,7 +142,7 @@ MonoBehaviour:
|
||||
m_MinSize: {x: 100, y: 200}
|
||||
m_MaxSize: {x: 8096, y: 16192}
|
||||
vertical: 1
|
||||
controlID: 12684
|
||||
controlID: 20029
|
||||
--- !u!114 &4
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 52
|
||||
@ -202,7 +202,7 @@ MonoBehaviour:
|
||||
scrollPos: {x: 0, y: 0}
|
||||
m_SelectedIDs:
|
||||
m_LastClickedID: 0
|
||||
m_ExpandedIDs: 327affff247fffffe294ffff0efbffff
|
||||
m_ExpandedIDs: e079ffff307affff327affff247fffffe294ffff0efbffff
|
||||
m_RenameOverlay:
|
||||
m_UserAcceptedRename: 0
|
||||
m_Name:
|
||||
@ -307,7 +307,7 @@ MonoBehaviour:
|
||||
scrollPos: {x: 0, y: 0}
|
||||
m_SelectedIDs: dc3c0000
|
||||
m_LastClickedID: 15580
|
||||
m_ExpandedIDs: ffffffff00000000b0630000126400001464000016640000186400001a6400001c64000020640000166500002065000028650000
|
||||
m_ExpandedIDs: ffffffff00000000b0630000126400001464000016640000186400001a6400001c6400001e6400001665000020650000fe660000847d0000
|
||||
m_RenameOverlay:
|
||||
m_UserAcceptedRename: 0
|
||||
m_Name:
|
||||
@ -332,10 +332,10 @@ MonoBehaviour:
|
||||
m_Icon: {fileID: 0}
|
||||
m_ResourceFile:
|
||||
m_AssetTreeState:
|
||||
scrollPos: {x: 0, y: 0}
|
||||
scrollPos: {x: 0, y: 237.80002}
|
||||
m_SelectedIDs: 307affff
|
||||
m_LastClickedID: 0
|
||||
m_ExpandedIDs: ffffffff00000000b0630000126400001464000016640000186400001a6400001c64000020640000166500002065000028650000
|
||||
m_ExpandedIDs: ffffffff00000000b0630000126400001464000016640000186400001a6400001c6400001e6400001665000020650000fe660000847d0000
|
||||
m_RenameOverlay:
|
||||
m_UserAcceptedRename: 0
|
||||
m_Name:
|
||||
@ -415,7 +415,7 @@ MonoBehaviour:
|
||||
m_MinSize: {x: 100, y: 200}
|
||||
m_MaxSize: {x: 8096, y: 16192}
|
||||
vertical: 1
|
||||
controlID: 12762
|
||||
controlID: 20107
|
||||
--- !u!114 &9
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 52
|
||||
@ -435,8 +435,8 @@ MonoBehaviour:
|
||||
y: 0
|
||||
width: 880
|
||||
height: 514.4
|
||||
m_MinSize: {x: 200, y: 200}
|
||||
m_MaxSize: {x: 4000, y: 4000}
|
||||
m_MinSize: {x: 202, y: 221}
|
||||
m_MaxSize: {x: 4002, y: 4021}
|
||||
m_ActualView: {fileID: 2}
|
||||
m_Panes:
|
||||
- {fileID: 10}
|
||||
@ -690,9 +690,9 @@ MonoBehaviour:
|
||||
m_PlayAudio: 0
|
||||
m_AudioPlay: 0
|
||||
m_Position:
|
||||
m_Target: {x: 7.612222, y: -1.4387107, z: -0.2254653}
|
||||
m_Target: {x: 8.355493, y: -13.468705, z: 0.011292132}
|
||||
speed: 2
|
||||
m_Value: {x: 7.612222, y: -1.4387107, z: -0.2254653}
|
||||
m_Value: {x: 8.355493, y: -13.468705, z: 0.011292132}
|
||||
m_RenderMode: 0
|
||||
m_CameraMode:
|
||||
drawMode: 0
|
||||
@ -743,9 +743,9 @@ MonoBehaviour:
|
||||
speed: 2
|
||||
m_Value: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_Size:
|
||||
m_Target: 9.087455
|
||||
m_Target: 8.870777
|
||||
speed: 2
|
||||
m_Value: 9.087455
|
||||
m_Value: 8.870777
|
||||
m_Ortho:
|
||||
m_Target: 1
|
||||
speed: 2
|
||||
@ -789,8 +789,8 @@ MonoBehaviour:
|
||||
y: 514.4
|
||||
width: 880
|
||||
height: 216.39996
|
||||
m_MinSize: {x: 102, y: 121}
|
||||
m_MaxSize: {x: 4002, y: 4021}
|
||||
m_MinSize: {x: 100, y: 100}
|
||||
m_MaxSize: {x: 4000, y: 4000}
|
||||
m_ActualView: {fileID: 12}
|
||||
m_Panes:
|
||||
- {fileID: 12}
|
||||
@ -843,8 +843,8 @@ MonoBehaviour:
|
||||
y: 0
|
||||
width: 352
|
||||
height: 730.8
|
||||
m_MinSize: {x: 276, y: 71}
|
||||
m_MaxSize: {x: 4001, y: 4021}
|
||||
m_MinSize: {x: 275, y: 50}
|
||||
m_MaxSize: {x: 4000, y: 4000}
|
||||
m_ActualView: {fileID: 14}
|
||||
m_Panes:
|
||||
- {fileID: 14}
|
||||
|
Loading…
x
Reference in New Issue
Block a user