Exemplo n.º 1
0
        /// <summary>
        /// Constructs the hitbox bodies for this move
        /// </summary>
        /// <param name="world">The world to put these bodies in</param>
        /// <param name="characterCollides">The collision category for the player</param>
        /// <param name="hitboxCollides">The categories of objects that these moves should collide with</param>
        public void ConstructBodies(World world, Category characterCollides, params Category[] hitboxCollides)
        {
#if COMPLEX_BODIES
            Animation.GenerateBodies(world, characterCollides);

            Category Result = Category.None;

            foreach (var I in hitboxCollides)
            {
                Result = Result | I;
            }

            HitboxBodies = new Body[HitboxVertices.Length];

            for (int I = 0; I < HitboxVertices.Length; ++I)
            {
                //This actually creates the body
                HitboxBodies[I]              = BodyFactory.CreateCompoundPolygon(world, HitboxVertices[I], 1, Vector2.Zero);
                HitboxBodies[I].BodyType     = BodyType.Dynamic;
                HitboxBodies[I].Enabled      = false;
                HitboxBodies[I].CollidesWith = Result; //TODO test this
            }
#else
            HitboxBodies = new Body[HitboxVertices.Length];
#endif
        }