예제 #1
0
        private void InitializeVehicle()
        {
            m_Frame = Instantiate(m_DBGFramePrefab, transform);
            m_Frame.transform.position = transform.position;

            m_Engine       = Instantiate(m_DBGEnginePrefab, transform);
            m_DriveWheel   = Instantiate(m_DBGDriveWheelPrefab, transform);
            m_SupportWheel = Instantiate(m_DBGSupportWheelPrefab, transform);

            m_Frame.AttachParts(m_Engine, m_DriveWheel, m_SupportWheel);
        }
예제 #2
0
        public void AttachParts(HotVehicleEngine engine, HotVehicleWheel driveWheel, HotVehicleWheel supportWheel)
        {
            var engineStats = engine.Stats;

            engine.gameObject.SetActive(false);
            //engine.transform.position = m_EnginePos.position;
            //engine.FixedJoint.connectedBody = Rigidbody;


            driveWheel.transform.position       = m_DriveWheelPos.position;
            driveWheel.HingeJoint.connectedBody = Rigidbody;
            driveWheel.InitializeMotor(engineStats.MotorSpeed, engineStats.MaxMotorTorque);

            supportWheel.transform.position       = m_SupportWheelPos.position;
            supportWheel.HingeJoint.connectedBody = Rigidbody;
        }