Esempio n. 1
0
        public void RestoreState(object state)
        {
            MoverSaveData data = (MoverSaveData)state;

            GetComponent <NavMeshAgent>().Warp(data.position.ToVector());
            transform.eulerAngles = data.rotation.ToVector();
        }
Esempio n. 2
0
        public object CaptureState()
        {
            MoverSaveData data = new MoverSaveData();

            data.position = new SerializableVector3(transform.position);
            data.rotation = new SerializableVector3(transform.eulerAngles);
            return(data);
        }
Esempio n. 3
0
        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;
        }
Esempio n. 4
0
        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;
        }
Esempio n. 5
0
        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();
        }
Esempio n. 6
0
        // 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);
        }
Esempio n. 7
0
        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);
        }
Esempio n. 8
0
        //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();
        }
Esempio n. 9
0
        //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);
        }
Esempio n. 10
0
        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);
        }
Esempio n. 11
0
        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;
        }
Esempio n. 12
0
        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;
        }
Esempio n. 13
0
        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();
        }