Exemplo n.º 1
0
        public override GameObject GetGameObject()
        {
            GameObject gameObject = Main.assetBundle.LoadAsset <GameObject>("AncientSword");

            foreach (Renderer renderer in gameObject.GetComponentsInChildren <Renderer>())
            {
                renderer.material.shader = Shader.Find("MarmosetUBER");
                renderer.material.SetColor("_Emission", new Color(1f, 1f, 1f));
            }

            gameObject.AddComponent <PrefabIdentifier>().ClassId   = ClassID;
            gameObject.AddComponent <TechTag>().type               = TechType;
            gameObject.AddComponent <BoxCollider>().size           = new Vector3(0.1f, 0.1f, 0.1f);
            gameObject.AddComponent <LargeWorldEntity>().cellLevel = LargeWorldEntity.CellLevel.Near;
            gameObject.AddComponent <Pickupable>().isPickupable    = true;

            Fixer fixer = gameObject.AddComponent <Fixer>();

            fixer.ClassId  = ClassID;
            fixer.techType = TechType;

            SkyApplier skyApplier = gameObject.AddComponent <SkyApplier>();

            skyApplier.renderers = gameObject.GetComponentsInChildren <MeshRenderer>();
            skyApplier.anchorSky = Skies.Auto;

            WorldForces worldForces = gameObject.AddComponent <WorldForces>();
            Rigidbody   rigidbody   = gameObject.AddComponent <Rigidbody>();

            worldForces.underwaterGravity = 0;
            worldForces.useRigidbody      = rigidbody;

            VFXFabricating vfxFabricating = gameObject.AddComponent <VFXFabricating>();

            vfxFabricating.localMinY   = -3f;
            vfxFabricating.localMaxY   = 3f;
            vfxFabricating.posOffset   = new Vector3(0f, 0, 0f);
            vfxFabricating.eulerOffset = new Vector3(0f, 90f, -90f);
            vfxFabricating.scaleFactor = 1f;

            AncientSword component = gameObject.AddComponent <AncientSword>();

            var knifePrefab = Resources.Load <GameObject>("WorldEntities/Tools/Knife").GetComponent <Knife>();

            component.attackSound         = Object.Instantiate(knifePrefab.attackSound, gameObject.transform);
            component.underwaterMissSound = Object.Instantiate(knifePrefab.underwaterMissSound, gameObject.transform);
            component.surfaceMissSound    = Object.Instantiate(knifePrefab.surfaceMissSound, gameObject.transform);

            return(gameObject);
        }
Exemplo n.º 2
0
        public override GameObject GetGameObject()
        {
            base.GetGameObject();

            GameObject modelGO = _GameObject.transform.Find("alien_relic_08_world_rot/alien_relic_08_hlpr/alien_relic_08_ctrl/alien_relic_08").gameObject;

            modelGO.transform.SetParent(_GameObject.transform, false);
            modelGO.name = "sword_model";
            modelGO.transform.localPosition = new Vector3(0.06f, 0.27f, 0.05f);
            modelGO.transform.localRotation = Quaternion.Euler(350f, 265f, 172f);
            modelGO.transform.localScale    = new Vector3(0.63f, 0.63f, 0.63f);

            GameObject colliderGO = new GameObject("collider_container");

            colliderGO.transform.SetParent(_GameObject.transform, false);
            colliderGO.transform.localPosition = new Vector3(0f, 0.13f, 0.02f);
            colliderGO.transform.localScale    = new Vector3(1f, 1f, 1f);
            colliderGO.transform.localRotation = Quaternion.Euler(7f, 358f, 355f);

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

            boxCollider.size   = new Vector3(0.13f, 0.83f, 0.05f);
            boxCollider.center = new Vector3(0f, 0.12f, 0f);

            Object.DestroyImmediate(_GameObject.FindChild("Cube"));
            Object.DestroyImmediate(_GameObject.FindChild("alien_relic_08_world_rot"));
            Object.DestroyImmediate(_GameObject.GetComponent <ImmuneToPropulsioncannon>());
            Object.DestroyImmediate(_GameObject.GetComponent <CapsuleCollider>());
            Object.DestroyImmediate(_GameObject.GetComponent <EntityTag>());

            _GameObject.EnsureComponent <PrefabIdentifier>().ClassId   = ClassID;
            _GameObject.EnsureComponent <TechTag>().type               = TechType;
            _GameObject.EnsureComponent <Pickupable>().isPickupable    = true;
            _GameObject.EnsureComponent <LargeWorldEntity>().cellLevel = LargeWorldEntity.CellLevel.Near;

            _GameObject.EnsureComponent <VFXSurface>();
            _GameObject.EnsureComponent <EcoTarget>();
            _GameObject.EnsureComponent <FMOD_CustomEmitter>();
            _GameObject.EnsureComponent <StudioEventEmitter>();

            SkyApplier skyApplier = _GameObject.EnsureComponent <SkyApplier>();

            skyApplier.renderers = _GameObject.GetComponentsInChildren <MeshRenderer>();
            skyApplier.anchorSky = Skies.Auto;

            Rigidbody rigidbody = _GameObject.EnsureComponent <Rigidbody>();

            rigidbody.useGravity = false;

            WorldForces worldForces = _GameObject.EnsureComponent <WorldForces>();

            worldForces.underwaterGravity = 1f;
            worldForces.handleGravity     = true;
            worldForces.aboveWaterDrag    = 1f;
            worldForces.underwaterDrag    = 0.00001f;
            worldForces.handleDrag        = true;
            worldForces.useRigidbody      = rigidbody;

            VFXFabricating vfxFabricating = modelGO.EnsureComponent <VFXFabricating>();

            vfxFabricating.localMinY   = -0.4f;
            vfxFabricating.localMaxY   = 0.2f;
            vfxFabricating.posOffset   = new Vector3(-0.054f, 0f, -0.06f);
            vfxFabricating.eulerOffset = new Vector3(0f, 0f, 90f);
            vfxFabricating.scaleFactor = 1f;

            AncientSword component = _GameObject.EnsureComponent <AncientSword>();

            Knife knife = Resources.Load <GameObject>("WorldEntities/Tools/Knife").GetComponent <Knife>();

            component.mainCollider        = boxCollider;
            component.socket              = PlayerTool.Socket.RightHand;
            component.ikAimRightArm       = true;
            component.attackSound         = Object.Instantiate(knife.attackSound, _GameObject.transform);
            component.underwaterMissSound = Object.Instantiate(knife.underwaterMissSound, _GameObject.transform);
            component.surfaceMissSound    = Object.Instantiate(knife.surfaceMissSound, _GameObject.transform);

            return(_GameObject);
        }