void RTC_TankController_OnRTCSpawned(RTC_TankController RTC) { if (!tankControllers.Contains(RTC)) { tankControllers.Add(RTC); } }
void Awake() { rigid = GetComponentInParent <Rigidbody> (); tankController = GetComponentInParent <RTC_TankController> (); wheelCollider = GetComponent <WheelCollider> (); //wheelCollider.ConfigureVehicleSubsteps (10000f, 1, 1); // Increasing WheelCollider mass for avoiding unstable behavior. Only in Unity 5. wheelCollider.mass = (rigid.mass / 10f) / tankController.GetComponentsInChildren <RTC_WheelCollider>().Length; // Getting friction curves. forwardFrictionCurve = wheelCollider.forwardFriction; sidewaysFrictionCurve = wheelCollider.sidewaysFriction; // Getting default stiffness. orgForwardStiffness = forwardFrictionCurve.stiffness; orgSidewaysStiffness = sidewaysFrictionCurve.stiffness; // Assigning new frictons if one of the behavior preset selected above. wheelCollider.forwardFriction = forwardFrictionCurve; wheelCollider.sidewaysFriction = sidewaysFrictionCurve; // Creating all ground particles, and adding them to list. for (int i = 0; i < RTCGroundMaterials.frictions.Length; i++) { GameObject ps = (GameObject)Instantiate(RTCGroundMaterials.frictions [i].groundParticles, transform.position, transform.rotation) as GameObject; emission = ps.GetComponent <ParticleSystem> ().emission; emission.enabled = false; ps.transform.SetParent(transform, false); ps.transform.localPosition = Vector3.zero; ps.transform.localRotation = Quaternion.identity; allWheelParticles.Add(ps.GetComponent <ParticleSystem> ()); } }
void Start() { tankController = GetComponentInParent <RTC_TankController>(); _light = GetComponent <Light>(); _light.enabled = true; _light.renderMode = RTCSettings.useLightsAsVertexLights ? LightRenderMode.ForceVertex : LightRenderMode.ForcePixel; }
void Start() { tankController = GetComponentInParent <RTC_TankController> (); anyWheel = tankController.wheelColliders_L [0]; pivot = new GameObject(transform.name); pivot.transform.SetParent(transform, false); pivot.transform.SetParent(transform.parent, true); transform.SetParent(pivot.transform, true); }
void Awake() { tankRigid = GetComponent <Rigidbody>(); mainGunRigid = mainGun.GetComponent <Rigidbody>(); tank = gameObject.GetComponent <RTC_TankController>(); tankCamera = GameObject.FindObjectOfType <RTC_MainCamera>(); GameObject newTarget = new GameObject("Located Target"); locatedTarget = newTarget.transform; GameObject newTarget2 = new GameObject("Directed Target"); directedTarget = newTarget2.transform; mainGunRigid.maxAngularVelocity = maximumAngularVelocity; mainGunRigid.interpolation = RigidbodyInterpolation.None; mainGunRigid.interpolation = RigidbodyInterpolation.Interpolate; #if RTC_REWIRED player = Rewired.ReInput.players.GetPlayer(0); #endif }
void OnRTCSpawned(RTC_TankController tankController) { currentTankController = tankController; currentGunController = tankController.GetComponent <RTC_TankGunController>(); }
void Start() { tankController = GetComponentInParent <RTC_TankController>(); particle = GetComponent <ParticleSystem>(); emission = particle.emission; }