Exemplo n.º 1
0
        public void Execute(GameTime gameTime, ITransform transform, Vector2 richting, SoundEffect jump)
        {
            if (richting.X == 1 || richting.X == -1)
            {
                // snelheid beweging //
                richting          *= new Vector2(5, 0);
                transform.positie += richting;
            }
            // Go up //
            transform.positie += snelheid;
            if (richting.Y == -1 && !spring)
            {
                transform.positie = new Vector2(transform.positie.X, transform.positie.Y - 10f);
                snelheid          = new Vector2(0, -5f);
                jump.Play();
                spring = true;
            }
            if (spring)
            {
                // hoe snel gaan we down //
                snelheid += new Vector2(0, 0.15f);
            }
            else
            {
                snelheid = new Vector2(0, 0);
            }

            if (transform.positie.Y > grenswaarde)
            {
                spring = false;
            }
        }
Exemplo n.º 2
0
        void t_Tick(object sender, EventArgs e)
        {
            Random r = new Random();
            int    i = 0;

            foreach (IRenderModelPoint rmp in list)
            {
                //System.Threading.Thread.Sleep(2);
                int n = r.Next(100);
                if (n > 80)
                {
                    rmp.Highlight(System.Drawing.Color.Red);
                }
                else if (n > 40 && n <= 80)
                {
                    rmp.Highlight(System.Drawing.Color.Yellow);
                }
                else
                {
                    rmp.Highlight(System.Drawing.Color.Blue);
                }
                IModelPoint modelPoint = rmp.GetFdeGeometry() as IModelPoint;
                modelPoint.FromMatrix(MatrixList[i]);
                i++;
                ITransform tf = modelPoint as ITransform;
                tf.Scale3D(1, 1, n, modelPoint.Envelope.Center.X, modelPoint.Envelope.Center.Y, modelPoint.Envelope.MinZ);
                IModelPoint newModelPoint = tf as IModelPoint;
                rmp.SetFdeGeometry(newModelPoint);
            }
        }
Exemplo n.º 3
0
 public FakeGameObject(ITransform transform, TestUpdatableManager manager)
     : base(transform)
 {
     this.manager = manager;
     manager.RegisterGameobject(this);
     active = true;
 }
Exemplo n.º 4
0
 public void ApplyTransform(ITransform transform)
 {
     for (int i = 0; i < points.Count; i++)
     {
         points[i] = transform.Transform(points[i]);
     }
 }
Exemplo n.º 5
0
 public UnityGameObject(GameObject gameObject)
 {
     this.GameObject        = gameObject;
     this.bridge            = gameObject.AddComponent <UnityBridgeComponent>();
     this.bridge.GameObject = this;
     this.Transform         = gameObject.transform.ToUniject();
 }
Exemplo n.º 6
0
        public static Rect WorldToMap(Extent extent, ITransform transform)
        {
            Point min = transform.WorldToMap(extent.MinX, extent.MinY);
            Point max = transform.WorldToMap(extent.MaxX, extent.MaxY);

            return(new Rect(min.X, max.Y, max.X - min.X, min.Y - max.Y));
        }
Exemplo n.º 7
0
        public static bool TryTransform(IComponentContext ctx, IContext context, out ITransform transform)
        {
            transform = null;
            var success = true;

            if (ctx.IsRegisteredWithName <ITransform>(context.Operation.Method))
            {
                var t = ShouldRunTransform(ctx, context);

                foreach (var warning in t.Warnings())
                {
                    context.Warn(warning);
                }

                if (t.Errors().Any())
                {
                    foreach (var error in t.Errors())
                    {
                        context.Error(error);
                    }
                    success = false;
                }
                else
                {
                    transform = t;
                }
            }
            else
            {
                context.Error(string.Format("The {0} method used in the {1} field is not registered.", context.Operation.Method, context.Field.Alias));
                success = false;
            }
            return(success);
        }
        protected Intra16X16LumaAbstractPredictor(int x, int y, Macroblock macroblock, IAlgorithmFactory algorithms)
        {
            this.x = x;
            this.y = y;
            access = macroblock.MacroblockAccess;
            info = new MacroblockInfo(macroblock);
            transform = algorithms.CreateTransform();
            quantizer = algorithms.CreateQuantizer();
            distortion = algorithms.CreateDistortionMetric();
            scanner = algorithms.CreateScanner();
            mOrig = new int[mbHeight][];
            for (var i = 0; i < mOrig.Length; i++)
                mOrig[i] = new int[mbWidth];

            mResd = new int[mbHeight][];
            for (var i = 0; i < mResd.Length; i++)
                mResd[i] = new int[mbWidth];

            mPred = new int[mbHeight][];
            for (var i = 0; i < mPred.Length; i++)
                mPred[i] = new int[mbWidth];

            mDc = new int[dcHeight][];
            for (var i = 0; i < mDc.Length; i++)
                mDc[i] = new int[dcWidth];
        }
        public PolicyToResultTransform(double startingPremium,
                                       [NotNull] ITransform <IPolicy, RejectionMessageAndSuccess> policyToRejectionMessageAndSuccess,
                                       [NotNull] ITransform <DriverAndPremium, double> driversAndPremiumToUpdatedPremiumBasedOnOccupationTransform,
                                       [NotNull] ITransform <DriverAndPremium, double> driversAndPremiumToUpdatedPremiumBasedOnAgeTransform,
                                       [NotNull] ITransform <DriverAndPremium, double> driversAndPremiumToUpdatedPremiumBasedOnDriverClaimsTransform)
        {
            if (policyToRejectionMessageAndSuccess == null)
            {
                throw new ArgumentNullException(nameof(policyToRejectionMessageAndSuccess));
            }
            if (driversAndPremiumToUpdatedPremiumBasedOnOccupationTransform == null)
            {
                throw new ArgumentNullException(nameof(driversAndPremiumToUpdatedPremiumBasedOnOccupationTransform));
            }
            if (driversAndPremiumToUpdatedPremiumBasedOnAgeTransform == null)
            {
                throw new ArgumentNullException(nameof(driversAndPremiumToUpdatedPremiumBasedOnAgeTransform));
            }
            if (driversAndPremiumToUpdatedPremiumBasedOnDriverClaimsTransform == null)
            {
                throw new ArgumentNullException(nameof(driversAndPremiumToUpdatedPremiumBasedOnDriverClaimsTransform));
            }

            _startingPremium = startingPremium;
            _policyToRejectionMessageAndSuccess = policyToRejectionMessageAndSuccess;
            _driversAndPremiumToUpdatedPremiumBasedOnOccupationTransform   = driversAndPremiumToUpdatedPremiumBasedOnOccupationTransform;
            _driversAndPremiumToUpdatedPremiumBasedOnAgeTransform          = driversAndPremiumToUpdatedPremiumBasedOnAgeTransform;
            _driversAndPremiumToUpdatedPremiumBasedOnDriverClaimsTransform = driversAndPremiumToUpdatedPremiumBasedOnDriverClaimsTransform;
        }
Exemplo n.º 10
0
 public TransformWriter(Writer writer, ITransform transform)
     : base(writer.Settings, TextCase.KeepOriginal)
 {
     this.writer             = writer;
     this.transform          = transform;
     this.transform.Settings = this.Settings;
 }
Exemplo n.º 11
0
        public void ClosestTarget()
        {
            ITransform target       = null;
            IHealth    targetHealth = null;

            Target       = null;
            TargetHealth = null;
            foreach (var human in (Game1.currentLevel).humans)
            {
                if (human.Team != Team)                                                                                                             //Zal exception gooien als gemikt wordt op target dat niet human is
                {
                    if (target == null || Vector2.Distance(human.Position, Soldier.Position) < Vector2.Distance(target.Position, Soldier.Position)) //Target is dichtste enemy
                    {
                        target       = human;
                        targetHealth = human;
                    }
                }
            }
            Target       = target;
            TargetHealth = targetHealth;
            if (target == null)
            {
                Game1.gameOver = true;
            }
        }
Exemplo n.º 12
0
        public Expression Apply(ITransform transform)
        {
            var structVar = Expression.Variable(objectType, objectType.Name);
            var body      = new List <Expression>
            {
                Expression.Assign(structVar, Expression.Convert(objParam, objectType)),
                transform.Begin
            };

            var baseType = schemaType.GetBaseSchemaType();

            if (baseType != null)
            {
                var baseObject = Expression.Convert(structVar, objectType.GetBaseSchemaType());
                body.Add(transform.Base(new ObjectParser(this, baseObject, baseType)));
            }

            // Performs left outer join of object fields with transform fields.
            // The result contains entry for each schema field. For fields not handled
            // by the transform default to Skip.
            body.AddRange(
                from objectField in schemaType.GetSchemaFields()
                join transfromField in transform.Fields on objectField.Id equals transfromField.Id into fields
                from knownField in fields.DefaultIfEmpty()
                select Field(transform, structVar, objectField.Id, objectField, knownField));

            body.Add(transform.End);

            return(Expression.Block(
                       new [] { structVar },
                       body));
        }
        public void ApplyPhysic(ITransform transform)
        {
            float accX = transform.Velocity.X;
            float accY = transform.Velocity.Y;

            if (accX > Friction.X)
            {
                accX -= Friction.X;
            }
            else if (accX < -Friction.X)
            {
                accX += Friction.X;
            }
            else
            {
                accX = 0;
            }

            if (accY > Friction.Y)
            {
                accY -= Friction.Y;
            }
            else if (accY < -Friction.Y)
            {
                accY += Friction.Y;
            }
            else
            {
                accY = 0;
            }
            transform.Velocity = new Vector2(accX, accY);
        }
Exemplo n.º 14
0
        /// <summary>
        /// Run the query against the given document.
        /// </summary>
        /// <param name="document">The document to query.</param>
        /// <param name="transform">The transform containing the Query.</param>
        /// <returns>The list of matching nodes.</returns>
        public static IEnumerable<XElement> RunQuery(SrcMLFile document, ITransform transform)
        {
            if (null == document)
                throw new ArgumentNullException("document");

            return document.QueryEachUnit(transform);
        }
Exemplo n.º 15
0
        protected void RecalcMatrix()
        {
            ITransform transformThis = this as ITransform;
            Matrix     parentMatrix  = Matrix.Identity;

            transformThis.Recalc(ref parentMatrix);
        }
Exemplo n.º 16
0
        public override void OnDeserializeJson(JObject obj)
        {
            base.OnDeserializeJson(obj);

            JArray array = (JArray)obj["components"];

            foreach (JToken token in array)
            {
                if (token is JObject jObj)
                {
                    IComponent ins =
                        (IComponent)Activator.CreateInstance(
                            Type.GetType(Assembly.CreateQualifiedName(jObj["assembly"].Value <string>(),
                                                                      jObj["type"].Value <string>()), true));
                    ins.OnDeserializeJson(jObj);
                    AddComponent(ins);
                }
            }

            if (Transform != null)
            {
                RemoveComponent(Transform);
            }

            foreach (IComponent component in _attachedComponents.Values)
            {
                component.OnComponentInitialized();
            }

            Transform = GetComponentUnsafe <ITransform>(new Guid(obj["transform"].Value <string>())).Or(new Transform());
        }
Exemplo n.º 17
0
        /// <summary>
        /// Blends styles.
        /// </summary>
        public static Pen Merge(BorderStyle style1, BorderStyle style2, float weight,
                                out ITransform transform, out IMapper mapper)
        {
            if (style1 == null && style2 == null)
            {
                transform = null;
                mapper    = null;
                return(null);
            }
            if (style2 != null && style1 == null)
            {
                return(Merge(style2, style1, 1.0f - weight, out transform, out mapper));
            }

            if (style2 == null)
            {
                transform = style1.MappingTransform;
                mapper    = style1.Mapper;
                return(style1.Pen);
            }

            transform = BlendTransform.BlendTransforms(style1.MappingTransform,
                                                       style2.MappingTransform, weight);
            mapper = style1.Mapper;

            return(Pen.BlendPens(style1.Pen, style2.Pen, weight));
        }
Exemplo n.º 18
0
        private void DrawRecursive(Canvas canvas, TileSchema schema, ITransform transform, MemoryCache <MemoryStream> memoryCache, Extent extent, int level)
        {
            IList <TileInfo> tiles = schema.GetTilesInView(extent, level);

            foreach (TileInfo tile in tiles)
            {
                MemoryStream image = memoryCache.Find(tile.Index);
                if (image == null)
                {
                    if (level > 0)
                    {
                        DrawRecursive(canvas, schema, transform, memoryCache, tile.Extent.Intersect(extent), level - 1);
                    }
                }
                else
                {
                    Rect   dest    = MapTransformHelper.WorldToMap(tile.Extent, transform);
                    double opacity = DrawImage(canvas, image, dest, tile);
                    if ((opacity < 1) && (level > 0))
                    {
                        DrawRecursive(canvas, schema, transform, memoryCache, tile.Extent.Intersect(extent), level - 1);
                    }
                }
            }
        }
Exemplo n.º 19
0
        public ITransform CloneReverse()
        {
            ITransform t = Clone();

            t.Reverse();
            return(t);
        }
Exemplo n.º 20
0
 public ShapeCircle(IOwner owner, ITransform transform, ISceneView sceneView)
 {
   m_Owner = owner;
   m_SceneView = sceneView;
   m_Transform = new TransformWrapper(transform, this.SceneView);
   m_Children = new List<ShapeCircle>();
 }
Exemplo n.º 21
0
        public Expression Apply(ITransform transform)
        {
            Debug.Assert(schema.IsStruct);

            var body = new List <Expression>
            {
                transform.Begin
            };

            if (schema.HasBase)
            {
                body.Add(transform.Base(new UntaggedParser <R>(this, schema.GetBaseSchema())));
            }

            // Performs left outer join of schema fields with transform fields.
            // The result contains entry for each schema field. For fields not handled
            // by the transform default to Skip.
            body.AddRange(
                from fieldDef in schema.StructDef.fields
                join transfromField in transform.Fields on fieldDef.id equals transfromField.Id into fields
                from knownField in fields.DefaultIfEmpty()
                select Field(transform, fieldDef, knownField));

            body.Add(transform.End);
            return(Expression.Block(body));
        }
Exemplo n.º 22
0
        public Expression Apply(ITransform transform)
        {
            var structVar = Expression.Variable(objectType, objectType.Name);
            var body = new List<Expression>
            {
                Expression.Assign(structVar, Expression.Convert(objParam, objectType)),
                transform.Begin
            };

            var baseType = schemaType.GetBaseSchemaType();
            if (baseType != null)
            {
                var baseObject = Expression.Convert(structVar, objectType.GetBaseSchemaType());
                body.Add(transform.Base(new ObjectParser(this, baseObject, baseType)));
            }

            // Performs left outer join of object fields with transform fields.
            // The result contains entry for each schema field. For fields not handled 
            // by the transform default to Skip.
            body.AddRange(
                from objectField in schemaType.GetSchemaFields()
                join transfromField in transform.Fields on objectField.Id equals transfromField.Id into fields
                from knownField in fields.DefaultIfEmpty()
                select Field(transform, structVar, objectField.Id, objectField, knownField));

            body.Add(transform.End);
            
            return Expression.Block(
                new [] { structVar },
                body);
        }
Exemplo n.º 23
0
    public static void RotateToPoint(this ITransform trans, GridLocation loc, System.Random rand)
    {
        switch (loc)
        {
        case GridLocation.RIGHT:
        case GridLocation.LEFT:
            trans.YRotation = rand.NextBool() ? -90 : 90;
            break;

        case GridLocation.TOPRIGHT:
        case GridLocation.BOTTOMLEFT:
            trans.YRotation = rand.NextBool() ? 45 : -135;
            break;

        case GridLocation.BOTTOMRIGHT:
        case GridLocation.TOPLEFT:
            trans.YRotation = rand.NextBool() ? -45 : 135;
            break;

        case GridLocation.BOTTOM:
        case GridLocation.TOP:
            trans.YRotation = rand.NextBool() ? 0 : 180;
            break;
        }
    }
Exemplo n.º 24
0
    public static void SerializePose(Creature creature, List <ITransform> pose)
    {
        Stack.Clear();

        // Don't store root, we want to move it. Store children relative to root.
        for (int i = 0; i < creature.Root.Children.Count; i++)
        {
            Stack.Push(creature.Root.Children[i]);
        }

        Transform rootTrans = creature.Root.Transform;

        while (Stack.Count > 0)
        {
            var part = Stack.Pop();

            Vector3    localPos = rootTrans.InverseTransformPoint(part.Transform.position);
            Quaternion localRot = Quaternion.Inverse(rootTrans.rotation) * part.Transform.rotation;

            var trans = new ITransform(localPos, localRot);
            pose.Add(trans);

            for (int i = 0; i < part.Children.Count; i++)
            {
                Stack.Push(part.Children[i]);
            }
        }
    }
Exemplo n.º 25
0
        /// <summary>
        /// Given the .prj name (ESRI wkt), returns the matching transform
        /// </summary>
        /// <param name="name">The string name for the trnasform eg. Transverse_Mercator</param>
        /// <returns>The ITransform that has the matching ESRI wkt name</returns>
        public ITransform GetProjection(string name)
        {
            foreach (ITransform transform in _transforms)
            {
                string[] esriNames = transform.Name.Split(';');
                foreach (string esriName in esriNames)
                {
                    if (name == esriName)
                    {
                        ITransform copy = transform.Copy();
                        // kellison: The Name property in the copy can have multiples separated by semi-colons at this point.
                        //           If we call ToEsriString on the ProjectionInfo that includes this Transform,
                        //           the resulting PROJECTION[] will contain the multiples.  Not good.
                        //           So, we set the name here.  There may be a better way to do this.  In order to pull this off,
                        //           I had to make the Name setter public on ITransform and on Transform while none of the other
                        //           properties have public setters.  A better way may be to have a separate member to hold EsriAliases,
                        //           which was the approach for Proj4.  But, I didn't want to perturb the coordinate system world at this point.
                        copy.Name = name;
                        return(copy);
                    }
                }
            }

            throw new ProjectionException(37);
        }
Exemplo n.º 26
0
        private static Stream TransformStream(Stream stream, string mapName, bool validate, ref string messageType, ref string targetDocumentSpecName)
        {
            Type type = Type.GetType(mapName);

            if (null == type)
            {
                throw new Exception("Invalid MapType" + mapName);
            }

            TransformMetaData transformMetaData    = TransformMetaData.For(type);
            SchemaMetadata    sourceSchemaMetadata = transformMetaData.SourceSchemas[0];
            string            schemaName           = sourceSchemaMetadata.SchemaName;
            SchemaMetadata    targetSchemaMetadata = transformMetaData.TargetSchemas[0];

            if (validate && string.Compare(messageType, schemaName, false, CultureInfo.CurrentCulture) != 0)
            {
                throw new Exception("Source Document Mismatch. MessageType: " + messageType + " Schema Name: " + schemaName);
            }

            messageType            = targetSchemaMetadata.SchemaName;
            targetDocumentSpecName = targetSchemaMetadata.SchemaBase.GetType().AssemblyQualifiedName;

            XmlReader reader = XmlReader.Create(stream);

            XPathDocument input     = new XPathDocument(reader);
            ITransform    transform = transformMetaData.Transform;
            Stream        outStream = new MemoryStream();

            transform.Transform(input, transformMetaData.ArgumentList, outStream, new XmlUrlResolver());
            outStream.Flush();
            outStream.Seek(0L, SeekOrigin.Begin);
            return(outStream);
        }
Exemplo n.º 27
0
        public void Jumping(ITransform transform, bool CanDown, bool CanJump)
        {
            transform.Position += Velocity;

            //if (Keyboard.GetState().IsKeyDown(Keys.Right))
            //    Velocity.X = 3f;
            //else if (Keyboard.GetState().IsKeyDown(Keys.Left))
            //    Velocity.X = -3f;
            //else
            //    Velocity.X = 0f;

            if (Keyboard.GetState().IsKeyDown(Keys.Up) && Jumped == false)
            {
                transform.Position += new Vector2(0, -10);
                Velocity.Y          = -5f;
                Jumped              = true;
            }

            if (Jumped == true)
            {
                float i = 1;
                Velocity.Y += 0.15f * i;
            }
            if (transform.Position.Y >= 332 || CanDown == false)    //332 = grond level
            {
                Jumped = false;
            }
            if (Jumped == false)
            {
                Velocity.Y = 0f;
            }
        }
Exemplo n.º 28
0
 /// <summary>
 /// Transform all figures.
 /// </summary>
 /// <param name="circle"> Circle </param>
 /// <param name="cube"> Cube </param>
 /// <param name="pyramid"> Pyramid </param>
 private static void TransformAllFigures(ITransform circle,
                                         ITransform cube, ITransform pyramid)
 {
     circle.Transform(GetRandomNumber());
     cube.Transform(GetRandomNumber());
     pyramid.Transform(GetRandomNumber());
 }
Exemplo n.º 29
0
 public TransformWriter(Writer writer, ITransform transform, SerializationSettings settings)
     : base(settings, TextCase.KeepOriginal)
 {
     this.writer             = writer;
     this.transform          = transform;
     this.transform.Settings = this.Settings;
 }
Exemplo n.º 30
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="cmdTarget"></param>
        /// <returns></returns>
        public override bool Do(object cmdTarget)
        {
            bool       success      = false;
            INode      parentNode   = null;
            INode      curNode      = null;
            ITransform objTransform = null;

            try
            {
                parentNode = (INode)cmdTarget;

                IEnumerator nodeEnum = this.Nodes.GetEnumerator();

                while (nodeEnum.MoveNext())
                {
                    curNode = nodeEnum.Current as INode;
                    if (curNode != null)
                    {
                        objTransform = curNode as ITransform;
                        if (objTransform != null)
                        {
                            objTransform.Rotate(this.degrees);
                        }
                    }
                }

                success = true;
            }
            catch (Exception)
            {
            }

            return(success);
        }
Exemplo n.º 31
0
        protected override void OnPropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            string propertyName = e.PropertyName;

            switch (propertyName)
            {
            case "PreSizeEnable":
            case "PreSize":
            case "Size":
            case "Scale9Enable":
            case "LeftEage":
            case "RightEage":
            case "BottomEage":
            case "TopEage":
            case "IsCustomSize":
                this.SetControl();
                break;

            case "IsTransformEnabled":
            {
                ITransform transform = this._propertyItem.Instance as ITransform;
                if (transform != null)
                {
                    this.widget.SetMenuEnable(transform.IsTransformEnabled);
                }
                this._propertyItem.IsEnable = !transform.IsTransformEnabled;
                this.SetControl();
                break;
            }
            }
        }
Exemplo n.º 32
0
        private void addTransform(ITransform <T> transform)
        {
            if (transform == null)
            {
                throw new ArgumentNullException(nameof(transform));
            }

            if (Clock == null)
            {
                transform.UpdateTime(new FrameTimeInfo {
                    Current = transform.EndTime
                });
                transform.Apply(derivedThis);
                return;
            }

            Transforms.Add(transform);

            // If our newly added transform could have an immediate effect, then let's
            // make this effect happen immediately.
            if (transform.StartTime < Time.Current || transform.EndTime <= Time.Current)
            {
                updateTransforms();
            }
        }
Exemplo n.º 33
0
        private void addTransform(ITransform <T> transform)
        {
            if (Clock == null)
            {
                transform.UpdateTime(new FrameTimeInfo {
                    Current = transform.EndTime
                });
                transform.Apply(derivedThis);
                return;
            }

            //we have no duration and do not need to be delayed, so we can just apply ourselves and be gone.
            bool canApplyInstant = transform.Duration == 0 && TransformDelay == 0;

            //we should also immediately apply any transforms that have already started to avoid potentially applying them one frame too late.
            if (canApplyInstant || transform.StartTime < Time.Current)
            {
                transform.UpdateTime(Time);
                transform.Apply(derivedThis);
                if (canApplyInstant)
                {
                    return;
                }
            }

            Transforms.Add(transform);
        }
 public void ApplyPhysics(ITransform transform)
 {
     foreach (IPhysicComponent component in PhysicComponents)
     {
         component.ApplyPhysic(transform);
     }
 }
Exemplo n.º 35
0
        public OneForOneProjection(ITransform <TEvent, TView> transform)
        {
            _transform = transform;

            Consumes = new[] { typeof(TEvent) };
            Produces = typeof(TView);
        }
Exemplo n.º 36
0
 public bool CheckDistance(ITransform current, ITransform target, float distance)
 {
     //Debug.Log(Vector3.Distance(current.TransformBehaviour.Position, target.TransformBehaviour.Position));
     //Debug.Log(current.TransformBehaviour.Position + " " + target.TransformBehaviour.Position);
     return Vector3.Distance(current.TransformBehaviour.Position, target.TransformBehaviour.Position) <=
            distance;
 }
 public void SetMovePoint(ITransform position)
 {
     this.destination = position;
     if (isMoving)
     {
         navMeshAgent.SetDestination(destination.TransformBehaviour.Position);
     }
 }
 public ITransform CreateFromModifiedSRTTransform(ITransform existingTransform, Vector3 scaleFactor, Quaternion appliedRotation, Vector3 addedPosition)
 {
     var transform = new DefaultTransform();
     transform.LocalPosition = existingTransform.LocalPosition + addedPosition;
     transform.LocalRotation = existingTransform.LocalRotation * appliedRotation;
     transform.LocalScale = existingTransform.LocalScale * scaleFactor;
     return transform;
 }
Exemplo n.º 39
0
 public void Render(Canvas canvas, TileSchema schema, ITransform transform, MemoryCache<MemoryStream> cache, List<Marker> markerCache)
 {
     CollapseAll(canvas);
     int level = BruTile.Utilities.GetNearestLevel(schema.Resolutions, transform.Resolution);
     DrawRecursive(canvas, schema, transform, cache, transform.Extent, level);
     DrawMarkers(canvas, schema, transform, markerCache, transform.Extent, level);
     RemoveCollapsed(canvas);
 }
        protected override Shape GetShape(ITransform localTransform)
        {
            if (_length <= 0 || _radius <= 0)
            {
                throw new InvalidOperationException("Invalid length or radius.");
            }

            return new CapsuleShape(_length, _radius);
        }
        public void A_string_scanner_with_a_transformer()
        {
            transformer = Substitute.For<ITransform>();
            transformer.Transform('t').Returns('1');
            transformer.Transform('h').Returns('2');
            transformer.Transform('i').Returns('3');

            subject = new ScanStrings(Input) {Transform = transformer};
        }
Exemplo n.º 42
0
        public Transformer(ITransform transform, double[][][] arcs, IGeometryFactory factory)
        {
            if (transform == null)
                throw new ArgumentNullException("transform");

            _transform = transform;
            _arcs = BuildArcs(arcs);
            _factory = factory;
        }
Exemplo n.º 43
0
 public Collision(Vector3 relativeVelocity,
                  ITransform transform,
                  TestableGameObject gameObject,
                  ContactPoint[] contacts) : this() {
     this.relativeVelocity = relativeVelocity;
     this.transform = transform;
     this.gameObject = gameObject;
     this.contacts = contacts;
 }
    public void SetMovePoint(ITransform target)
    {
        TargetPoint = target;

        //model.StartSingleStateMachine(new UnitMoveState(model as IMovable, TargetPoint, new AnimatorHelper(null)));
        Navigation.SetMovePoint(TargetPoint);
        Navigation.StartMoving();
        OnSetMovePoint.TryCall();
    }
        private async Task TransformException(OwinContext context, ITransform transform, Exception ex)
        {
            string content = transform.GetContent(ex);

            context.Response.ContentType = "text/plain";
            context.Response.StatusCode = (int) transform.StatusCode;
            context.Response.ReasonPhrase = transform.ReasonPhrase;
            context.Response.ContentLength = content.Length;
            await context.Response.WriteAsync(content);
        }
Exemplo n.º 46
0
        public Expression Apply(ITransform transform)
        {
            pairs.Add(new TransformSchemaPair(transform, schema));

            if (schema.HasBase)
            {
                schema = schema.GetBaseSchema();
                transform.Base(this);
            }

            return Expression.Empty();
        }
Exemplo n.º 47
0
 public ShapeCircle(ShapeCircle parent, ITransform transform)
 {
   if(parent != null)
   {
     m_SceneView = parent.SceneView;
     parent.AddChild(this);
   }
   
   m_Owner = parent.Owner;
   m_Parent = parent;
   m_Transform = new TransformWrapper(transform, this.SceneView);
   m_Children = new List<ShapeCircle>();
 }
Exemplo n.º 48
0
 public void Assign(ITransform from)
 {
     if (from.IsSRTMatrix)
     {
         SetFromSRTMatrix(
             from.LocalPosition,
             from.LocalRotation,
             from.LocalScale);
         Modified?.Invoke(this, new EventArgs());
     }
     else
     {
         SetFromCustomMatrix(
             from.LocalMatrix);
         Modified?.Invoke(this, new EventArgs());
     }
 }
Exemplo n.º 49
0
        Expression Field(ITransform transform, Expression structVar, UInt16 id, ISchemaField schemaField, IField field)
        {
            var fieldSchemaType = schemaField.GetSchemaType();
            var fieldId = Expression.Constant(id);
            var fieldType = Expression.Constant(fieldSchemaType.GetBondDataType());
            var fieldValue = DataExpression.PropertyOrField(structVar, schemaField.Name);
            var parser = new ObjectParser(this, fieldValue, fieldSchemaType);

            var processField = field != null
                ? field.Value(parser, fieldType)
                : transform.UnknownField(parser, fieldType, fieldId) ?? Expression.Empty();

            var omitField = field != null
                ? field.Omitted : Expression.Empty();

            Expression cannotOmit;

            if (fieldSchemaType.IsBondStruct() || fieldSchemaType.IsBonded() || schemaField.GetModifier() != Modifier.Optional)
            {
                cannotOmit = Expression.Constant(true);
            }
            else
            {
                var defaultValue = schemaField.GetDefaultValue();

                if (fieldSchemaType.IsBondBlob())
                {
                    cannotOmit = Expression.NotEqual(
                        typeAlias.Convert(fieldValue, fieldSchemaType), 
                        Expression.Default(typeof(ArraySegment<byte>)));
                }
                else if (fieldSchemaType.IsBondContainer())
                {
                    cannotOmit = defaultValue == null
                        ? Expression.NotEqual(fieldValue, Expression.Constant(null))
                        : Expression.NotEqual(ContainerCount(fieldValue), Expression.Constant(0));
                }
                else
                {
                    cannotOmit = Expression.NotEqual(fieldValue, Expression.Constant(defaultValue));
                }
            }

            return PrunedExpression.IfThenElse(cannotOmit, processField, omitField);
        }
Exemplo n.º 50
0
		public void ProcessProjects(IRename rename, ITransform transform)
		{
			var nameTransform = new NameTransform(rename);
			var fullTransform = new CompositeTransform(transform, nameTransform);
			string basePath = Path.GetDirectoryName(path);
			foreach (var project in projects.Where(p => !p.IsFolder))
			{
				var projectPath = Path.Combine(basePath, project.Path);
				var document = new XmlDocument();
				document.Load(projectPath);
				fullTransform.ApplyTransform(projectPath, document);
				project.Name = rename.RenameSolutionProjectName(project.Name);
				project.Path = rename.RenameCsproj(project.Path);
                document.Save(rename.RenameCsproj(projectPath));
				// Note that projectPath and project.Path have different values....
			}
			Save(rename.RenameSln(path));
		}
Exemplo n.º 51
0
        public void DeserializeFromNetwork(ITransform target)
        {
            if (IsSRTMatrix)
            {
                var pos = SRTLocalPosition ?? new float[3];
                var rot = SRTLocalRotation ?? new float[4];
                var scale = SRTLocalScale ?? new float[3];

                target.SetFromSRTMatrix(
                    new Vector3(pos[0], pos[1], pos[2]),
                    new Quaternion(rot[0], rot[1], rot[2], rot[3]),
                    new Vector3(scale[0], scale[1], scale[2]));
            }
            else
            {
                var mat = CustomLocalMatrix ?? new float[16];
                
                target.SetFromCustomMatrix(new Matrix(
                    mat[0], mat[1], mat[2], mat[3],
                    mat[4], mat[5], mat[6], mat[7],
                    mat[8], mat[9], mat[10], mat[11],
                    mat[12], mat[13], mat[14], mat[15]));
            }
        }
Exemplo n.º 52
0
        public void Transform(IRename rename, IProjectFilter filter, ITransform transform)
		{
			FilterProjects(filter);
			ProcessProjects(rename, transform);
		}
Exemplo n.º 53
0
 public void transformer(ITransform InTransform)
 {
     m_Transform = InTransform;
 }
 protected override Shape GetShape(ITransform localTransform)
 {
     return new BoxShape(localTransform.LocalScale.ToJitterVector());
 }
Exemplo n.º 55
0
 /// <summary>
 /// Runs the transform against the list of elements.
 /// </summary>
 /// <param name="elements">The elements to transform.</param>
 /// <param name="transform">The transform containing the <see cref="ITransform.Transform"/>.</param>
 /// <returns>The list of transformed nodes.</returns>
 public static IEnumerable<XElement> RunTransform(IEnumerable<XElement> elements, ITransform transform)
 {
     foreach (var e in elements)
         yield return transform.Transform(new XElement(e));
 }
Exemplo n.º 56
0
 public void Initialize(int health, ITransform currentTransform)
 {
     CurrentTransform = currentTransform;
     Health = health;
     IsAlive = Health > 0;
 }
Exemplo n.º 57
0
 /// <summary>
 /// Works in conjunction with <see cref="AbstractDocument.FileUnits"/> to execute a query against each file in a SrcML document
 /// </summary>
 /// <param name="transform">The transform object with the <see cref="ITransform.Query"/></param>
 /// <returns>yields each node that matches the query in <paramref name="transform"/></returns>
 public IEnumerable<XElement> QueryEachUnit(ITransform transform)
 {
     foreach (var unit in this.FileUnits)
     {
         foreach (var result in transform.Query(unit))
             yield return result;
     }
 }
Exemplo n.º 58
0
 public void Draw(SpriteBatch batch, ITransform transform, Color color, SpriteEffects effects = SpriteEffects.None, float depth = 0)
 {
     batch.Draw(Texture, transform.Position, TextureRect, color, transform.Rotation, transform.Origin, transform.Scale, effects, depth);
 }
Exemplo n.º 59
0
 public void Register(ITransform transformer) {
     _pipeline.Register(transformer);
 }
Exemplo n.º 60
0
 public conv_transform(IVertexSource VertexSource, ITransform InTransform)
 {
     m_VertexSource = VertexSource;
     m_Transform = InTransform;
 }