Beispiel #1
0
        public Chain(RenderContext context, float scale)
            : base("PlayerV2")
        {
            m_Scale            = scale;
            RigidBody          = BodyFactory.CreateRectangle(context.World, ConvertUnits.ToSimUnits(2), ConvertUnits.ToSimUnits(2), 1, Vector2.Zero);
            RigidBody.BodyType = BodyType.Dynamic;
            RigidBody.Mass     = 0f;
            ObjectScale        = new Vector3(m_Scale, m_Scale, m_Scale);

            base.Name              = "ChainPiece";
            RigidBody.OnCollision += RigidBody_OnCollision;
            RigidBody.UserData     = this; //Add this class as data for easy access in collision
            RigidBody.Restitution  = 0.0f;

            Scale(0.3f);
            Rotate(0, 90, 0);
            Depth = 0;

            Alpha = 0.95f;

            Active = true;
        }
Beispiel #2
0
        public Player(string assetFile, RenderContext context, Vector2 originalPos)
            : base(assetFile, "Textures/Collision/c_Piece1", context)
        {
            m_OrginalPos = originalPos;
            //Create rigidBody
            RigidBody               = BodyFactory.CreateRectangle(context.World, ConvertUnits.ToSimUnits(20), ConvertUnits.ToSimUnits(10), 1.0f);
            RigidBody.BodyType      = BodyType.Dynamic;
            RigidBody.OnCollision  += RigidBody_OnCollision;
            RigidBody.OnSeparation += RigidBody_OnSeparation;
            RigidBody.UserData      = this;
            RigidBody.Restitution   = 0.1f;
            Depth = -200;

            //Xml
            var xmlPlayerData = XmlLoader.Load <PlayerSettings>("PlayerSettings");

            m_Multplier        = xmlPlayerData.multiplier;
            m_TurnAmount       = xmlPlayerData.turnAmount;
            m_CurrentIncrement = xmlPlayerData.windIncrement;

            m_Velocity = Vector2.Zero;
        }