public static GameObject CreateManta()
        {
            CyclopsDefaultAssets.LoadDefaultCyclopsContent();

            var manta     = Object.Instantiate(Assets.MANTA_EXTERIOR);
            var renderers = manta.GetComponentsInChildren <Renderer>();

            SetupMaterials(manta);

            var skyApplier = manta.EnsureComponent <SkyApplier>();

            skyApplier.renderers = renderers;
            skyApplier.anchorSky = Skies.Auto;

            manta.EnsureComponent <VFXSurface>();
            manta.EnsureComponent <LargeWorldEntity>().cellLevel = LargeWorldEntity.CellLevel.Global;

            var rb = manta.EnsureComponent <Rigidbody>();

            rb.angularDrag  = 1f;
            rb.mass         = 12000f;
            rb.useGravity   = false;
            rb.centerOfMass = new Vector3(-0.1f, 0.8f, -1.7f);

            var forces = manta.EnsureComponent <WorldForces>();

            forces.aboveWaterDrag    = 0f;
            forces.aboveWaterGravity = 9.81f;
            forces.handleDrag        = true;
            forces.handleGravity     = true;
            forces.underwaterDrag    = 0.5f;
            forces.underwaterGravity = 0;

            manta.EnsureComponent <TechTag>().type             = MantaMod.MANTA_TECH_TYPE;
            manta.EnsureComponent <PrefabIdentifier>().ClassId = MantaMod.UNIQUE_ID;
            manta.EnsureComponent <SubmarineDuplicateFixer>();
            manta.EnsureComponent <MantaSubmarine>();
            manta.EnsureComponent <MovementStabiliser>();
            manta.EnsureComponent <WaterClipProxyModified>().Initialise();
            manta.EnsureComponent <MantaTemporarySteeringHUD>();

            manta.EnsureComponent <MantaSerializationFixer>();
            Setup(manta);
            return(manta);
        }
Ejemplo n.º 2
0
        /*
         * The first part of setting up the manta. If the components are self contained and do not rely on other components or require sounds
         * adding it here works fine.
         */
        public static GameObject CreateManta()
        {
            CyclopsDefaultAssets.LoadDefaultCyclopsContent();

            GameObject submarine = Object.Instantiate(MantaAssetLoader.MANTA_EXTERIOR);

            Renderer[] renderers = submarine.GetComponentsInChildren <Renderer>();
            ApplyMaterials(submarine, renderers);

            SkyApplier skyApplier = submarine.GetOrAddComponent <SkyApplier>();

            skyApplier.renderers = renderers;
            skyApplier.anchorSky = Skies.Auto;

            submarine.GetOrAddComponent <VFXSurface>();
            submarine.GetOrAddComponent <LargeWorldEntity>().cellLevel = LargeWorldEntity.CellLevel.Global;

            Rigidbody rb = submarine.GetOrAddComponent <Rigidbody>();

            rb.angularDrag  = 1f;
            rb.mass         = 12000f;
            rb.useGravity   = false;
            rb.centerOfMass = new Vector3(-0.1f, 0.8f, -1.7f);

            WorldForces forces = submarine.GetOrAddComponent <WorldForces>();

            forces.aboveWaterDrag    = 0f;
            forces.aboveWaterGravity = 9.81f;
            forces.handleDrag        = true;
            forces.handleGravity     = true;
            forces.underwaterDrag    = 0.5f;
            forces.underwaterGravity = 0;

            submarine.GetOrAddComponent <TechTag>().type             = MANTA_TECH_TYPE;
            submarine.GetOrAddComponent <PrefabIdentifier>().ClassId = "SubmarineManta";
            submarine.GetOrAddComponent <SubmarineDuplicateFixer>();
            submarine.GetOrAddComponent <MantaSubmarine>();
            submarine.GetOrAddComponent <MovementStabiliser>();
            submarine.GetOrAddComponent <WaterClipProxyModified>().Initialise();
            submarine.GetOrAddComponent <Components.MantaTemporarySteeringHUD>();

            submarine.GetOrAddComponent <Components.MantaSerializationFixer>();
            return(submarine);
        }