public void RestoreState(object state) { MoverSaveData data = (MoverSaveData)state; GetComponent <NavMeshAgent>().Warp(data.position.ToVector()); transform.eulerAngles = data.rotation.ToVector(); }
public object CaptureState() { MoverSaveData data = new MoverSaveData(); data.position = new SerializableVector3(transform.position); data.rotation = new SerializableVector3(transform.eulerAngles); return(data); }
public void RestoreState(object state) { MoverSaveData data = (MoverSaveData)state; GetComponent <NavMeshAgent>().enabled = false; transform.position = data.position.ToVector(); transform.eulerAngles = data.rotation.ToVector(); GetComponent <NavMeshAgent>().enabled = true; }
public void RestoreState(object state) { MoverSaveData data = (MoverSaveData)state; navMeshAgent.enabled = false; navMeshAgent.Warp(data.position.ToVector()); transform.eulerAngles = data.rotation.ToVector(); navMeshAgent.enabled = true; }
public void RestoreState(object state) { MoverSaveData data = (MoverSaveData)state; agent.enabled = false; transform.position = data.position.ToVector(); transform.eulerAngles = data.rotation.ToVector(); agent.enabled = true; GetComponent <ActionScheduler>().CancelCurrentAction(); }
// remember and capture the different parameters of the objects public object CaptureState() { MoverSaveData data = new MoverSaveData(); // assigning the position of the objects data.position = new SerializableVector3(transform.position); // assigning the rotation of the objects (eulerAngles means the vector representation of the rotation) data.rotation = new SerializableVector3(transform.eulerAngles); return(data); }
public object CaptureState() { MoverSaveData data = new MoverSaveData(); data.position = new SerializableVector3(transform.position); data.rotation = new SerializableVector3(transform.eulerAngles); //Dictionary<string, object> data = new Dictionary<string, object>(); //data["position"] = new SerializableVector3(transform.position); //data["rotation"] = new SerializableVector3(transform.eulerAngles); //vector representation of the angle return(data); }
//yakalanın konum noktasını characterlere aktardığımız fonksiyon public void RestoreState(object state) { //state i struct a göre cast ettik MoverSaveData data = (MoverSaveData)state; navMeshAgent.enabled = false; //position ve rotation ı kayıtlı yerden aldık transform.position = data.position.ToVector(); transform.eulerAngles = data.rotation.ToVector(); navMeshAgent.enabled = true; GetComponent <ActionScheduler>().CancelCurrentAction(); }
//konum noktasını yakaladığımız fonksiyon public object CaptureState() { //bir sözlük oluşturduk player konum ve rotasyonunu kaydederken //bu sözlükteki verileri ayrı ayrı işleyip kaydediyoruz MoverSaveData data = new MoverSaveData(); data.position = new SerializableVector3(transform.position); data.rotation = new SerializableVector3(transform.eulerAngles); //Konum vektörü Serializable return(data); }
public object CaptureState() { #region OPTION ONE //Dictionary<string, object> data1 = new Dictionary<string, object>(); //data1["POS"] = new SerializableVector3(transform.position); //data1["ROT"] = new SerializableVector3(transform.eulerAngles); #endregion //OR MoverSaveData data2 = new MoverSaveData(); data2.POS = new SerializableVector3(transform.position); data2.ROT = new SerializableVector3(transform.eulerAngles); return(data2); }
public void RestoreState(object state) { MoverSaveData data = (MoverSaveData)state; GetComponent <NavMeshAgent>().enabled = false; transform.position = data.position.ToVector(); transform.eulerAngles = data.rotation.ToVector(); GetComponent <NavMeshAgent>().enabled = true; // Dictionary<string, object> data = (Dictionary<string, object>)state; // GetComponent<NavMeshAgent>().enabled = false; // transform.position = ((SerializableVector3)data["position"]).ToVector(); // transform.eulerAngles = ((SerializableVector3)data["rotation"]).ToVector(); // GetComponent<NavMeshAgent>().enabled = true; }
public object CaptureState() { MoverSaveData data = new MoverSaveData(); data.position = new SerializableVector3(transform.position); data.rotation = new SerializableVector3(transform.eulerAngles); return(data); // initial method // Dictionary<string, object> data = new Dictionary<string, object>(); // data["position"] = new SerializableVector3(transform.position); // data["rotation"] = new SerializableVector3(transform.eulerAngles); // return data; }
public void RestoreState(object state) { #region OPTION ONE /* * Dictionary<string, object> data1 = (Dictionary<string, object>)state; * Vector3 newPos = ((SerializableVector3)data1["POS"]).ToVector(); * Vector3 newEulerAngles = ((SerializableVector3)data1["ROT"]).ToVector(); * GetComponent<NavMeshAgent>().Warp(newPos); * transform.eulerAngles = newEulerAngles; */ #endregion //OR MoverSaveData data2 = (MoverSaveData)state; GetComponent <NavMeshAgent>().Warp(data2.POS.ToVector()); transform.eulerAngles = data2.ROT.ToVector(); }