changeset 2:ca28bf83fc89

Add ConvertObject
author Kazuma
date Mon, 07 Nov 2016 02:05:00 +0900
parents ec859f6ce63b
children 2dd40b4412e4
files Assets/Application/Scenes/main.unity Assets/Application/Scripts/ConvertObject.cs Assets/Application/Scripts/ConvertObject.cs.meta Assets/jungle-sharp.meta
diffstat 4 files changed, 40 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/Assets/Application/Scenes/main.unity	Mon Nov 07 00:45:35 2016 +0900
+++ b/Assets/Application/Scenes/main.unity	Mon Nov 07 02:05:00 2016 +0900
@@ -145,7 +145,7 @@
   m_Height: 2
   m_Radius: 0.5
   m_SlopeLimit: 45
-  m_StepOffset: 0.3
+  m_StepOffset: 1
   m_SkinWidth: 0.08
   m_MinMoveDistance: 0.001
   m_Center: {x: 0, y: 0, z: 0}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Assets/Application/Scripts/ConvertObject.cs	Mon Nov 07 02:05:00 2016 +0900
@@ -0,0 +1,26 @@
+using UnityEngine;
+using System.Collections;
+using System;
+using System.Runtime.Serialization.Formatters.Binary;
+using System.IO;
+public class ConvertObject : MonoBehaviour {
+
+	public static byte[] Convert (object target) {
+		BinaryFormatter bf = new BinaryFormatter();
+		using (var ms = new MemoryStream())
+		{
+			bf.Serialize(ms, target);
+			return ms.ToArray();
+		}
+	}
+
+	public static object UnConvert(byte[] target) {
+		using (var memStream = new MemoryStream())
+		{
+			var binForm = new BinaryFormatter();
+			memStream.Write(target, 0, target.Length);
+			memStream.Seek(0, SeekOrigin.Begin);
+			return binForm.Deserialize(memStream) as object;
+		}
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Assets/Application/Scripts/ConvertObject.cs.meta	Mon Nov 07 02:05:00 2016 +0900
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: f7fd35791c1034f51871065c4525e4a9
+timeCreated: 1478450159
+licenseType: Free
+MonoImporter:
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 
--- a/Assets/jungle-sharp.meta	Mon Nov 07 00:45:35 2016 +0900
+++ b/Assets/jungle-sharp.meta	Mon Nov 07 02:05:00 2016 +0900
@@ -1,7 +1,7 @@
 fileFormatVersion: 2
 guid: 3a1d9219ce0684237b9c7d89e12240c5
 folderAsset: yes
-timeCreated: 1478444950
+timeCreated: 1478448102
 licenseType: Free
 DefaultImporter:
   userData: