Commit 6d6e40ad authored by mmaluschnig's avatar mmaluschnig
Browse files

Merge branch 'daytime'

* daytime:
  pies spawn more frequently and give less bunuses

# Conflicts:
#	RingMaster/RingMaster/.vs/RingMaster/xs/UserPrefs.xml
parents c080bc8a 14fbafce
<Properties StartupConfiguration="{67A4F128-F6AC-CD88-DA35-F29416A0792A}|">
<MonoDevelop.Ide.ItemProperties.Assembly-CSharp PreferredExecutionTarget="Unity.Editor" />
<MonoDevelop.Ide.Workbench ActiveDocument="Assets/Scripts/TrapezeScripts/GenerateTrapezes.cs">
<Files>
<File FileName="Assets/Scripts/TrapezeScripts/TrapezeController.cs" Line="51" Column="27" />
<File FileName="Assets/Scripts/TrapezeScripts/TrapezePerson.cs" Line="52" Column="44" />
<File FileName="Assets/Scripts/TrapezeScripts/TrapezeTutorial.cs" Line="89" Column="9" />
<File FileName="Assets/Scripts/DaytimeScripts/CharacterSpeech/JohnSmithSpeech.cs" Line="118" Column="96" />
<File FileName="Assets/Scripts/TrapezeScripts/GenerateTrapezes.cs" Line="42" Column="108" />
</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
......@@ -144,10 +144,10 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: bbf42f3430dfc5b48a94215583091a1d, type: 3}
m_Name:
m_EditorClassIdentifier:
points: 100
TimeBonus: 20
points: 50
TimeBonus: 5
specialItem: {fileID: 1649884426353186}
OnCollectParticles: {fileID: 1301897093530838, guid: fe523caf0352a7547a3f1404bd46b43d,
OnCollectParticles: {fileID: 1290046360213332, guid: 107a7a15d7e65914d89e2647ad01e920,
type: 2}
--- !u!212 &212344781101984214
SpriteRenderer:
......
......@@ -185,7 +185,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
m_IsActive: 0
--- !u!1 &1762213849776068
GameObject:
m_ObjectHideFlags: 0
......@@ -329,7 +329,7 @@ Transform:
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1345098002592372}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 8.78, z: 0}
m_LocalPosition: {x: 0, y: 7.14, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 4078250888816992}
......@@ -351,7 +351,7 @@ Transform:
m_GameObject: {fileID: 1050029343530560}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -50, y: 5.8, z: 0}
m_LocalScale: {x: 5, y: 5, z: 1}
m_LocalScale: {x: 8, y: 8, z: 1}
m_Children:
- {fileID: 4294090477210918}
- {fileID: 4802455543859232}
......
......@@ -1095,6 +1095,12 @@ Prefab:
propertyPath: m_RootOrder
value: 11
objectReference: {fileID: 0}
- target: {fileID: 114685032441255122, guid: d9eae21df7f7349429f09e42b02d7a23,
type: 2}
propertyPath: OnCollectParticles
value:
objectReference: {fileID: 1290046360213332, guid: 107a7a15d7e65914d89e2647ad01e920,
type: 2}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: d9eae21df7f7349429f09e42b02d7a23, type: 2}
m_IsPrefabAsset: 0
......@@ -1473,6 +1479,18 @@ Prefab:
propertyPath: m_RootOrder
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4872350856089052, guid: a13b0bed2e5711a4fbda550f1ba732b7, type: 2}
propertyPath: m_LocalScale.x
value: 5
objectReference: {fileID: 0}
- target: {fileID: 4872350856089052, guid: a13b0bed2e5711a4fbda550f1ba732b7, type: 2}
propertyPath: m_LocalScale.y
value: 5
objectReference: {fileID: 0}
- target: {fileID: 4852310194904870, guid: a13b0bed2e5711a4fbda550f1ba732b7, type: 2}
propertyPath: m_LocalPosition.y
value: 9.34
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: a13b0bed2e5711a4fbda550f1ba732b7, type: 2}
m_IsPrefabAsset: 0
......@@ -2263,6 +2281,7 @@ MonoBehaviour:
swingForce: 25
rotateForce: 2
exitForce: 2
flipBonus: 1
handsPivot: {fileID: 1858953468}
midPivot: {fileID: 95257390}
botPivot: {fileID: 859786666}
......
......@@ -231,11 +231,11 @@ Prefab:
objectReference: {fileID: 0}
- target: {fileID: 4984355063605358, guid: cfb62dab04de2fe4da7137a2f627086b, type: 2}
propertyPath: m_LocalScale.x
value: 1
value: 2
objectReference: {fileID: 0}
- target: {fileID: 4984355063605358, guid: cfb62dab04de2fe4da7137a2f627086b, type: 2}
propertyPath: m_LocalScale.y
value: 1
value: 2
objectReference: {fileID: 0}
- target: {fileID: 1308170843970902, guid: cfb62dab04de2fe4da7137a2f627086b, type: 2}
propertyPath: m_Name
......@@ -1267,7 +1267,11 @@ MonoBehaviour:
speech: {fileID: 439704337}
button: {fileID: 1207322006}
SwingText: {fileID: 1110322467}
player: {fileID: 0}
player: {fileID: 2089978956}
Hands: {fileID: 1858953468}
trapeze: {fileID: 1308170843970902, guid: cfb62dab04de2fe4da7137a2f627086b, type: 2}
specialTrapeze: {fileID: 1140605560837190, guid: d9eae21df7f7349429f09e42b02d7a23,
type: 2}
--- !u!1 &848583036
GameObject:
m_ObjectHideFlags: 0
......@@ -2343,11 +2347,11 @@ Prefab:
objectReference: {fileID: 0}
- target: {fileID: 4984355063605358, guid: cfb62dab04de2fe4da7137a2f627086b, type: 2}
propertyPath: m_LocalScale.x
value: 1
value: 2
objectReference: {fileID: 0}
- target: {fileID: 4984355063605358, guid: cfb62dab04de2fe4da7137a2f627086b, type: 2}
propertyPath: m_LocalScale.y
value: 1
value: 2
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: cfb62dab04de2fe4da7137a2f627086b, type: 2}
......@@ -2620,7 +2624,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 191, y: -53.369995}
m_AnchoredPosition: {x: 191, y: -53.370117}
m_SizeDelta: {x: 362, y: 80}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1482713996
......
......@@ -76,7 +76,7 @@ public class JohnSmithSpeech : MonoBehaviour, Character {
conversation.Clear();
responseQueue.Clear();
if (GameManager.SimonTutorial) {
if (GameManager.JohnTutorial) {
loadTutorialConversation();
}if ((int)GameManager.getLevel(getName()) == 1) {
......@@ -108,13 +108,13 @@ public class JohnSmithSpeech : MonoBehaviour, Character {
conversation.Enqueue("To Swing yourself just hold A to swing left and D to swing right");
responseQueue.Enqueue(new string[] { "Continue" });
conversation.Enqueue("GRR (Just hold down on SPACEBAR to select an angle)");
conversation.Enqueue("Well Done! Ill give you a bit more power");
responseQueue.Enqueue(new string[] { "Continue" });
conversation.Enqueue("grr (Great! Now release SPACEBAR to select your Power and fire the pie)");
conversation.Enqueue("Cool! now press SPACEABR to let go and swiiiing");
responseQueue.Enqueue(new string[] { "Continue" });
conversation.Enqueue("grR (Well Done! See if you can hit the rest)");
conversation.Enqueue("Dont worry Simon will catch you! Use A and D to rotate in the air");
responseQueue.Enqueue(new string[] { "Continue" });
}
......
......@@ -102,14 +102,22 @@ public class GenerateTrapezes : MonoBehaviour {
//top tier
YScaler += Random.Range(minYProgression, maxYProgression) * progression;
//random chance of spawning a collectable
if(Random.Range(0,1f) < 0.2) {
if(Random.Range(0,1f) < 0.6f) {
thisTrapeze = specialTrapeze;
}
} else if (i == 2) {
//middle tier
if (Random.Range(0, 1f) < 0.5f)
{
thisTrapeze = specialTrapeze;
}
} else {
//bottom tier
YScaler -= Random.Range(minYProgression, maxYProgression) * progression;
if (Random.Range(0, 1f) < 0.2f)
{
thisTrapeze = specialTrapeze;
}
}
Vector3 newTrapeze = initialTrapezes[i].position;
......
......@@ -47,4 +47,7 @@ public class TrapezeController : MonoBehaviour {
public static void AddTime(float time) {
finishTime += time;
}
public static void setTime(float time){
finishTime = time;
}
}
......@@ -7,6 +7,7 @@ public class TrapezePerson : MonoBehaviour {
public float swingForce = 1f;
public float rotateForce = 1f;
public float exitForce = 3;
public float flipBonus = 1;
public Transform handsPivot;
public Transform midPivot;
......@@ -47,34 +48,59 @@ public class TrapezePerson : MonoBehaviour {
checkFlip();
checkRotating();
if (Input.GetKey(KeyCode.D) || Input.GetKeyDown(KeyCode.RightArrow)) {
if (onTrapeze) {
body.AddTorque(swingForce / 10);
} else {
transform.RotateAround(currentPivot.position, Vector3.forward, -rotateForce);
}
if (GameManager.JohnTutorial && GameManager.TutorialState < 1)
{
//dont allow to swing or let go
}
if (Input.GetKey(KeyCode.A) || Input.GetKeyDown(KeyCode.LeftArrow)) {
if (onTrapeze) {
body.AddTorque(-swingForce / 10);
} else {
transform.RotateAround(currentPivot.position, Vector3.forward, rotateForce);
else
{
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) || Input.GetKeyDown(KeyCode.LeftArrow))
{
if (onTrapeze)
{
body.AddTorque(-swingForce / 10);
}
else
{
transform.RotateAround(currentPivot.position, Vector3.forward, rotateForce);
}
}
if (GameManager.JohnTutorial && GameManager.TutorialState == 1)
{
//dont allow to let go
}else{
if (onTrapeze && Input.GetKeyDown(KeyCode.Space))
{
releaseTrapeze();
}
}
}
if (onTrapeze && Input.GetKeyDown(KeyCode.Space)) {
float radius = Vector3.Distance(transform.position, botPivot.position);
float radiansPerSecond = body.angularVelocity * Mathf.PI / 180;
linearVelocity = radius * radiansPerSecond;
//scale velocity so that slower swings get more of a boost
linearVelocity = Mathf.Clamp(linearVelocity, -10, 10);
print(linearVelocity);
}
private void releaseTrapeze(){
float radius = Vector3.Distance(transform.position, botPivot.position);
float radiansPerSecond = body.angularVelocity * Mathf.PI / 180;
linearVelocity = radius * radiansPerSecond;
//scale velocity so that slower swings get more of a boost
linearVelocity = Mathf.Clamp(linearVelocity, -10, 10);
print(linearVelocity);
DetachFromTrapeze();
}
DetachFromTrapeze();
}
//***Collision triggers moved to HandsTrigger.cs***
......@@ -128,7 +154,7 @@ public class TrapezePerson : MonoBehaviour {
Instantiate(flipParticles, Camera.main.transform);
}
TrapezeController.score += 10 * Mathf.Abs(flips);
TrapezeController.AddTime(5);
TrapezeController.AddTime(flipBonus);
rotations.resetCounter();
prevFlip = rotations.rotations;
}
......
......@@ -13,6 +13,13 @@ public class TrapezeTutorial : MonoBehaviour {
public Button button;
public GameObject SwingText;
public GameObject player;
public Transform Hands;
public GameObject trapeze;
public GameObject specialTrapeze;
private Transform firstTrapeze;
private bool spawnable;
private float initialAngularDrag;
private float initialSwingForce;
......@@ -24,7 +31,8 @@ public class TrapezeTutorial : MonoBehaviour {
player = GameObject.FindWithTag("Player");
initialAngularDrag = player.GetComponent<Rigidbody2D>().angularDrag;
initialSwingForce = player.GetComponent<TrapezePerson>().swingForce;
GameManager.SimonTutorial = true;
GameManager.JohnTutorial = true;
GameManager.TutorialState = 0;
dialogueBox.SetActive(false);
SwingText.SetActive(false);
speech.GreetingMessage();
......@@ -33,10 +41,15 @@ public class TrapezeTutorial : MonoBehaviour {
}
private void Update() {
if (Input.GetKeyDown(KeyCode.Space) && GameManager.TutorialState == 1) {
if (Input.GetKeyDown(KeyCode.Space) && GameManager.TutorialState == 2) {
progress();
}
if(GameManager.TutorialState == 3 && spawnable && player.transform.position.y > 22){
firstTrapeze = Instantiate(trapeze, Hands.position, Quaternion.identity).transform;
spawnable = false;
progress();
}
}
......@@ -54,26 +67,41 @@ public class TrapezeTutorial : MonoBehaviour {
void progress() {
state++;
if (state == 2) {
if (state == 2)
{
//learn to swing
SwingText.SetActive(true);
player.GetComponent<Rigidbody2D>().angularDrag = 10;
player.GetComponent<TrapezePerson>().swingForce *= 4;
//ensure they reach a certain angle before allowing them to progress
} else if (state == 3) {
button.gameObject.SetActive(false);
GameManager.TutorialState = 1;
} else if (state == 4) {
//learn to let go
}
else if (state == 3)
{
//reduce drag and stuff
player.GetComponent<Rigidbody2D>().angularDrag = initialAngularDrag;
player.GetComponent<TrapezePerson>().swingForce = initialSwingForce;
}else if(state == 4){
//allow the player to let go
button.gameObject.SetActive(false);
GameManager.TutorialState = 2;
SwingText.GetComponentInChildren<Text>().text = "Use A and D to Rotate";
SwingText.transform.localScale *= 2;
} else if (state == 5) {
//learn to Rotate (simon will catch you)
GameManager.TutorialState = 3;
SwingText.GetComponentInChildren<Text>().text = "Use A and D to Rotate";
SwingText.transform.localScale *= 2;
StartCoroutine(spawnTrapezeOnPlyer());
} else if (state == 6) {
GameManager.TutorialState = 4;
}
JohnText.text = speech.converse();
}
private IEnumerator spawnTrapezeOnPlyer(){
yield return new WaitForSeconds(3);
print("SPAWN TRAPEZE" + player.transform.position.y);
spawnable = true;
StopCoroutine(spawnTrapezeOnPlyer());
}
}
m_EditorVersion: 2018.2.11f1
m_EditorVersion: 2018.2.12f1
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