Beispiel #1
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;
            }

            if (collidedEntity is MySmallShip &&
                OwnerEntity == MySession.PlayerShip &&
                MySession.PlayerFriends.Contains(collidedEntity as MySmallShip))
            {
                //missiles wont hit out friends
                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();
        }
Beispiel #2
0
        //  Add new missile to the list
        public static MyMissile Add(MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum type, Vector3 position, Vector3 initialVelocity, Vector3 direction, Vector3 relativePos, MyEntity ignoreMinerShip, MyEntity target, float customMaxDistance = 0, bool isDummy = false, bool isLightWeight = false)
        {
            MyMissile newMissile = m_missiles.Allocate();

            if (newMissile != null)
            {
                newMissile.Start(type, position, initialVelocity, direction, relativePos, ignoreMinerShip, target, customMaxDistance, isDummy, isLightWeight);
            }
            return(newMissile);
        }
Beispiel #3
0
 public static void Remove(MyMissile missile)
 {
     m_missiles.Deallocate(missile);
 }
Beispiel #4
0
 void LastMissileFiredOnClose(MyEntity missile)
 {
     m_lastMissileFired.OnClose -= LastMissileFiredOnClose;
     m_lastMissileFired = null;
 }
Beispiel #5
0
 public static void Remove(MyMissile missile)
 {
     m_missiles.Deallocate(missile);
 }