Esempio n. 1
0
        protected override void OnContactStart(MyContactEventInfo contactInfo)
        {
            base.OnContactStart(contactInfo);

            m_collidedEntity = contactInfo.GetOtherEntity(this);

            if (this.OwnerEntity is MySmallShip && (MySmallShip)this.OwnerEntity == MySession.PlayerShip && m_collidedEntity is MyStaticAsteroid && !m_collidedEntity.IsDestructible)
            {
                HUD.MyHud.ShowIndestructableAsteroidNotification();
            }
            Explode();
        }
Esempio n. 2
0
        protected override void OnContactStart(MyContactEventInfo contactInfo)
        {
            base.OnContactStart(contactInfo);

            if (m_state == MyCurrentState.ACTIVATED)
            {
                m_collidedEntity = contactInfo.GetOtherEntity(this);

                if (m_collidedEntity is MySmallShip && MyFactions.GetFactionsRelation(this, m_collidedEntity) == MyFactionRelationEnum.Enemy)
                {
                    if (this.OwnerEntity is MySmallShip && (MySmallShip)this.OwnerEntity == MySession.PlayerShip && m_collidedEntity is MyStaticAsteroid && !m_collidedEntity.IsDestructible)
                    {
                        HUD.MyHud.ShowIndestructableAsteroidNotification();
                    }

                    //  Create explosion and close;
                    Explode();
                }
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Called on some contact start with this entity.
        /// </summary>
        /// <param name="contactInfo">The contact info.</param>
        protected override void OnContactStart(MyContactEventInfo contactInfo)
        {
            MyEntity collidedEntity = contactInfo.GetOtherEntity(this);
            Debug.Assert(!collidedEntity.Closed);

            MyMissile missile = collidedEntity as MyMissile;

            if ((missile != null) && (OwnerEntity == missile.OwnerEntity))
            {   //We have hit another missile of ours
                return;
            }

            base.OnContactStart(contactInfo);

            m_collidedEntity = collidedEntity;
            m_collidedEntity.OnClose += m_collidedEntity_OnClose;
            m_collisionPoint = contactInfo.m_ContactPoint;

            if (this.OwnerEntity is MySmallShip && (MySmallShip)this.OwnerEntity == MySession.PlayerShip && m_collidedEntity is MyStaticAsteroid && !m_collidedEntity.IsDestructible)
            {
                HUD.MyHud.ShowIndestructableAsteroidNotification();
            }

            Explode();
        }
Esempio n. 4
0
        /// <summary>
        /// Called on some contact with this entity.
        /// </summary>
        /// <param name="contactInfo">The contact info.</param>
        protected override void OnContactStart(MyContactEventInfo contactInfo)
        {
            base.OnContactStart(contactInfo);

            var collidedEntity = contactInfo.GetOtherEntity(this);

            /*
            if (IsExploded || contactInfo.GetOtherEntity(this) != m_collidedEntity || m_wasPenetration)
            {
                return;
            } */

            /*
            if (Vector3.Dot(WorldMatrix.Forward, contactInfo.m_ContactNormal) < MyMissileConstants.MISSILE_MINIMAL_HIT_DOT)
            {
                //Hit wasnt facing the target, just slide or something
                return;
            } */

            if (collidedEntity is MySmallShip
              && OwnerEntity == MySession.PlayerShip
              && MySession.PlayerFriends.Contains(collidedEntity as MySmallShip))
            {
                //missiles wont hit out friends
                return;
            }

            m_collidedEntity = collidedEntity;
            m_collidedEntity.OnClose += m_collidedEntityClosedHandler;
            m_collisionPoint = contactInfo.m_ContactPoint;


            if (this.OwnerEntity is MySmallShip && (MySmallShip)this.OwnerEntity == MySession.PlayerShip && m_collidedEntity is MyStaticAsteroid && !m_collidedEntity.IsDestructible)
            {
                HUD.MyHud.ShowIndestructableAsteroidNotification();
            }
              /*
            if (m_usedAmmo.AmmoType == MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Cannon_Tunnel_Buster)
            {
                if (m_collidedEntity is MyVoxelMap)
                {
                    return;
                }
            }   */

            Explode(m_collidedEntity);
        }
Esempio n. 5
0
        protected override void OnContactStart(MyContactEventInfo contactInfo)
        {
            var collidedEntity = contactInfo.GetOtherEntity(this);

            if (!(collidedEntity is MyMeteor))
            {
                MyParticleEffect pe = MyParticlesManager.CreateParticleEffect((int)MyParticleEffectsIDEnum.Explosion_Meteor);
                pe.WorldMatrix = this.WorldMatrix;
                pe.UserScale = this.m_size * 0.01f;


                MyExplosion newExplosion = MyExplosions.AddExplosion();
                MyExplosionInfo info = new MyExplosionInfo()
                {
                    PlayerDamage = 100,
                    Damage = 100,
                    EmpDamage = 0,
                    ExplosionType = MyExplosionTypeEnum.METEOR_EXPLOSION,
                    ExplosionSphere = new BoundingSphere(GetPosition(), m_size),
                    LifespanMiliseconds = MyExplosionsConstants.EXPLOSION_LIFESPAN,
                    ParticleScale = 1,
                    OwnerEntity = this,
                    HitEntity = collidedEntity,
                    ExplosionFlags = MyExplosionFlags.APPLY_FORCE_AND_DAMAGE | MyExplosionFlags.AFFECT_VOXELS | MyExplosionFlags.CREATE_DEBRIS /*| MyExplosionFlags.FORCE_DEBRIS*/,
                    PlaySound = true,
                    VoxelCutoutScale = 1,
                    VoxelExplosionCenter = GetPosition()
                };

                if (newExplosion != null)
                {
                    newExplosion.Start(ref info);
                }


                this.MarkForClose();
            }
        }