예제 #1
0
 public override void Close()
 {
     if (m_hologramShip != null)
     {
         MyHologramShips.Remove(m_hologramShip);
         m_hologramShip.MarkForClose();
         m_hologramShip = null;
     }
     base.Close();
     MyUniversalLauncherShells.Remove(this, m_ownerEntityID.PlayerId);
 }
예제 #2
0
        /// <summary>
        /// Prepares the hologram ship for display.
        /// </summary>
        private void ActivateHologram()
        {
            //this.Physics.Enabled = false;
            //this.Physics.LinearVelocity = Vector3.Zero;

            MyEntity owner = OwnerEntity;

            if (owner != null)
            {
                var ownerShipBuilder = (owner.GetObjectBuilder(false) as MyMwcObjectBuilder_SmallShip);
                Debug.Assert(ownerShipBuilder != null, "ownerShipBuilder != null");

                m_hologramBuilder.ShipType                = ownerShipBuilder.ShipType;
                m_hologramBuilder.ShipMaxHealth           = ownerShipBuilder.ShipMaxHealth;
                m_hologramBuilder.ShipHealthRatio         = ownerShipBuilder.ShipHealthRatio;
                m_hologramBuilder.ArmorHealth             = ownerShipBuilder.ArmorHealth;
                m_hologramBuilder.Oxygen                  = ownerShipBuilder.Oxygen;
                m_hologramBuilder.Fuel                    = ownerShipBuilder.Fuel;
                m_hologramBuilder.ReflectorLight          = ownerShipBuilder.ReflectorLight;
                m_hologramBuilder.ReflectorLongRange      = ownerShipBuilder.ReflectorLongRange;
                m_hologramBuilder.ReflectorShadowDistance = ownerShipBuilder.ReflectorShadowDistance;
                m_hologramBuilder.PositionAndOrientation  = ownerShipBuilder.PositionAndOrientation;
                m_hologramBuilder.Faction                 = ownerShipBuilder.Faction;

                string displayName = ownerShipBuilder.DisplayName;
                if (MyFactions.GetFactionsRelation(m_hologramBuilder.Faction, MySession.Static.Player.Faction) == MyFactionRelationEnum.Friend || MySession.PlayerShip == owner)
                {
                    displayName = "Hologram";
                }

                m_hologramShip            = MyHologramShips.Add(displayName, m_hologramBuilder);
                m_hologramShip.AIPriority = 1;
                m_hologramShip.IsHologram = true;
                if (m_hologramShip != null)
                {
                    m_hologramBaseMatrix = this.WorldMatrix;

                    m_scale         = new Vector3(0, 1, 1);
                    m_hologramState = HologramState.Activating;

                    foreach (var bot in m_awareBots)
                    {
                        bot.SpoilHologram(m_hologramShip);
                    }
                }
            }
        }