// Update is called once per frame void Update() { countdown -= Time.deltaTime; if (countdown < 0) { countdown = Random.Range(0.5f, 1.2f); if (flt.registeredBaggages.Count > 0) { Baggage bag = flt.registeredBaggages[0]; flt.registeredBaggages.Remove(bag); GameObject bagObject = Instantiate(luggage, transform.position, transform.rotation); LuggageController lc = bagObject.GetComponent <LuggageController>(); lc.CreateLuggageData(bag); lc.BakeValues(); } //lc.enabled = false; //lc.CreateLuggageData(LuggageController.LuggageType.DEPARTURE, "TXL", "HOM", new Vector3(1f, 1f, 1f), Color.red, "Smith", "GFSAFW"); //lc.CreateLuggageData(flt.baggages.) //lc.BakeValues(); //lc.enabled = true; } }
private void OnCollisionEnter(Collision collision) { //if (m_grabHandler && m_grabHandler.m_grabStrength >= 0.5f && m_grabHandler.Grabbing && // !Joint && collision.gameObject.layer ==10 ) //{ // if (collision.rigidbody) // { // foreach (var grabber in m_grabHandler.m_grabbers) // { // if (grabber.Joint && grabber.Joint.connectedBody != null) // { // return; // } // } // m_grabHandler.StartGrab(collision.rigidbody); // } // Joint = m_rb.gameObject.AddComponent<ConfigurableJoint>(); // Joint.xMotion = ConfigurableJointMotion.Locked; // Joint.yMotion = ConfigurableJointMotion.Locked; // Joint.zMotion = ConfigurableJointMotion.Locked; // Joint.angularXMotion = ConfigurableJointMotion.Locked; // Joint.angularYMotion = ConfigurableJointMotion.Locked; // Joint.angularZMotion = ConfigurableJointMotion.Locked; // Joint.projectionMode = JointProjectionMode.PositionAndRotation; // Joint.anchor = transform.InverseTransformPoint(collision.contacts[0].point); // if (collision.gameObject.GetComponent<Rigidbody>()) // { // Joint.connectedBody = collision.gameObject.GetComponent<Rigidbody>(); // } if (m_grabHandler && m_grabHandler.m_grabStrength >= 0.5f && m_grabHandler.Grabbing && !Joint2 && collision.gameObject.layer == 10) { if (collision.rigidbody) { foreach (var grabber in m_grabHandler.m_grabbers) { if (grabber.Joint2 && grabber.Joint2.connectedBody != null) { return; } } m_grabHandler.StartGrab(collision.rigidbody); } Joint2 = m_rb.gameObject.AddComponent <FixedJoint>(); if (collision.gameObject.GetComponent <Rigidbody>()) { Joint2.connectedBody = collision.gameObject.GetComponent <Rigidbody>(); if (collision.gameObject.GetComponentInParent <LuggageController>()) { LuggageController controller = collision.gameObject.GetComponentInParent <LuggageController>(); collision.gameObject.GetComponentInParent <LuggageController>().InHand = true; Debug.Log(collision.gameObject.GetComponentInParent <LuggageController>().InHand); } } } }
// Use this for initialization void Start() { LuggageController = GetComponentInParent <LuggageController>(); if (bagCollision == null) { bagCollision = new UnityEvent(); } bagCollision.AddListener(LuggageController.Crush); }
public void Initialize() { BizContext = new LuggageTrackerBizContext(new InMemDAL()); luggage = new Luggage(luggageId, name) { Weight = weight, Measurement = measurement, Description = description, Status = luggageStatus, LastStatusChange = lastStatusChange, }; luggageController = new LuggageController(BizContext); passengerController = new PassengerController(BizContext); }