Beispiel #1
0
        public virtual MyObjectBuilder_AiTarget GetObjectBuilder()
        {
            long?nullable1;
            MyObjectBuilder_AiTarget target = MyObjectBuilderSerializer.CreateNewObject <MyObjectBuilder_AiTarget>();

            if (this.m_targetEntity != null)
            {
                nullable1 = new long?(this.m_targetEntity.EntityId);
            }
            else
            {
                nullable1 = null;
            }
            target.EntityId            = nullable1;
            target.CurrentTarget       = this.m_currentTarget;
            target.TargetCube          = this.m_targetCube;
            target.TargetPosition      = this.m_targetPosition;
            target.CompoundId          = this.m_compoundId;
            target.UnreachableEntities = new List <MyObjectBuilder_AiTarget.UnreachableEntitiesData>();
            foreach (KeyValuePair <VRage.Game.Entity.MyEntity, int> pair in this.m_unreachableEntities)
            {
                MyObjectBuilder_AiTarget.UnreachableEntitiesData item = new MyObjectBuilder_AiTarget.UnreachableEntitiesData {
                    UnreachableEntityId = pair.Key.EntityId,
                    Timeout             = pair.Value - MySandboxGame.TotalGamePlayTimeInMilliseconds
                };
                target.UnreachableEntities.Add(item);
            }
            return(target);
        }
Beispiel #2
0
        public virtual MyObjectBuilder_AiTarget GetObjectBuilder()
        {
            var builder = MyObjectBuilderSerializer.CreateNewObject <MyObjectBuilder_AiTarget>();

            builder.EntityId            = m_targetEntity != null ? m_targetEntity.EntityId : (long?)null;
            builder.CurrentTarget       = m_currentTarget;
            builder.TargetCube          = m_targetCube;
            builder.TargetPosition      = m_targetPosition;
            builder.CompoundId          = m_compoundId;
            builder.UnreachableEntities = new List <MyObjectBuilder_AiTarget.UnreachableEntitiesData>();
            foreach (var pair in m_unreachableEntities)
            {
                var data = new MyObjectBuilder_AiTarget.UnreachableEntitiesData();
                data.UnreachableEntityId = pair.Key.EntityId;
                data.Timeout             = pair.Value - MySandboxGame.TotalGamePlayTimeInMilliseconds;
                builder.UnreachableEntities.Add(data);
            }
            return(builder);
        }