Esempio n. 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;
            }
        }
Esempio n. 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));
            raycast            = (bool)serializer.GetValue("raycast", typeof(bool), true);
        }
Esempio n. 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);
		}
        public new void DeSerializeSettings(AstarSerializer serializer)
        {
            (this as GridGraph).DeSerializeSettings (serializer);

            mergeSpanRange = 	(float)serializer.GetValue ("mergeSpanRange",typeof(float),mergeSpanRange);
            characterHeight = 	(float)serializer.GetValue ("characterHeight",typeof(float),characterHeight);
            //maxClimb = 			(float)serializer.GetValue ("maxClimb",typeof(float),maxClimb);
        }
Esempio n. 5
0
        /** \copydoc Pathfinding::ISerializableObject::DeSerializeSettings */
        public void DeSerializeSettings(AstarSerializer serializer)
        {
            mask.value   = (int)serializer.GetValue("Mask", typeof(int));
            diameter     = (float)serializer.GetValue("Diameter", typeof(float));
            height       = (float)serializer.GetValue("Height", typeof(float));
            type         = (ColliderType)serializer.GetValue("Type", typeof(int));
            rayDirection = (RayDirection)serializer.GetValue("RayDirection", typeof(int));

            heightMask.value     = (int)serializer.GetValue("heightMask", typeof(int), -1);
            fromHeight           = (float)serializer.GetValue("fromHeight", typeof(float), 100.0F);
            thickRaycastDiameter = (float)serializer.GetValue("thickRaycastDiameter", typeof(float));
            thickRaycast         = (bool)serializer.GetValue("thickRaycast", typeof(bool));

            collisionCheck = (bool)serializer.GetValue("collisionCheck", typeof(bool), true);
            heightCheck    = (bool)serializer.GetValue("heightCheck", typeof(bool), true);

            unwalkableWhenNoGround = (bool)serializer.GetValue("unwalkableWhenNoGround", typeof(bool), true);

            collisionOffset = (float)serializer.GetValue("collisionOffset", typeof(float), 0.0F);

            if (fromHeight == 0)
            {
                fromHeight = 100;
            }
        }
Esempio n. 6
0
        public void DeSerializeSettings(AstarSerializer serializer)
        {
            //width = (int)serializer.GetValue ("Width",typeof(int));
            //depth = (int)serializer.GetValue ("Depth",typeof(int));
            //height = (float)serializer.GetValue ("Height",typeof(float));

            unclampedSize = (Vector2)serializer.GetValue ("unclampedSize",typeof(Vector2));

            cutCorners = (bool)serializer.GetValue ("cutCorners",typeof(bool));
            neighbours = (NumNeighbours)serializer.GetValue ("neighbours",typeof(int));

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

            nodeSize = (float)serializer.GetValue ("nodeSize",typeof(float));

            collision = (GraphCollision)serializer.GetValue ("collision",typeof(GraphCollision));

            center = (Vector3)serializer.GetValue ("center",typeof(Vector3));

            maxClimb = (float)serializer.GetValue ("maxClimb",typeof(float));
            maxClimbAxis = (int)serializer.GetValue ("maxClimbAxis",typeof(int),1);
            maxSlope = (float)serializer.GetValue ("maxSlope",typeof(float),90.0F);

            erodeIterations = (int)serializer.GetValue ("erodeIterations",typeof(int));

            penaltyAngle = 			(bool)serializer.GetValue ("penaltyAngle",typeof(bool));
            penaltyAngleFactor = 	(float)serializer.GetValue ("penaltyAngleFactor",typeof(float));
            penaltyPosition = 		(bool)serializer.GetValue ("penaltyPosition",typeof(bool));
            penaltyPositionOffset = (float)serializer.GetValue ("penaltyPositionOffset",typeof(float));
            penaltyPositionFactor = (float)serializer.GetValue ("penaltyPositionFactor",typeof(float));

            aspectRatio = (float)serializer.GetValue ("aspectRatio",typeof(float),1F);

            textureData			=	serializer.GetValue ("textureData",typeof(TextureData)) as TextureData;
            if (textureData == null) textureData = new TextureData ();

            #if UNITY_EDITOR
            Matrix4x4 oldMatrix = matrix;
            #endif

            GenerateMatrix ();
            SetUpOffsetsAndCosts ();

            #if UNITY_EDITOR
            if (serializer.onlySaveSettings) {
                if (oldMatrix != matrix && nodes != null) {
                    AstarPath.active.AutoScan ();
                }
            }
            #endif

            //Debug.Log ((string)serializer.GetValue ("SomeString",typeof(string)));
            //Debug.Log ((Bounds)serializer.GetValue ("SomeBounds",typeof(Bounds)));
        }
Esempio n. 7
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));
                }
            }
Esempio n. 8
0
        public void DeSerializeSettings (NavGraph target, AstarSerializer serializer) {
        pivot = (GridPivot)serializer.GetValue ("pivot",typeof(int),GridPivot.BottomLeft);
        locked = (bool)serializer.GetValue ("locked",typeof(bool),true);
        showExtra = (bool)serializer.GetValue ("showExtra",typeof(bool));

        }
		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;
			}
		}
Esempio n. 10
0
        /** \copydoc Pathfinding::ISerializableObject::DeSerializeSettings */
        public void DeSerializeSettings(AstarSerializer serializer)
        {
            mask.value = (int)serializer.GetValue ("Mask",typeof (int));
            diameter = (float)serializer.GetValue ("Diameter",typeof (float));
            height = (float)serializer.GetValue ("Height",typeof (float));
            type = (ColliderType)serializer.GetValue ("Type",typeof(int));
            rayDirection = (RayDirection)serializer.GetValue ("RayDirection",typeof(int));

            heightMask.value = (int)serializer.GetValue ("heightMask",typeof (int),-1);
            fromHeight = (float)serializer.GetValue ("fromHeight",typeof (float), 100.0F);
            thickRaycastDiameter = (float)serializer.GetValue ("thickRaycastDiameter",typeof (float));
            thickRaycast = (bool)serializer.GetValue ("thickRaycast",typeof (bool));

            collisionCheck = (bool)serializer.GetValue ("collisionCheck",typeof(bool),true);
            heightCheck = (bool)serializer.GetValue ("heightCheck",typeof(bool),true);

            unwalkableWhenNoGround = (bool)serializer.GetValue ("unwalkableWhenNoGround",typeof(bool),true);

            collisionOffset = (float)serializer.GetValue ("collisionOffset",typeof(float),0.0F);

            if (fromHeight == 0) fromHeight = 100;
        }
Esempio n. 11
0
		public void DeSerializeSettings (AstarSerializer serializer) {
			//erosionRadius = (int)serializer.GetValue ("erosionRadius",typeof(int));
			contourMaxError = (float)serializer.GetValue ("contourMaxError",typeof(float));
			
			cellSize = (float)serializer.GetValue ("cellSize",typeof(float));
			cellHeight = (float)serializer.GetValue ("cellHeight",typeof(float));
			walkableHeight = (float)serializer.GetValue ("walkableHeight",typeof(float));
			walkableClimb = (float)serializer.GetValue ("walkableClimb",typeof(float));
			maxSlope = (float)serializer.GetValue ("maxSlope",typeof(float));
			maxEdgeLength = (float)serializer.GetValue ("maxEdgeLength",typeof(float));
			
			forcedBoundsCenter = (Vector3)serializer.GetValue ("forcedBoundsCenter",typeof(Vector3));
			forcedBoundsSize = (Vector3)serializer.GetValue ("forcedBoundsSize",typeof(Vector3));
			
			mask.value = (int)serializer.GetValue ("mask",typeof(int));
			
			showMeshOutline = (bool)serializer.GetValue ("showMeshOutline",typeof(bool));
			
			includeOutOfBounds = (bool)serializer.GetValue ("includeOutOfBounds",typeof(bool));
			
			regionMinSize = (int)serializer.GetValue ("regionMinSize",typeof(int));
			characterRadius = (float)serializer.GetValue ("characterRadius",typeof(float));
			useCRecast = (bool)serializer.GetValue ("useCRecast",typeof(bool));
		}
Esempio n. 12
0
 public new void DeSerializeSettings(AstarSerializer serializer)
 {
     base.DeSerializeSettings(serializer);
     levelLayerMask.value = (int)serializer.GetValue("levelLayerMask", typeof(int));
 }
Esempio n. 13
0
        public void DeSerializeSettings(AstarSerializer serializer)
        {
            //erosionRadius = (int)serializer.GetValue ("erosionRadius",typeof(int));
            contourMaxError = (float)serializer.GetValue("contourMaxError", typeof(float));

            cellSize       = (float)serializer.GetValue("cellSize", typeof(float));
            cellHeight     = (float)serializer.GetValue("cellHeight", typeof(float));
            walkableHeight = (float)serializer.GetValue("walkableHeight", typeof(float));
            walkableClimb  = (float)serializer.GetValue("walkableClimb", typeof(float));
            maxSlope       = (float)serializer.GetValue("maxSlope", typeof(float));
            maxEdgeLength  = (float)serializer.GetValue("maxEdgeLength", typeof(float));

            forcedBoundsCenter = (Vector3)serializer.GetValue("forcedBoundsCenter", typeof(Vector3));
            forcedBoundsSize   = (Vector3)serializer.GetValue("forcedBoundsSize", typeof(Vector3));

            mask.value = (int)serializer.GetValue("mask", typeof(int));

            showMeshOutline = (bool)serializer.GetValue("showMeshOutline", typeof(bool));

            includeOutOfBounds = (bool)serializer.GetValue("includeOutOfBounds", typeof(bool));

            regionMinSize   = (int)serializer.GetValue("regionMinSize", typeof(int));
            characterRadius = (float)serializer.GetValue("characterRadius", typeof(float));
            useCRecast      = (bool)serializer.GetValue("useCRecast", typeof(bool));
        }