コード例 #1
0
        /**
         * <summary>Deserialises a string of data, and restores the GameObject to its previous state.</summary>
         * <param name = "stringData">The data, serialised as a string</param>
         */
        public override void LoadData(string stringData)
        {
            ShapeableData data = Serializer.LoadScriptData <ShapeableData> (stringData);

            if (data == null)
            {
                return;
            }

            if (GetComponent <Shapeable>())
            {
                Shapeable shapeable = GetComponent <Shapeable>();

                int[]   activeKeyIDs = StringToIntArray(data._activeKeyIDs);
                float[] values       = StringToFloatArray(data._values);

                for (int i = 0; i < activeKeyIDs.Length; i++)
                {
                    if (values.Length > i)
                    {
                        shapeable.shapeGroups[i].SetActive(activeKeyIDs[i], values[i], 0f, MoveMethod.Linear, null);
                    }
                }
            }
        }
コード例 #2
0
        public override string SaveData()
        {
            ShapeableData shapeableData = new ShapeableData();

            shapeableData.objectID      = constantID;
            shapeableData.savePrevented = savePrevented;

            Shapeable shapeable = GetComponent <Shapeable>();

            if (shapeable != null)
            {
                List <int>   activeKeyIDs = new List <int>();
                List <float> values       = new List <float>();

                foreach (ShapeGroup shapeGroup in shapeable.shapeGroups)
                {
                    activeKeyIDs.Add(shapeGroup.GetActiveKeyID());
                    values.Add(shapeGroup.GetActiveKeyValue());
                }

                shapeableData._activeKeyIDs = ArrayToString <int> (activeKeyIDs.ToArray());
                shapeableData._values       = ArrayToString <float> (values.ToArray());
            }

            return(Serializer.SaveScriptData <ShapeableData> (shapeableData));
        }
コード例 #3
0
		public void LoadData (ShapeableData data)
		{
			if (GetComponent <Shapeable>())
			{
				Shapeable shapeable = GetComponent <Shapeable>();

				for (int i=0; i<data.activeKeyIDs.Count; i++)
				{
					shapeable.shapeGroups[i].SetActive (data.activeKeyIDs[i], data.values[i], 0f, MoveMethod.Linear, null);
				}
			}
		}
コード例 #4
0
		public ShapeableData SaveData ()
		{
			ShapeableData shapeableData = new ShapeableData();
			shapeableData.objectID = constantID;
			
			if (GetComponent <Shapeable>())
			{
				Shapeable shapeable = GetComponent <Shapeable>();
				shapeableData.activeKeyIDs = new List<int>();
				shapeableData.values = new List<float>();
				
				foreach (ShapeGroup shapeGroup in shapeable.shapeGroups)
				{
					shapeableData.activeKeyIDs.Add (shapeGroup.GetActiveKeyID ());
					shapeableData.values.Add (shapeGroup.GetActiveKeyValue ());
				}
			}

			return (shapeableData);
		}
コード例 #5
0
        public override string SaveData()
        {
            ShapeableData shapeableData = new ShapeableData();
            shapeableData.objectID = constantID;

            if (GetComponent <Shapeable>())
            {
                Shapeable shapeable = GetComponent <Shapeable>();
                List<int> activeKeyIDs = new List<int>();
                List<float> values = new List<float>();

                foreach (ShapeGroup shapeGroup in shapeable.shapeGroups)
                {
                    activeKeyIDs.Add (shapeGroup.GetActiveKeyID ());
                    values.Add (shapeGroup.GetActiveKeyValue ());
                }

                shapeableData._activeKeyIDs = ArrayToString <int> (activeKeyIDs.ToArray ());
                shapeableData._values = ArrayToString <float> (values.ToArray ());
            }

            return Serializer.SaveScriptData <ShapeableData> (shapeableData);
        }