Ejemplo n.º 1
0
        void EmitEvaluationModeWidget(SCRuleNode node)
        {
            if (node.constraints.Length <= 1)
            {
                // We have too few rules. No need to show this
                return;
            }

            EditorGUILayout.PropertyField(constraintEvaluationMode);
        }
Ejemplo n.º 2
0
        public static Vector3 GetRuleNodeWorldPosition(SCRuleNode ruleNode, SCReferenceNode referenceNode, PropSocket marker, Vector3 gridSize, ref Matrix4x4 rotationFrame)
        {
            var scGraph = ruleNode.Graph as SpatialConstraintGraph;
            var relativeToMarkerRotation = scGraph.asset.checkRelativeToMarkerRotation;

            var markerTransform = marker.Transform;

            Vector2 offset2D = (ruleNode.Bounds.center - referenceNode.Bounds.center) / SCBaseDomainNode.TileSize;
            Vector3 offset   = new Vector3(offset2D.x, 0, offset2D.y);

            if (relativeToMarkerRotation)
            {
                offset = RotateVector(offset, markerTransform);
            }
            offset = RotateVector(offset, rotationFrame);

            // Find the world position of the marker and the location to search (relative to the spatial constraint node from the SC reference node)
            var baseMarkerPosition = Matrix.GetTranslation(ref marker.Transform);
            var ruleNodePosition   = baseMarkerPosition + Vector3.Scale(offset, gridSize);

            return(ruleNodePosition);
        }