private void OverrideClawArm()
        {
            Main.graphics.ArmsTemplateCache.TryGetValue(ArmTemplate.ClawArm, out GameObject armPrefab);

            SkinnedMeshRenderer smr = armPrefab.GetComponentInChildren <SkinnedMeshRenderer>();
            Mesh clawMesh           = smr.sharedMesh;

            MeshFilter mf = PrefabClone.GetComponentInChildren <MeshFilter>();

            mf.sharedMesh = Object.Instantiate(clawMesh);

            MeshRenderer mr = PrefabClone.GetComponentInChildren <MeshRenderer>();

            mr.materials = (Material[])smr.materials.Clone();

            Object.Destroy(PrefabClone.GetComponentInChildren <CapsuleCollider>());

            BoxCollider bc_1 = PrefabClone.FindChild("collider").AddComponent <BoxCollider>();

            bc_1.size   = new Vector3(1.29f, 0.33f, 0.42f);
            bc_1.center = new Vector3(-0.53f, 0f, 0.04f);

            GameObject collider2 = new GameObject("collider2");

            collider2.transform.SetParent(PrefabClone.transform, false);
            collider2.transform.localPosition = new Vector3(-1.88f, 0.07f, 0.50f);
            collider2.transform.localRotation = Quaternion.Euler(0, 34, 0);

            BoxCollider bc_2 = collider2.AddComponent <BoxCollider>();

            bc_2.size   = new Vector3(1.06f, 0.23f, 0.31f);
            bc_2.center = new Vector3(0, -0.08f, 0);
        }
        protected override void PostModify()
        {
            SeamothStorageContainer container = PrefabClone.GetComponent <SeamothStorageContainer>();

            container.width  = 4;
            container.height = 4;
        }
Beispiel #3
0
        public override GameObject GetGameObject()
        {
            base.GetGameObject();

            var exosuit = ArmServices.main.ExosuitResource;

            GameObject armPrefab = null;

            for (int i = 0; i < exosuit.armPrefabs.Length; i++)
            {
                if (exosuit.armPrefabs[i].techType == TechType.ExosuitClawArmModule)
                {
                    armPrefab = exosuit.armPrefabs[i].prefab;
                    break;
                }
            }

            SkinnedMeshRenderer smr = armPrefab.GetComponentInChildren <SkinnedMeshRenderer>();
            Mesh clawMesh           = smr.sharedMesh;

            MeshFilter mf = PrefabClone.GetComponentInChildren <MeshFilter>();

            mf.sharedMesh      = UnityEngine.Object.Instantiate(clawMesh);
            mf.sharedMesh.name = "seamoth_hand_geo";

            MeshRenderer mr = PrefabClone.GetComponentInChildren <MeshRenderer>();

            mr.materials = (Material[])smr.materials.Clone();

            PrefabClone.transform.Find("model/exosuit_rig_armLeft:exosuit_drill_geo").gameObject.name = "seamoth_claw_arm_geo";

            UnityEngine.Object.Destroy(PrefabClone.GetComponentInChildren <CapsuleCollider>());

            BoxCollider bc_1 = PrefabClone.FindChild("collider").AddComponent <BoxCollider>();

            bc_1.size   = new Vector3(1.29f, 0.33f, 0.42f);
            bc_1.center = new Vector3(-0.53f, 0f, 0.04f);

            GameObject collider2 = new GameObject("collider2");

            collider2.transform.SetParent(PrefabClone.transform, false);
            collider2.transform.localPosition = new Vector3(-1.88f, 0.07f, 0.50f);
            collider2.transform.localRotation = Quaternion.Euler(0, 34, 0);

            BoxCollider bc_2 = collider2.AddComponent <BoxCollider>();

            bc_2.size   = new Vector3(1.06f, 0.23f, 0.31f);
            bc_2.center = new Vector3(0, -0.08f, 0);

            PrefabClone.transform.localScale = new Vector3(0.8f, 0.8f, 0.8f);

            return(PrefabClone);
        }
Beispiel #4
0
        protected override void ModifyGameObject()
        {
            GameObject model = PrefabClone.transform.Find("model").gameObject;

            Object.DestroyImmediate(PrefabClone.FindChild("GameObject"));
            Object.DestroyImmediate(PrefabClone.GetComponent <SeamothStorageContainer>());
            Object.DestroyImmediate(PrefabClone.transform.Find("model/exosuit_rig_armLeft:exosuit_torpedoLauncher_geo").gameObject);

            GameObject colliderGO = PrefabClone.FindChild("collider");

            BoxCollider boxCollider = colliderGO.AddComponent <BoxCollider>();

            boxCollider.size   = new Vector3(1.87f, 0.48f, 0.69f);
            boxCollider.center = new Vector3(0.01f, 0.01f, 0.0f);
            Object.DestroyImmediate(colliderGO.GetComponent <CapsuleCollider>());

            GameObject PlasmaArm = Object.Instantiate(Main.assetBundle.LoadAsset <GameObject>("PlasmaArm"), model.transform);

            PlasmaArm.name = "exosuit_plasma_arm";
            PlasmaArm.transform.localPosition = new Vector3(-0.02f, -0.15f, -0.20f);
            PlasmaArm.transform.localScale    = new Vector3(0.13f, 0.13f, 0.13f);
            PlasmaArm.transform.localRotation = Quaternion.Euler(0, 90, 0);

            Object.DestroyImmediate(PlasmaArm.FindChild("SFX"));

            Renderer laserArmRenderer = PlasmaArm.GetComponent <Renderer>();

            Texture2D _MainTex = Main.assetBundle.LoadAsset <Texture2D>("PlasmaArm_MainTex");
            Texture2D _Illum   = Main.assetBundle.LoadAsset <Texture2D>("PlasmaArm_Illum");
            Texture2D _BumpMap = Main.assetBundle.LoadAsset <Texture2D>("PlasmaArm_BumpMap");

            Shader marmoShader = Shader.Find("MarmosetUBER");

            foreach (Material material in laserArmRenderer.materials)
            {
                material.name   = "plasmaArm";
                material.shader = marmoShader;
                material.EnableKeyword("MARMO_EMISSION");
                material.EnableKeyword("_ZWRITE_ON");
                material.SetTexture(Shader.PropertyToID("_MainTex"), _MainTex);
                material.SetTexture(Shader.PropertyToID("_BumpMap"), _BumpMap);
                material.SetTexture(Shader.PropertyToID("_Illum"), _Illum);
            }
        }