Ejemplo n.º 1
0
        void Awake()
        {
            projectileSingle = gameObject.GetComponent <ProjectileSingleTargetImpact>();
            length           = 1;

            projectileSingle.destroyOnWorld = false;
        }
Ejemplo n.º 2
0
 public void Awake()
 {
     this.stickOnImpact        = base.GetComponent <ProjectileStickOnImpact>();
     this.projectileController = base.GetComponent <ProjectileController>();
     this.projectileDamage     = base.GetComponent <ProjectileDamage>();
     this.singleTargetImpact   = base.GetComponent <ProjectileSingleTargetImpact>();
     this.stickOnImpact.stickEvent.AddListener(this.OnStickEvent);
 }
 void Awake()
 {
     projectileDamage             = gameObject.GetComponent <ProjectileDamage>();
     projectileSingleTargetImpact = gameObject.GetComponent <ProjectileSingleTargetImpact>();
     if (!projectileDamage || !projectileSingleTargetImpact)
     {
         enabled = false;
         return;
     }
 } //nullcheck
Ejemplo n.º 4
0
        //Adds nano beacon to the projectile register list
        internal static void RegisterNanoBeacon()
        {
            //Nab the projectile that's usually used for MUL-T scrap launcher
            nanoBeaconPrefab = LegacyResourcesAPI.Load <GameObject>("prefabs/projectiles/toolbotgrenadelauncherprojectile").InstantiateClone("NanoBeacon", true);
            //Ofc check if it actually exists
            if (nanoBeaconPrefab)
            {
                //Make it move at our own speed of choice
                nanoBeaconPrefab.GetComponent <ProjectileSimple>().desiredForwardSpeed = 140f;

                //Make it so it won't kersplode itself on impact
                ProjectileSingleTargetImpact nanoBeaconSingle = nanoBeaconPrefab.AddComponent <ProjectileSingleTargetImpact>();
                nanoBeaconSingle.destroyWhenNotAlive = false;
                nanoBeaconSingle.destroyOnWorld      = false;

                //This timed buff only applies on direct hit with nano beacon
                ProjectileInflictTimedBuff nanoDebuff = nanoBeaconPrefab.AddComponent <ProjectileInflictTimedBuff>();
                nanoDebuff.buffDef = BuffsLoading.buffDefTracking;
                //Tracking lasts for 5 seconds from this
                nanoDebuff.duration = 5f;

                //We do in fact want it to stick on impact
                ProjectileStickOnImpact nanoBeaconStick = nanoBeaconPrefab.AddComponent <ProjectileStickOnImpact>();
                //This makes it so it doesn't pass through anything
                nanoBeaconStick.ignoreCharacters = false;
                nanoBeaconStick.ignoreWorld      = false;
                //If we enable this the beacon sticks at gross angles, it feels more natural this way
                nanoBeaconStick.alignNormals = false;

                //This handles the 'explosion' of the beacon, we are changing it a lot
                ProjectileImpactExplosion nanoBeaconExplosion = nanoBeaconPrefab.GetComponent <ProjectileImpactExplosion>();
                //No more self-destruction
                nanoBeaconExplosion.destroyOnEnemy = false;
                nanoBeaconExplosion.destroyOnWorld = false;
                //No more blast radius
                nanoBeaconExplosion.blastRadius = 0f;
                //Live 'forever' or until our code says we want it to vanish
                nanoBeaconExplosion.lifetime = 100f;
                //Which is here, it should die 3.5 seconds after impact
                nanoBeaconExplosion.lifetimeAfterImpact = 3.5f;
                //No damage for the blast
                nanoBeaconExplosion.blastDamageCoefficient = 0f;
                //No blast force
                nanoBeaconExplosion.bonusBlastForce = Vector3.zero;
                //Basically no blast, so no falloffmodel either
                nanoBeaconExplosion.falloffModel = BlastAttack.FalloffModel.None;

                //This is our component that 'talks' to the MUL-T player's swarm component
                nanoBeaconPrefab.AddComponent <OnStuckCaller>();

                //Add it to the list
                projList.Add(nanoBeaconPrefab);
            }
        }
Ejemplo n.º 5
0
        private static GameObject CreateKnifeProjectile()
        {
            GameObject obj = PrefabsCore.CreatePrefab("KnifeProjectile", true);

            obj.layer = LayerIndex.projectile.intVal;
            _         = obj.AddOrGetComponent <NetworkIdentity>();
            _         = obj.AddOrGetComponent <TeamFilter>();



            ProjectileController projControl = obj.AddOrGetComponent <ProjectileController>();

            projControl.allowPrediction      = false;
            projControl.catalogIndex         = -1;
            projControl.ghostPrefab          = null; // FUTURE: Knife projectile ghost
            projControl.ghostTransformAnchor = null;
            projControl.owner           = null;
            projControl.procCoefficient = 1f;
            projControl.startSound      = null; // FUTURE: Knife start sound


            Rigidbody rb = obj.AddOrGetComponent <Rigidbody>();

            rb.mass                   = 1f;
            rb.drag                   = 0.6f;
            rb.angularDrag            = 0.05f;
            rb.useGravity             = true;
            rb.isKinematic            = false;
            rb.interpolation          = RigidbodyInterpolation.Interpolate;
            rb.collisionDetectionMode = CollisionDetectionMode.Continuous;


            ProjectileNetworkTransform projNetTrans = obj.AddOrGetComponent <ProjectileNetworkTransform>();

            projNetTrans.positionTransmitInterval = 0.033333334f;
            projNetTrans.interpolationFactor      = 1f;
            projNetTrans.allowClientsideCollision = false;


            ProjectileStickOnImpact projStick = obj.AddOrGetComponent <ProjectileStickOnImpact>();

            projStick.alignNormals     = false;
            projStick.ignoreCharacters = false;
            projStick.ignoreWorld      = false;
            projStick.stickEvent       = new UnityEngine.Events.UnityEvent();


            ProjectileSingleTargetImpact projImpact = obj.AddOrGetComponent <ProjectileSingleTargetImpact>();

            projImpact.destroyOnWorld      = false;
            projImpact.destroyWhenNotAlive = false;
            projImpact.enemyHitSoundString = null; // FUTURE: Knife hit sound
            projImpact.hitSoundString      = null; // FUTURE: Knife world hit sound
            projImpact.impactEffect        = null; // FUTURE: Knife impact effect


            ProjectileSimple projSimple = obj.AddOrGetComponent <ProjectileSimple>();

            projSimple.enableVelocityOverLifetime = false;
            projSimple.lifetime             = 18f;
            projSimple.updateAfterFiring    = false;
            projSimple.velocity             = 175f;
            projSimple.velocityOverLifetime = null;


            SphereCollider col = obj.AddOrGetComponent <SphereCollider>();

            col.center        = Vector3.zero;
            col.contactOffset = 0f;
            col.isTrigger     = false;
            col.material      = null;
            col.radius        = 0.3f;


            ProjectileDamage damage = obj.AddOrGetComponent <ProjectileDamage>();

            damage.crit             = false;
            damage.damage           = 0f;
            damage.damageColorIndex = DamageColorIndex.Default;
            damage.force            = 0f;

            var debuff = obj.AddOrGetComponent <ProjectileInflictTimedBuff>();

            debuff.duration = CatalogModule.resetDuration * 2f;

            _ = obj.AddOrGetComponent <Deployable>();

            _ = obj.AddOrGetComponent <KnifeDeployableSync>();


            SphereCollider ownerDetection = obj.AddComponent <SphereCollider>();

            ownerDetection.isTrigger = true;
            ownerDetection.radius    = 10f;



            foreach (IRuntimePrefabComponent runtimePrefabComp in obj.GetComponents <IRuntimePrefabComponent>())
            {
                runtimePrefabComp.InitializePrefab();
            }
            return(obj);
        }
Ejemplo n.º 6
0
        private void CreateLightningSword(Int32 meshInd)
        {
            GameObject ghost = this.CreateLightningSwordGhost(meshInd);
            GameObject proj  = Resources.Load <GameObject>("Prefabs/Projectiles/LunarNeedleProjectile").InstantiateClone("LightningSwordProjectile" + meshInd.ToString());

            ProjectileCatalog.getAdditionalEntries += (list) => list.Add(proj);

            AltArtiPassive.lightningProjectile[meshInd] = proj;

            ProjectileController projController = proj.GetComponent <ProjectileController>();

            projController.ghostPrefab     = ghost;
            projController.procCoefficient = 0.2f;

            ProjectileSimple projSimple = proj.GetComponent <ProjectileSimple>();

            projSimple.enabled = true;
            projSimple.enableVelocityOverLifetime = false;
            projSimple.velocity = 60f;


            ProjectileDirectionalTargetFinder projTargetFind = proj.GetComponent <ProjectileDirectionalTargetFinder>();

            projTargetFind.enabled = false;

            ProjectileSteerTowardTarget projSteering = proj.GetComponent <ProjectileSteerTowardTarget>();

            projSteering.enabled       = true;
            projSteering.rotationSpeed = 140f;

            ProjectileStickOnImpact projStick = proj.GetComponent <ProjectileStickOnImpact>();

            //projStick.ignoreCharacters = false;
            //projStick.ignoreWorld = false;
            projStick.alignNormals = false;

            ProjectileImpactExplosion projExpl = proj.GetComponent <ProjectileImpactExplosion>();

            projExpl.impactEffect                  = Resources.Load <GameObject>("Prefabs/Effects/LightningStakeNova");
            projExpl.explosionSoundString          = "Play_item_lunar_primaryReplace_impact";
            projExpl.lifetimeExpiredSoundString    = "";
            projExpl.offsetForLifetimeExpiredSound = 0f;
            projExpl.destroyOnEnemy                = false;
            projExpl.destroyOnWorld                = false;
            projExpl.timerAfterImpact              = true;
            projExpl.falloffModel                  = BlastAttack.FalloffModel.None;
            projExpl.lifetime                  = 10f;
            projExpl.lifetimeAfterImpact       = 1f;
            projExpl.lifetimeRandomOffset      = 0f;
            projExpl.blastRadius               = 1f;
            projExpl.blastDamageCoefficient    = 1f;
            projExpl.blastProcCoefficient      = 0.2f;
            projExpl.bonusBlastForce           = Vector3.zero;
            projExpl.fireChildren              = false;
            projExpl.childrenProjectilePrefab  = null;
            projExpl.childrenCount             = 0;
            projExpl.childrenDamageCoefficient = 0f;
            projExpl.minAngleOffset            = Vector3.zero;
            projExpl.maxAngleOffset            = Vector3.zero;
            projExpl.transformSpace            = ProjectileImpactExplosion.TransformSpace.World;
            projExpl.projectileHealthComponent = null;

            ProjectileSingleTargetImpact projStimp = proj.GetComponent <ProjectileSingleTargetImpact>();

            projStimp.destroyOnWorld      = false;
            projStimp.hitSoundString      = "Play_item_proc_dagger_impact";
            projStimp.enemyHitSoundString = "Play_item_proc_dagger_impact";


            proj.AddComponent <Components.SoundOnAwake>().sound = "Play_item_proc_dagger_spawn";

            //UnityEngine.Object.DestroyImmediate( proj.GetComponent<ProjectileSingleTargetImpact>() );
            UnityEngine.Object.Destroy(proj.GetComponent <AwakeEvent>());
            UnityEngine.Object.Destroy(proj.GetComponent <DelayedEvent>());
        }