Example #1
0
        /// <summary>
        /// takes the weapon off from owener and disables it.
        /// </summary>
        public void Discard()
        {
            DetachOwner();

            //  Collision is off
            this.Collide.RemoveInLayer();

            DroppedModel.SetRootAxis(Matrix.Identity);

            this.WorldTransform = Matrix.Identity;
            this.isDropped      = false;
            this.Enabled        = false;
            this.Visible        = false;
        }
Example #2
0
        /// <summary>
        /// drops weapon at specified position.
        /// </summary>
        /// <param name="position">new drop position</param>
        /// <param name="parent">new scene node</param>
        /// <param name="layer">new collision layer</param>
        public void Drop(Vector3 position, NodeBase parent, CollisionLayer layer)
        {
            //  Detached scene node from owner
            AttachOwner(parent);

            //  Add a collision
            if (layer != null)
            {
                layer.AddCollide(this.Collide);
            }

            DroppedModel.SetRootAxis(
                Matrix.CreateRotationX(MathHelper.ToRadians(-90.0f)));

            this.Position  = position;
            this.isDropped = true;
            this.Enabled   = true;
            this.Visible   = true;
        }
Example #3
0
        /// <summary>
        /// owner acquires weapon.
        /// </summary>
        /// <param name="owner"></param>
        public void Pickup(NodeBase owner)
        {
            //  Attach node to new owner
            AttachOwner(owner);

            //  All weapon model is active
            for (int i = 0; i < modelWeapon.Length; i++)
            {
                this.modelWeapon[i].Enabled        = true;
                this.modelWeapon[i].Visible        = true;
                this.modelWeapon[i].WorldTransform = Matrix.Identity;
            }

            //  Collision is off
            this.Collide.RemoveInLayer();

            DroppedModel.SetRootAxis(Matrix.Identity);

            this.WorldTransform = Matrix.Identity;
            this.isDropped      = false;
            this.Enabled        = false;
            this.Visible        = false;
        }