Commit bbf0b1a0 authored by mmaluschnig's avatar mmaluschnig
Browse files

added trampoline to trapeze

parent 7b2678b1
<Properties StartupConfiguration="{67A4F128-F6AC-CD88-DA35-F29416A0792A}|">
<MonoDevelop.Ide.ItemProperties.Assembly-CSharp PreferredExecutionTarget="Unity.Editor" />
<MonoDevelop.Ide.Workbench ActiveDocument="Assets/Scripts/MimeScripts/TriggerManager.cs">
<Files>
<File FileName="Assets/Scripts/DaytimeScripts/DaytimeManager.cs" Line="1" Column="1" />
<File FileName="Assets/Scripts/MimeScripts/SpawnKeys.cs" Line="1" Column="1" />
<File FileName="Assets/Scripts/DaytimeScripts/CharacterInteractions.cs" Line="68" Column="116" />
<File FileName="Assets/Scripts/DaytimeScripts/TentInteractoins.cs" Line="28" Column="112" />
<File FileName="Assets/Scripts/TrapezeScripts/TrapezePerson.cs" Line="45" Column="75" />
<File FileName="Assets/Scripts/MimeScripts/TriggerManager.cs" Line="45" Column="78" />
</Files>
</MonoDevelop.Ide.Workbench>
<MonoDevelop.Ide.Workspace ActiveConfiguration="Debug" />
<MonoDevelop.Ide.DebuggingService.Breakpoints>
<BreakpointStore />
</MonoDevelop.Ide.DebuggingService.Breakpoints>
<MonoDevelop.Ide.DebuggingService.PinnedWatches />
<MultiItemStartupConfigurations />
</Properties>
\ No newline at end of file
<Properties />
\ No newline at end of file
%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: SideWall
friction: 0.4
bounciness: 0.2
fileFormatVersion: 2
guid: acf94433b30574f1d9936ac17a1caef8
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 6200000
userData:
assetBundleName:
assetBundleVariant:
%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: Trampoline
friction: 0
bounciness: 1.1
fileFormatVersion: 2
guid: d39771301f92041ce86aa918e7055b9e
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 6200000
userData:
assetBundleName:
assetBundleVariant:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class FollowPlayerx : MonoBehaviour {
private GameObject player;
// Use this for initialization
void Start () {
player = GameObject.FindWithTag("Player");
}
// Update is called once per frame
void Update () {
Vector3 newPos = transform.position;
newPos.x = player.transform.position.x;
transform.position = newPos;
}
void OnCollisionEnter(Collision collision)
{
player.GetComponent<Rigidbody2D>().angularVelocity = 0;
print("Tramp");
}
}
fileFormatVersion: 2
guid: 00eca143d98b34078819fb52dca7f491
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
......@@ -74,7 +74,7 @@ public class GenerateTrapezes : MonoBehaviour {
private void ScalingTrapezeGeneration() {
//Scaling trapeze Generation
print(numTrapezes / 3);
// print(numTrapezes / 3);
float progression = (numTrapezes / 3) / (float)maxDificulty;
if (progression > 1) progression = 1;
......@@ -102,7 +102,7 @@ public class GenerateTrapezes : MonoBehaviour {
//apply scaling
newTrapeze.x += XScaler;
newTrapeze.y += YScaler;
print("X " + XScaler + "Y " + YScaler);
//print("X " + XScaler + "Y " + YScaler);
currentTrapezeInLevel[i] = Instantiate(trapeze, newTrapeze, Quaternion.identity).transform;
numTrapezes++;
}
......
......@@ -20,7 +20,7 @@ public class HandsTrigger : MonoBehaviour {
void OnTriggerStay2D(Collider2D collision) {
if (collision.gameObject.layer == LayerMask.NameToLayer("Key")) {
print("Collision " + collision.gameObject.name);
//print("Collision " + collision.gameObject.name);
if (!trapezePerson.onTrapeze) {
//possibly enable this trapeze after a second
if (!collision.gameObject.Equals(lastTrapeze)) {
......@@ -38,7 +38,7 @@ public class HandsTrigger : MonoBehaviour {
}
private void OnTriggerExit2D(Collider2D collision) {
print("Exit " + collision.gameObject.name);
//print("Exit " + collision.gameObject.name);
}
public IEnumerator reactivateTrapeze() {
......
......@@ -35,14 +35,14 @@ public class TrapezePerson : MonoBehaviour {
// Update is called once per frame
void Update () {
if (Input.GetKey(KeyCode.D)) {
if (Input.GetKey(KeyCode.D) || Input.GetKeyDown(KeyCode.RightArrow)) {
if (onTrapeze) {
body.AddTorque(swingForce / 10);
} else {
transform.RotateAround(currentPivot.position, Vector3.forward, -rotateForce);
}
}
if (Input.GetKey(KeyCode.A)) {
if (Input.GetKey(KeyCode.A) || Input.GetKeyDown(KeyCode.LeftArrow)) {
if (onTrapeze) {
body.AddTorque(-swingForce / 10);
} else {
......@@ -67,6 +67,7 @@ public class TrapezePerson : MonoBehaviour {
//GetComponent<CapsuleCollider2D>().enabled = true;
currentTrapeze = trapeze;
Time.timeScale = 1;
body.freezeRotation = false;
}
public void DetachFromTrapeze() {
......@@ -77,5 +78,6 @@ public class TrapezePerson : MonoBehaviour {
//Time.timeScale = 0.5f;
body.angularVelocity = 0;
StartCoroutine(handsTrigger.reactivateTrapeze());
body.freezeRotation = true;
}
}
Supports Markdown
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