Пример #1
0
        private void CornerPushTest(Unit target, bool moveGuarded)
        {
            var hitDef = GetHitDefData();

            if (target is Character && target.GetBackStageDist() < new Number(5) / new Number(10))
            {
                Number velX = 0;
                if (moveGuarded)
                {
                    velX = hitDef.guardVel.X();
                }
                else if (target.GetPhysicsType() == PhysicsType.A)
                {
                    velX = hitDef.airVel.X();
                }
                else
                {
                    velX = hitDef.groundVel.X();
                }
                if (this.GetPhysicsType() == PhysicsType.A)
                {
                    this.moveCtr.VelAdd(-Number.Abs(velX) * hitDef.airCornerPush, 0);
                }
                else
                {
                    this.moveCtr.VelAdd(-Number.Abs(velX) * hitDef.groundCornerPush, 0);
                }
            }
        }
Пример #2
0
        public object ReadYaml(Core.IParser parser, System.Type type)
        {
            var value = ((Core.Events.Scalar)parser.Current).Value;

            parser.MoveNext();
            if (value.Contains("."))
            {
                int n = value.Length - value.IndexOf(".") - 1;
                Mugen3D.Core.Number result = int.Parse(value.Replace(".", ""));
                for (int i = 0; i < n; i++)
                {
                    result = result / 10;
                }
                return(result);
            }
            return((Mugen3D.Core.Number) int.Parse(value));
        }
Пример #3
0
        public static bool RectColliderIntersectTest(Collider c1, Collider c2, out ContactInfo contactInfo)
        {
            var rc1 = c1 as RectCollider;
            var rc2 = c2 as RectCollider;

            contactInfo = null;
            bool intersect = !((rc1.xMin > rc2.xMax || rc2.xMin > rc1.xMax) || (rc1.yMin > rc2.yMax || rc2.yMin > rc1.yMax));

            if (intersect)
            {
                Vector dir   = new Vector(rc1.position.x > rc2.position.x ? 1 : -1, 0, 0);
                Number depth = (rc1.width + rc2.width) / 2 - Math.Abs(rc1.position.x - rc2.position.x);
                contactInfo = new ContactInfo()
                {
                    recoverDir = dir, depth = depth
                };
                return(true);
            }
            return(intersect);
        }
Пример #4
0
 public void PosSet(Number x, Number y, Number z)
 {
     m_position.x = x;
     m_position.y = y;
     m_position.z = z;
 }
Пример #5
0
 public void SetGravity(Number x, Number y)
 {
     m_gravity = new Vector(x, y, 0);
 }
Пример #6
0
 public void VelAdd(Number deltaX, Number deltaY)
 {
     this.m_velocity.x += deltaX * owner.GetFacing();
     this.m_velocity.y += deltaY;
 }
Пример #7
0
 public void VelSet(Number velx, Number vely)
 {
     this.m_velocity = new Vector(velx * owner.GetFacing(), vely, 0);
 }
Пример #8
0
 public void PosAdd(Number deltaX, Number deltaY, Number deltaZ)
 {
     m_position.x += deltaX;
     m_position.y += deltaY;
     m_position.z += deltaZ;
 }
Пример #9
0
 public Rect(Rect rect)
 {
     this.position = rect.position;
     this.width    = rect.width;
     this.height   = rect.height;
 }
Пример #10
0
 public Rect(Vector p1, Vector p2)
 {
     this.position = (p1 + p2) / 2;
     this.width    = p2.x - p1.x;
     this.height   = p2.y - p1.y;
 }
Пример #11
0
 public Rect(Vector p, Number width, Number height)
 {
     this.position = p;
     this.width    = width;
     this.height   = height;
 }
Пример #12
0
 public Rect()
 {
     this.position = Vector.zero;
     this.width    = Number.Zero;
     this.height   = Number.Zero;
 }