Beispiel #1
0
        /// <summary>
        /// Creates a new Gravity force.
        /// </summary>
        /// <param name="gravity">The amount of gravity to be applied.</param>
        /// <param name="direction">The direction of gravity.</param>
        public Gravity(string id, float gravity, Vector2 direction)
        {
            this.id = id;

            this.gravity   = gravity;
            this.direction = direction;

            ForceManager.AddForce(this);
        }
Beispiel #2
0
        /// <summary>
        /// Creates a new Expolsion force.
        /// </summary>
        /// <param name="center">The center of the Expolsion force.</param>
        /// <param name="radius">The radius of the Expolsion force.</param>
        /// <param name="maxForce">The maximum force that
        /// can be generated by the Expolsion force.</param>
        /// <param name="decay">The amount of decay in the Expolsion force.</param>
        public Explosion(Vector2 center, float maxForce, float decay, int radius)
        {
            force       = maxForce;
            this.decay  = decay;
            this.radius = radius;

            impactArea = new BoundingCircle(center, radius);

            ForceManager.AddForce(this);
        }
Beispiel #3
0
        /// <summary>
        /// Creates a Wind force.
        /// </summary>
        /// <param name="force">The force of the Wind.</param>
        /// <param name="position">The origin of the Wind.</param>
        /// <param name="direction">The direction of the Wind.</param>
        /// <param name="range">The range of the Wind.</param>
        public Wind(string id, float force, Vector2 position,
                    Vector2 direction, float range)
        {
            this.id        = id;
            this.force     = force;
            this.position  = position;
            this.direction = direction;
            this.range     = range;

            ForceManager.AddForce(this);
        }
Beispiel #4
0
        /// <summary>
        /// Creates a new Explosion force.
        /// </summary>
        /// <param name="center">The center of the Expolsion force.</param>
        /// <param name="maxForce">The maximum force that
        /// can be generated by the Expolsion force.</param>
        /// <param name="decay">The amount of decay in the Expolsion force.</param>
        public Explosion(string id, Vector2 center, float maxForce, float decay)
        {
            this.id = id;

            force = maxForce;

            int radius = 0;

            while (maxForce > 0)
            {
                radius++;
                maxForce -= decay;
            }

            this.radius = radius;

            this.decay = decay;

            impactArea = new BoundingCircle(center, radius);

            ForceManager.AddForce(this);
        }
Beispiel #5
0
 /// <summary>
 /// Removes this force from the ForceManager.
 /// </summary>
 public void Remove()
 {
     ForceManager.Remove(this);
 }
Beispiel #6
0
        /// <summary>
        /// Creates a new gravity force with default values.
        /// </summary>
        public Gravity(string id)
        {
            this.id = id;

            ForceManager.AddForce(this);
        }