Пример #1
0
        public MyObjectBuilder_Identity GetObjectBuilder()
        {
            var objectBuilder = new MyObjectBuilder_Identity();
            objectBuilder.IdentityId = IdentityId;
            objectBuilder.DisplayName = DisplayName;
            objectBuilder.CharacterEntityId = Character == null ? 0 : Character.EntityId;
            objectBuilder.Model = Model;
            objectBuilder.ColorMask = ColorMask;

            return objectBuilder;
        }
Пример #2
0
        private MyIdentity(MyObjectBuilder_Identity objectBuilder)
        {
            Init(objectBuilder.DisplayName, MyEntityIdentifier.FixObsoleteIdentityType(objectBuilder.IdentityId), objectBuilder.Model);
            MyEntityIdentifier.MarkIdUsed(IdentityId);

            if (objectBuilder.ColorMask.HasValue)
                ColorMask = objectBuilder.ColorMask;
            IsDead = true;

            MyEntity character;
            MyEntities.TryGetEntityById(objectBuilder.CharacterEntityId, out character);

            if (character is MyCharacter)
                Character = character as MyCharacter;
        }
Пример #3
0
 public virtual MyIdentity CreateNewIdentity(MyObjectBuilder_Identity objectBuilder)
 {
     return new MyIdentity(objectBuilder);
 }
        public override MyIdentity CreateNewIdentity(MyObjectBuilder_Identity objectBuilder)
        {
            bool obsoleteNpc = false;
            MyEntityIdentifier.ID_OBJECT_TYPE objectType = MyEntityIdentifier.GetIdObjectType(objectBuilder.IdentityId);
            if (objectType == MyEntityIdentifier.ID_OBJECT_TYPE.NPC || objectType == MyEntityIdentifier.ID_OBJECT_TYPE.SPAWN_GROUP)
                obsoleteNpc = true;

            MyIdentity identity = base.CreateNewIdentity(objectBuilder);
            AfterCreateIdentity(identity, obsoleteNpc);
            return identity;
        }