-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathAddMoveablePulley.cs
30 lines (24 loc) · 985 Bytes
/
AddMoveablePulley.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class AddMoveablePulley : MonoBehaviour {
private GameObject mass; //the mass in the scene
private PulleyMass pulley_mass; //the pulleymass component
private int num_moveable_pulleys;
private void Start()
{
mass = GameObject.FindGameObjectWithTag("Mass");
pulley_mass = mass.GetComponent<PulleyMass>();
}
//when a new pulley is added
public void AddNewMoveablePulley()
{
pulley_mass.AddPulleyToMass(); //add a support pulley to the mass
//when a moveable pulley is added there is no longer a SupportRope
pulley_mass.RemoveSupportRope();
PulleyController.AddMoveablePulleyToScene();
PulleyController.GetPulleysInScene(); //add all the pulleys back to the list of pulleys
PulleyController.CalculateMechanicalAdvantage();
num_moveable_pulleys++;
}
}