示例#1
0
        public void DeSerializeSettings(AstarSerializer serializer)
        {
            System.IO.BinaryReader stream = serializer.readerStream;

            offset   = (Vector3)serializer.GetValue("offset", typeof(Vector3));
            rotation = (Vector3)serializer.GetValue("rotation", typeof(Vector3));
            scale    = (float)serializer.GetValue("scale", typeof(float));

            GenerateMatrix();

            Vector3[] verts = new Vector3[stream.ReadInt32()];
            int[]     tris  = new int[stream.ReadInt32()];

            for (int i = 0; i < verts.Length; i++)
            {
                verts[i] = new Vector3(stream.ReadSingle(), stream.ReadSingle(), stream.ReadSingle());
            }

            for (int i = 0; i < tris.Length; i++)
            {
                tris[i] = stream.ReadInt32();
            }

            sourceMesh = serializer.GetUnityReferenceValue("sourceMesh", typeof(Mesh)) as Mesh;

            if (Application.isPlaying)
            {
                sourceMesh           = new Mesh();
                sourceMesh.name      = "NavGraph Mesh";
                sourceMesh.vertices  = verts;
                sourceMesh.triangles = tris;
            }
        }
示例#2
0
        public void DeSerializeSettings(AstarSerializer serializer)
        {
            root = (Transform)serializer.GetUnityReferenceValue("root", typeof(Transform));

            maxDistance        = (float)serializer.GetValue("maxDistance", typeof(float));
            limits             = (Vector3)serializer.GetValue("limits", typeof(Vector3));
            mask.value         = (int)serializer.GetValue("mask", typeof(int));
            thickRaycast       = (bool)serializer.GetValue("thickRaycast", typeof(bool));
            thickRaycastRadius = (float)serializer.GetValue("thickRaycastRadius", typeof(float));
            searchTag          = (string)serializer.GetValue("searchTag", typeof(string));
            recursive          = (bool)serializer.GetValue("recursive", typeof(bool));
        }
示例#3
0
		public void DeSerializeSettings (AstarSerializer serializer) {
			
			root = (Transform)serializer.GetUnityReferenceValue ("root",typeof(Transform));
			
			maxDistance = (float)serializer.GetValue ("maxDistance",typeof(float));
			limits = (Vector3)serializer.GetValue ("limits",typeof(Vector3));
			mask.value = (int)serializer.GetValue ("mask",typeof(int));
			thickRaycast = (bool)serializer.GetValue ("thickRaycast",typeof(bool));
			thickRaycastRadius = (float)serializer.GetValue ("thickRaycastRadius",typeof(float));
			searchTag = (string)serializer.GetValue ("searchTag",typeof(string));
			recursive = (bool)serializer.GetValue ("recursive",typeof(bool));
			raycast	  = (bool)serializer.GetValue ("raycast",typeof(bool),true);
		}
示例#4
0
            public void DeSerializeSettings(AstarSerializer serializer)
            {
                enabled = (bool)serializer.GetValue ("enabled",typeof(bool));
                source = (Texture2D)serializer.GetUnityReferenceValue ("source",typeof(Texture2D));
                factors = new float[3];
                for (int i=0;i<factors.Length;i++) {
                    factors[i] = (float)serializer.GetValue ("factor"+i,typeof(float),1F);
                }

                channels = new ChannelUse[3];
                for (int i=0;i<channels.Length;i++) {
                    channels[i] = (ChannelUse)serializer.GetValue ("channel"+i,typeof(int));
                }
            }
		public void DeSerializeSettings (AstarSerializer serializer) {
			
			System.IO.BinaryReader stream = serializer.readerStream;
			
			offset = (Vector3)serializer.GetValue ("offset",typeof(Vector3));
			rotation = (Vector3)serializer.GetValue ("rotation",typeof(Vector3));
			scale = (float)serializer.GetValue ("scale",typeof(float));
			
			GenerateMatrix ();
			
			Vector3[] verts = new Vector3[stream.ReadInt32 ()];
			int[] tris = new int[stream.ReadInt32 ()];
			
			for (int i=0;i<verts.Length;i++) {
				verts[i] = new Vector3(stream.ReadSingle (),stream.ReadSingle (),stream.ReadSingle ());
			}
				
			for (int i=0;i<tris.Length;i++) {
				tris[i] = stream.ReadInt32 ();
			}
			
			sourceMesh = serializer.GetUnityReferenceValue ("sourceMesh",typeof(Mesh)) as Mesh;
			
			if (Application.isPlaying) {
				sourceMesh = new Mesh ();
				sourceMesh.name = "NavGraph Mesh";
				sourceMesh.vertices = verts;
				sourceMesh.triangles = tris;
			}
		}