Exemple #1
0
        void moveEntity(ent.EntityId id)
        {
            var(tx, entOpt) = m_db.checkout(id);

            using ( tx )
            {
                if (!entOpt.HasValue)
                {
                    return;
                }

                var ent = entOpt.ValueOr((ent.Entity)null);

                var physOpt = ent.com <ent.ComPhysics>();

                physOpt.Match((phys) => {
                    // TODO METRICS

                    var scaledVel = Vec.Multiply(phys.vel, 1.0f / 60.0f);

                    var newPos = Vec.Add(phys.pos, scaledVel);

                    var newPosOpt = newPos.Value.Some();

                    var newPhys = phys.with(posOpt: newPosOpt);

                    //var newComs = ent.m_coms.Replace( phys, newPhys )

                    //ent.with()
                },
                              () => {
                    // TODO METRICS
                });
            }
        }
        public Vector128 <float> Foo(Vector128 <float> left, Vector128 <float> right)
        {
            var comp = MVector.CompareEqual(left, right);
            var mul  = MVector.Multiply(left, right);
            var sqrt = MVector.Sqrt(mul);

            return(MVector.Select(comp, mul, sqrt));
        }