/// <summary>
        /// Called when the projectile collides with an other object.
        /// </summary>
        /// <param name="e">The event-data.</param>
        public override void OnCollision(CollisionEvent e)
        {
            // do not consider collision if there is no collision but an intersection
            if (game.Physics.CanSolidsCollide(e.ThisSolid, e.OtherSolid))
            {
                SmokeEmitter.Dispose();
                light.Parent = null;
                game.World.RemovePointLight(light);

                // Erzeugt Geröll bei Kollision mit dem Canyon
                if (e.OtherSolid.UserData is IGameObject)
                {
                    if ((e.OtherSolid.UserData as IGameObject).ContactGroup == Engine.Physics.ContactGroup.Canyon)
                    {
                        DebrisEmitter d = new DebrisEmitter(game, "debrisTest", 10, 0.5f, 1.0f);
                        // do not use e.Position in the next statement because it could ne NaN.
                        d.LocalPosition     = GlobalPosition + e.Normal * 10.0f;
                        d.Type              = new DebrisEmitterTypeCone(game, e.Normal, 20, 10, 50);
                        d.SelfDestructDelay = TimeSpan.FromSeconds(10);
                        d.Emit(5);
                        game.World.AddObject(d);
                    }
                }
            }

            base.OnCollision(e);
        }
        protected override void Close()
        {
            base.Close();

            if (effect != null)
            {
                effect.Dispose();
            }
            effect = null;

            if (info != null)
            {
                info.Dispose();
            }
            info = null;
        }
        protected override void OnDestroyed()
        {
            if (current != null)
            {
                current.Dispose();
                current = null;
            }

            if (next != null)
            {
                next.Dispose();
                next = null;
            }

            Transition = null;

            if (effect != null)
            {
                effect.Dispose();
            }

            base.OnDestroyed();
        }
示例#4
0
 public void FreeEffect(IEffect e)
 {
     e.Dispose();
 }