Ejemplo n.º 1
0
        public void Start(MyGuiHelperBase guiHelper, MyGameplayProperties itemProperties, MyMwcObjectBuilder_Base objectBuilder, float amount) 
        {
            GuiHelper = guiHelper;
            ItemProperties = itemProperties;
            ObjectBuilder = objectBuilder;

            Amount = Math.Min(amount, MaxAmount);
            TemporaryFlags = MyInventoryItemTemporaryFlags.NONE;                        
        }        
Ejemplo n.º 2
0
        protected void Init(StringBuilder displayName, MyMwcObjectBuilder_Base objectBuilder)
        {
            Closed = false;
            m_wasDead = false;
            m_isExploded = false;

            // System.Diagnostics.Debug.Assert(objectBuilder != null);

            if (objectBuilder != null)
            {
                this.EntityId = MyEntityIdentifier.FromNullableInt(objectBuilder.EntityId);
                this.m_objectBuilder = objectBuilder.Clone(); // MyMwcUtils.DeepCopy(objectBuilder);
                m_gameplayProperties = MyGameplayConstants.GetGameplayProperties(objectBuilder, Faction);

                Debug.Assert(m_gameplayProperties != null);
                if (m_gameplayProperties != null)
                {
                    MaxHealth = m_gameplayProperties.MaxHealth;
                    Health = m_gameplayProperties.MaxHealth;
                }

                PersistentFlags = objectBuilder.PersistentFlags;

                this.Name = objectBuilder.Name;
                MyEntities.SetEntityName(this, false);

                IsGenerated = objectBuilder.Generated;

                if (IsGenerated)
                {
                    Flags &= ~EntityFlags.NeedsId;
                    Flags &= ~EntityFlags.Save;
                }
            }
            else
            {
                PersistentFlags |= MyMwcObjectBuilder_Base.GetDefaultPersistantFlags();
            }

            InitRenderObjects();

            // When entity needs id and has id, add it to list
            if ((Flags & EntityFlags.NeedsId) != 0)
            {
                // When suspended, id is allocated during link
                if (!this.EntityId.HasValue && MyEntityIdentifier.AllocationSuspended == false)
                {
                    this.EntityId = MyEntityIdentifier.AllocateId();
                }

                if (this.EntityId.HasValue)
                {
                    MyEntityIdentifier.AddEntityWithId(this);
                }
            }
            else
            {
                this.EntityId = null;
            }

            this.DisplayName = displayName != null ? displayName.ToString() : null;

            UpdateHudMarker();

            m_worldMatrix = Matrix.Identity;
            //DebugGenerateEntityDisplayName();
            if (!MyFakes.MWBUILDER)
            {
                Debug.Assert(IsActivatedForDifficulty(MyGameplayDifficultyEnum.EASY) || IsActivatedForDifficulty(MyGameplayDifficultyEnum.NORMAL) || IsActivatedForDifficulty(MyGameplayDifficultyEnum.HARD));
            }
        }
Ejemplo n.º 3
0
 public void Start(MyGuiHelperBase guiHelper, MyGameplayProperties itemProperties, MyMwcObjectBuilder_Base objectBuilder)
 {
     Start(guiHelper, itemProperties, objectBuilder, 1f);
 }