Exemple #1
0
 private protected FullBehavior(SimpleDescriptor standardShortDesc, SimpleDescriptor singleShortDesc, PartDescriptor <DataClass> longDesc,
                                PlayerBodyPartDelegate <ContainerClass> playerDesc, ChangeType <DataClass> transformDesc, RestoreType <DataClass> restoreDesc) : base(standardShortDesc, singleShortDesc)
 {
     longStr          = longDesc ?? throw new ArgumentNullException(nameof(longDesc));
     playerStr        = playerDesc ?? throw new ArgumentNullException(nameof(playerDesc));
     transformFromStr = transformDesc ?? throw new ArgumentNullException(nameof(transformDesc));
     restoredStr      = restoreDesc ?? throw new ArgumentNullException(nameof(restoreDesc));
 }
Exemple #2
0
 internal DistinctTargetGroupTuple(PartDescriptor <Vector3> descriptor)
 {
     id   = descriptor.TargetGroupId;
     type = descriptor.PartType;
     // You'd think this would be TargetPoint, but from my testing it seems to be HitBoxCenter.
     // TODO: Figure out what TargetPoint is actually for.
     location = descriptor.HitboxCenterPoint;
 }
Exemple #3
0
        private OvipositorType(byte maxEggs, ShortDescriptor shortDesc, PartDescriptor <OvipositorData> longDesc, PlayerBodyPartDelegate <Ovipositor> playerDesc,
                               OvipositorTransform transform, OvipositorRestore restore) : base(shortDesc)
        {
            this.maxEggs = maxEggs;

            this.longDesc   = longDesc ?? throw new ArgumentNullException(nameof(longDesc));
            this.playerDesc = playerDesc ?? throw new ArgumentNullException(nameof(playerDesc));

            this.transformStr = transform ?? throw new ArgumentNullException(nameof(transform));
            restoreStr        = restore ?? throw new ArgumentNullException(nameof(restore));
        }
Exemple #4
0
        //i should use maybe plural desriptor here by naming conventions, but in this case i know exactly when it's plural, so i can fake it with the function that
        //exposes the delegate. probably should do it anyway, but it's easier to implement like this.
        private protected EyeType(EyeColor defaultEyeColor, EyeChangeDelegate eyeChange,
                                  ShortPluralDescriptor shortDesc, SimpleDescriptor singleItemDesc, PartDescriptor <EyeData> longDesc, SingleEyeDescriptor oneEyeDesc, PartDescriptor <EyeData> fullDesc,
                                  PlayerBodyPartDelegate <Eyes> playerDesc, ChangeType <EyeData> transform, RestoreType <EyeData> restore, byte numEyes = 2, ScleraColor color = ScleraColor.CLEAR)
            : base(PluralHelper(shortDesc), singleItemDesc, longDesc, playerDesc, transform, restore)
        {
            EyeChangeSpecial = eyeChange;
            eyeCount         = numEyes;
            defaultColor     = defaultEyeColor;
            _index           = indexMaker++;

            eyeDesc         = shortDesc;
            eyeFullDesc     = fullDesc ?? throw new ArgumentNullException(nameof(fullDesc));
            this.oneEyeDesc = oneEyeDesc ?? throw new ArgumentNullException(nameof(oneEyeDesc));

            eyes.AddAt(this, _index);
            scleraColor = color;
        }
Exemple #5
0
        internal PartFactory(CraftFactory craft, NodeCollection shipPart)
        {
            Craft            = craft;
            ShipPart         = shipPart;
            hardpointFactory = new HardpointFactory(craft);

            // Fetch ship part top level data
            descriptor   = ShipPart.Children.OfType <PartDescriptor <Vector3> >().First();
            rotationInfo = ShipPart.Children.OfType <RotationInfo <Vector3> >().First();
            verts        = ShipPart.OfType <MeshVertices <Vector3> >().First();
            vertUV       = ShipPart.OfType <VertexUV <Vector2> >().First();
            vertNormals  = ShipPart.OfType <VertexNormals <Vector3> >().First();

            // All meshes are contained inside of a MeshLod
            // There is only one MeshLod per part.
            // Each LOD is BranchNode containing a collection of meshes and textures it uses.
            var lodNode = ShipPart.OfType <LodCollection>().First();

            _lods = new List <LodFactory>();
            int newLodIndex = 0;

            for (int i = 0; i < lodNode.MaxRenderDistance.Count; i++)
            {
                float distance = lodNode.MaxRenderDistance[i];

                // Out of order LODs are probably broken.  See TIE98 CAL.OPT.
                // If this distance is greater than the previous distance (smaller number means greater render distance),
                // then this LOD is occluded by the previous LOD.
                if (distance > 0 && i > 0 && distance > lodNode.MaxRenderDistance[i - 1])
                {
                    continue;
                }

                if (lodNode.Children[i] is NodeCollection branch)
                {
                    _lods.Add(new LodFactory(this, branch, newLodIndex, distance));
                    newLodIndex++;
                }
                else
                {
                    Debug.LogError("Skipping LOD" + newLodIndex + " as it is not a NodeCollection");
                }
            }
        }
Exemple #6
0
        internal GameObject MakeHardpoint(GameObject parent, Hardpoint <Vector3> hardpointNode, PartDescriptor <Vector3> partDescriptor)
        {
            var hardpointObj = Object.Instantiate(Craft.HardpointBase) as GameObject;

            hardpointObj.name = hardpointNode.WeaponType.ToString();
            Helpers.AttachTransform(parent, hardpointObj, hardpointNode.Location);

            Craft.ProcessHardpoint?.Invoke(hardpointObj, partDescriptor, hardpointNode);

            return(hardpointObj);
        }
Exemple #7
0
 private OvipositorType(ShortDescriptor shortDesc, PartDescriptor <OvipositorData> longDesc, PlayerBodyPartDelegate <Ovipositor> playerDesc,
                        OvipositorTransform transform, OvipositorRestore restore) : this(0, shortDesc, longDesc, playerDesc, transform, restore)
 {
 }
Exemple #8
0
 public StoneStareEyeType(EyeColor defaultEyeColor, EyeChangeDelegate eyeChange, ShortPluralDescriptor shortDesc, SimpleDescriptor singleItemDesc,
                          PartDescriptor <EyeData> longDesc, SingleEyeDescriptor oneEyeDesc, PartDescriptor <EyeData> fullDesc, PlayerBodyPartDelegate <Eyes> playerDesc,
                          ChangeType <EyeData> transform, RestoreType <EyeData> restore, byte numEyes = 2, ScleraColor color = ScleraColor.CLEAR)
     : base(defaultEyeColor, eyeChange, shortDesc, singleItemDesc, longDesc, oneEyeDesc, fullDesc, playerDesc, transform, restore, numEyes, color)
 {
 }
Exemple #9
0
        protected GillType(ShortPluralDescriptor shortDesc, SimpleDescriptor singleDesc, PartDescriptor <GillData> longDesc, PlayerBodyPartDelegate <Gills> playerDesc,
                           ChangeType <GillData> transform, RestoreType <GillData> restore) : base(PluralHelper(shortDesc), singleDesc, longDesc, playerDesc, transform, restore)
        {
            _index = indexMaker++;
            gills.AddAt(this, _index);

            pluralDesc = shortDesc;
        }
Exemple #10
0
 private protected TongueType(ushort tongueLength, double tongueWidth, ShortDescriptor shortDesc, PartDescriptor <TongueData> longDesc,
                              PlayerBodyPartDelegate <Tongue> playerDesc, ChangeType <TongueData> transform, RestoreType <TongueData> restore) : base(shortDesc, longDesc, playerDesc, transform, restore)
 {
     _index = indexMaker++;
     tongues.AddAt(this, _index);
     length = tongueLength;
     width  = tongueWidth;
 }