private void FixedUpdate() { // pass the input to the car! float h = CrossPlatformInputManager.GetAxis("Horizontal"); ////print("H" + (h * 10000).ToString()); float v = CrossPlatformInputManager.GetAxis("Vertical"); ////print("V" + v.ToString()); #if !MOBILE_INPUT float handbrake = CrossPlatformInputManager.GetAxis("Jump"); if (input_destination.transform.childCount > 0) { //m_Car.Move(h, v, v, handbrake); ////print(input_destination.transform.GetChild(0).GetChild(0).GetComponent<TMP_Text>().text); text = input_destination.transform.GetChild(0).GetChild(0).GetComponent <TMP_Text>(); m_Car.m_Topspeed = float.Parse(text.text); ////debug.log("THE CAR MAX SPEED CHOSEN IS " + m_Car.m_Topspeed.ToString()); m_Car.Move(h, v, v, handbrake); ai.SetTarget(first.transform); } else { //m_Car.Move(0, 0, 1000, 1000); m_Car.m_Topspeed = 0; ////debug.log("does it never reach here?"); } #else //m_Car.Move(h, v, v, 0f); #endif }
private void OnWillRenderObject() { Debug.Log("On_will-Start"); if (Camera.current.tag == "center_camera") { if (this.transform.position.y < 0.2) { car.SetTarget(this.transform); } } }
public void init(WaypointStrategy travelStrat) { controls = gameObject.GetComponent <UnityStandardAssets.Vehicles.Car.CarAIControl>(); travelStrategy = travelStrat; controls.SetTarget(travelStrategy.pickNextWaypoint().getTransform()); isDead = isDecoupled = false; hitPoints = 3; }
public void init(ChaseStrategy chaseStrat) { controls = gameObject.GetComponent <UnityStandardAssets.Vehicles.Car.CarAIControl>(); chaseStrategy = chaseStrat; controls.SetTarget(chaseStrat.pickAttack().getTransform()); isDead = isDecoupled = false; hitPoints = 5; }
// Use this for initialization void Start() { waypointlist[0] = new Vector3(-20.6f, 0f, 126.2f); waypointlist[1] = new Vector3(35.6f, 0f, 138.8f); waypointlist[2] = new Vector3(78.7f, 0f, 105.3f); waypointlist[3] = new Vector3(98.4f, 0f, 43.9f); waypointlist[4] = new Vector3(75.8f , 0f, -13.3f); waypointlist[5] = new Vector3(28.4f, 0f, -18.4f); waypointlist[6] = new Vector3(-4.2f, 0f, -2.3f); waypointlist[7] = new Vector3(-18.7f, 0f, 26f); waypointlist[8] = new Vector3(-31.6f, 0f, 57.4f); waypointlist[9] = new Vector3(-30f, 0f, 95f); carai = GetComponent(typeof(CarAIControl)) as CarAIControl; car = carai.GetComponent(typeof(CarController)) as CarController; waypointholder.position = waypointlist[0]; carai.SetTarget(waypointholder); for (int i = 0; i < 10; i++) { GameObject.Instantiate(marker); marker.transform.position = waypointlist[i]; } lasttime = 0; //In start initialize both currentCameraIndex = 0; //Turn all cameras off, except the first default one for (int i=1; i<cameras.Length; i++) { cameras[i].gameObject.SetActive(false); } //If any cameras were added to the controller, enable the first one if (cameras.Length>0) { cameras [0].gameObject.SetActive (true); } }
public void changeWaypoint() { controls.SetTarget(travelStrategy.pickNextWaypoint().getTransform()); }
private void chooseNextTarget() { controls.SetTarget(chaseStrategy.pickAttack().getTransform()); }
void ManualTargetChange() { int whichCube = Random.Range(0, randomCubes.Length); selfAI.SetTarget(randomCubes[whichCube].transform); }