Ejemplo n.º 1
0
        public override void Init(string displayName, MyMwcObjectBuilder_Ship shipObjectBuilder)
        {
            MyMwcObjectBuilder_SmallShip smallShipObjectBuilder = shipObjectBuilder as MyMwcObjectBuilder_SmallShip;
            Debug.Assert(smallShipObjectBuilder != null);

            m_unifiedWeaponCues = new MySoundCue?[MyAudio.GetNumberOfSounds()];

            MaxArmorHealth = 100.0f;

            bool isPlayerShip = smallShipObjectBuilder is MyMwcObjectBuilder_SmallShip_Player;

            if (isPlayerShip)
            {
                Save = false; // Do not save player ships
                m_waypointTicks = 0;
            }

            OwnerId = smallShipObjectBuilder.OwnerId;

            RouteMemory = new MyPositionMemory(MySmallShipConstants.POSITION_MEMORY_SIZE, 1);

            Name = shipObjectBuilder.Name;

            //set leveling matrix default 
            m_levelingMatrix = Matrix.Identity;

            m_engineSoundOn = true;

            StringBuilder hudLabel = null;
            if (displayName != null)
            {
                hudLabel = new StringBuilder(displayName);
            }
            InitShip(hudLabel, smallShipObjectBuilder, null);

            MyModelDummy dummy;
            if (GetModelLod0().Dummies.TryGetValue("destruction", out dummy))
            {
                m_damageEffectLocalMatrix = dummy.Matrix;
            }
            if (shipObjectBuilder.Inventory == null)
            {
                shipObjectBuilder.Inventory = new MyMwcObjectBuilder_Inventory(new List<MyMwcObjectBuilder_InventoryItem>(), m_shipTypeProperties.GamePlay.CargoCapacity);
            }
            shipObjectBuilder.Inventory.MaxItems = m_shipTypeProperties.GamePlay.CargoCapacity;
            if (isPlayerShip)
            {
                if (MyGameplayCheats.IsCheatEnabled(MyGameplayCheatsEnum.INCREASE_CARGO_CAPACITY))
                {
                    shipObjectBuilder.Inventory.MaxItems = MyGamePlayCheatsConstants.CHEAT_INCREASE_CARGO_CAPACITY_MAX_ITEMS;
                }
                //shipObjectBuilder.Inventory.UnlimitedCapacity = MyGameplayCheats.IsCheatEnabled(MyGameplayCheatsEnum.UNLIMITED_CARGO_CAPACITY);
            }
            base.Init(displayName, shipObjectBuilder);

            if (isPlayerShip)
            {
                Inventory.InventorySynchronizer = new MyInventorySynchronizer(Inventory, MyPlayerShipInventorySynchronizerHelper.MustBePlayerShipInventorySynchronized);
            }

            System.Diagnostics.Debug.Assert(Faction != 0);
            m_targetEntityHistory.Clear();

            m_pilotDeathTime = 0;
            m_lastLootTime = 0;
            m_isExploded = false;
            m_lastTimeDeployedDrone = MyConstants.FAREST_TIME_IN_PAST;

            RenderObjects[0].ShadowCastUpdateInterval = 600;

            MyGuiScreenInventoryManagerForGame.OpeningInventoryScreen += OpeningInventoryScreen;
            MyGuiScreenInventoryManagerForGame.InventoryScreenClosed += InventoryScreenClosed;
            AfterburnerStatus = 1.0f;
            AfterburnerEnabled = true;
            IsDummy = smallShipObjectBuilder.IsDummy;
            m_friendlyFireDamageTimer = 0;
            AIPriority = smallShipObjectBuilder.AIPriority;

            UpdateMaxFuel();
            UpdateMaxOxygen();
        }
Ejemplo n.º 2
0
        public void Copy(MyPositionMemory route)
        {
            Debug.Assert(m_positionList.Length == route.m_positionList.Length);
            if (m_positionList.Length != route.m_positionList.Length)
            {
                return;
            }

            m_startIndex = route.m_startIndex;
            m_count = route.m_count;

            for (int i = 0; i < m_positionList.Length; i++)
            {
                m_positionList[i] = route.m_positionList[i];
            }
        }