Exemple #1
0
            public override void OnEnter()
            {
                base.OnEnter();

                Main.instance.RW_BlockSprintCrosshair.Add(base.characterBody);

                this.armorBuff = Main.RW_armorBuff;
                this.passive   = this.gameObject.GetComponent <WispPassiveController>();
                this.skin      = this.characterBody.skinIndex;
                this.aimAnim   = this.GetComponent <WispAimAnimationController>();

                this.minDuration  = baseMinDuration / this.attackSpeedStat;
                this.fireInterval = 1f / baseTickFreq;

                RoR2.Util.PlayScaledSound("Play_titanboss_R_laser_loop", this.gameObject, 0.5f);

                this.muzzle = this.GetModelTransform().Find("CannonPivot").Find("BeamParent");

                this.beamEffect = UnityEngine.Object.Instantiate <GameObject>(Main.specialBeam, this.muzzle.position, this.muzzle.rotation);
                this.beamEffect.GetComponent <BitSkinController>().Apply(WispBitSkin.GetWispSkin(this.skin));
                this.beamEffect.transform.parent = this.muzzle;
                this.beamEnd = this.beamEffect.transform.Find("End");
                //this.beamEndSub = this.beamEnd.Find( "Sub" );
                //this.beamEndSub.gameObject.SetActive( false );
                //Create the charge and beam effects
                this.pos = Vector3.zero;

                this.team = TeamComponent.GetObjectTeam(this.gameObject);

                this.characterBody.AddBuff(this.armorBuff);

                this.cameraTargetParams.idealLocalCameraPos = this.camPos1;
                this.characterMotor.useGravity = false;
            }
Exemple #2
0
            public override void Update()
            {
                base.Update();
                //Update the beam position
                if (!this.line)
                {
                    Transform muzzle = this.GetModelTransform().Find("CannonPivot").Find("AncientWispArmature").Find("Head");
                    this.line = UnityEngine.Object.Instantiate <GameObject>(Main.utilityAim, muzzle.TransformPoint(0f, 0.1f, 0f), muzzle.rotation, muzzle);
                    this.line.GetComponent <BitSkinController>().Apply(WispBitSkin.GetWispSkin(this.skin));
                    this.end            = this.line.transform.Find("lineEnd");
                    this.end.parent     = null;
                    this.end.localScale = new Vector3(2 * this.radius, 2 * this.radius, 2 * this.radius);
                }

                if (this.line)
                {
                    Ray r = this.GetAimRay();

                    RaycastHit rh;
                    //if( Physics.SphereCast( r, castRadius, out rh, maxRange, LayerIndex.world.mask | LayerIndex.entityPrecise.mask, QueryTriggerInteraction.UseGlobal ) )
                    if (Util.CharacterSpherecast(base.outer.gameObject, r, castRadius, out rh, maxRange, LayerIndex.world.mask | LayerIndex.entityPrecise.mask, QueryTriggerInteraction.UseGlobal))
                    {
                        this.end.position = rh.point;
                        this.normal       = rh.normal;
                    }
                    else
                    {
                        this.end.position = r.GetPoint(maxRange);
                        this.normal       = Vector3.up;
                    }
                }
            }
Exemple #3
0
            public override void OnEnter()
            {
                base.OnEnter();

                this.skinController = base.GetModelTransform().GetComponent <WispModelBitSkinController>();
                var model = this.skinController.GetComponent <CharacterModel>();

                this.bodyParticles = model.GetComponent <ParticleHolder>().systems[0];
                this.flareSprite   = base.gameObject.GetComponentInChildren <SpriteRenderer>();
                this.eyeFlare      = this.flareSprite.GetComponent <EyeFlare>();

                this.eyeFlare.localScale = baseFlareIntensity;
                var emis = this.bodyParticles.emission;

                emis.rateOverTime = baseEmissionRate;

                base.characterBody.skinIndex = baseSkin;

                this.skinController.Apply(WispBitSkin.GetWispSkin(baseSkin));

                this.flareSprite.color    = this.skinController.activeLightColor;
                this.flareSprite.material = this.skinController.activeTracerMaterial;


                this.weaponStateMachine = base.outer.GetComponents <EntityStateMachine>().Where <EntityStateMachine>((esm) => esm.customName == "Weapon").Single <EntityStateMachine>();
            }
            private static BurnEffectController.EffectParams GetSkinParams(UInt32 skin)
            {
                if (!skinBurnParamsCache.ContainsKey(skin))
                {
                    var tempSkin = WispBitSkin.GetWispSkin(skin);
                    skinBurnParamsCache[skin] = tempSkin.burnParams;
                }

                return(skinBurnParamsCache[skin]);
            }
            public void Start()
            {
                this.body = this.GetComponent <CharacterBody>();
                this.eye1 = this.flare1.GetComponent <EyeFlare>();
                this.eye2 = this.flare2.GetComponent <EyeFlare>();

                //var skin = body.modelLocator.modelTransform.GetComponent<WispModelBitSkinController>();

                var skin = WispBitSkin.GetWispSkin(this.body.skinIndex);

                this.flare1.color    = skin.mainColor;
                this.flare2.color    = skin.mainColor;
                this.flare1.material = skin.tracerMaterial;
                this.flare2.material = skin.tracerMaterial;
            }
Exemple #6
0
 private void Start()
 {
     this.modelRef = base.GetComponent <CharacterModel>();
     if (this.modelRef.body != null)
     {
         var ind = this.modelRef.body.skinIndex;
         if (this.modelRef.body.inventory.GetItemCount(ItemIndex.InvadingDoppelganger) > 0)
         {
             ind = (~WispBitSkin.GetWispSkin(ind)).EncodeToSkinIndex();
             this.modelRef.body.master.loadout.bodyLoadoutManager.SetSkinIndex(Main.rogueWispBodyIndex, ind);
             this.modelRef.body.skinIndex = ind;
         }
         this.Apply(WispBitSkin.GetWispSkin(ind));
     }
 }
Exemple #7
0
        private void SpawnEffect___void_EffectIndex_EffectData_Boolean_Il(ILContext il)
        {
            ILCursor c = new ILCursor(il);

            c.GotoNext(MoveType.Before, x => x.MatchCall(typeof(RoR2.EffectCatalog), "GetEffectDef"));
            c.Remove();
            c.Emit(OpCodes.Ldarg_1);
            c.EmitDelegate <Func <EffectIndex, EffectData, EffectDef> >((index, data) =>
            {
                if (skinnedEffectCache.ContainsKey(index))
                {
                    var cache   = skinnedEffectCache[index];
                    var skinInd = data.genericUInt;
                    if (cache.ContainsKey(skinInd))
                    {
                        return(cache[skinInd]);
                    }
                    else
                    {
                        var origDef        = EffectCatalog.GetEffectDef(index);
                        var skinnedPrefab  = origDef.prefab.ClonePrefab("CachedEffect", false);
                        var skinController = skinnedPrefab.GetComponent <BitSkinController>();
                        skinController.Apply(WispBitSkin.GetWispSkin(skinInd));
                        Destroy(skinController);
                        var newDef = new EffectDef()
                        {
                            cullMethod            = origDef.cullMethod,
                            index                 = index,
                            prefab                = skinnedPrefab,
                            prefabEffectComponent = skinnedPrefab.GetComponent <EffectComponent>(),
                            prefabName            = origDef.prefabName,
                            prefabVfxAttributes   = skinnedPrefab.GetComponent <VFXAttributes>(),
                            spawnSoundEventName   = origDef.spawnSoundEventName
                        };


                        cache[skinInd] = newDef;
                        return(newDef);
                    }
                }
                else
                {
                    return(EffectCatalog.GetEffectDef(index));
                }
            });
        }
Exemple #8
0
            public override void OnEnter()
            {
                base.OnEnter();

                this.duration = baseDuration / base.attackSpeedStat;

                base.PlayCrossfade("Gesture", "ChargeRHCannon", "ChargeRHCannon.playbackRate", this.duration, 0.2f);

                var muzzleTransform = base.GetModelTransform().GetComponent <ChildLocator>().FindChild("MuzzleRight");

                this.chargeInstance = UnityEngine.Object.Instantiate <GameObject>(Main.AW_primaryChargeEffect, muzzleTransform.position, muzzleTransform.rotation, muzzleTransform);
                this.chargeInstance.GetComponent <BitSkinController>().Apply(WispBitSkin.GetWispSkin(base.characterBody.skinIndex));

                base.characterBody.SetAimTimer(this.duration);

                Util.PlayScaledSound("Play_greater_wisp_attack", base.gameObject, base.attackSpeedStat * (2f / baseDuration));
                Util.PlayScaledSound("Play_greater_wisp_attack", base.gameObject, base.attackSpeedStat * (2f / baseDuration));
            }
Exemple #9
0
            private void Start()
            {
                //this.flareController = this.flare1.GetComponent<EyeFlare>();
                this.health = this.body.healthComponent;

                this.body.skinIndex = this.baseSkinIndex;

                var skin = WispBitSkin.GetWispSkin(this.baseSkinIndex);

                this.enrageSkin = WispBitSkin.GetWispSkin(this.enrageSkinIndex);

                this.bodySkin.Apply(WispBitSkin.GetWispSkin(this.baseSkinIndex));

                this.flare1.color               = skin.mainColor;
                this.flare1.material            = skin.tracerMaterial;
                this.flareController.localScale = this.baseFlareIntensity;

                var psEmis = this.bodyParticles.emission;

                psEmis.rateOverTime = this.baseEmissionRate;
            }
Exemple #10
0
        private void OnNetworkUserLoadoutChanged_Il(ILContext il)
        {
            ILCursor c = new ILCursor(il);

            c.GotoNext(MoveType.After, x => x.MatchCallvirt <RoR2.Loadout.BodyLoadoutManager>("GetSkinIndex"));
            c.Emit(OpCodes.Ldloc_3);
            c.Emit(OpCodes.Ldloc_1);
            c.EmitDelegate <Func <UInt32, Int32, CharacterSelectController.CharacterPad, UInt32> >((skinIndex, bodyIndex, pad) =>
            {
                if (bodyIndex == BodyCatalog.FindBodyIndex(this.RW_body))
                {
                    var controller = pad.displayInstance?.GetComponent <BitSkinController>();
                    if (!controller)
                    {
                        controller = pad.displayInstance?.GetComponentInChildren <BitSkinController>();
                    }
                    controller?.Apply(WispBitSkin.GetWispSkin(skinIndex));
                }

                return(skinIndex);
            });
        }
Exemple #11
0
        private void Start_On3(HooksCore.RoR2.Projectile.ProjectileController.Start.Orig orig, ProjectileController self)
        {
            if (skinnedGhostCache.ContainsKey(self.catalogIndex) && self.owner != null)
            {
                //Main.LogI( "SkinnedProjectile" );
                var skinInd = self.owner.GetComponent <CharacterBody>().skinIndex;
                var cache   = skinnedGhostCache[self.catalogIndex];
                if (cache.ContainsKey(skinInd))
                {
                    //Main.LogI( "Cached ghost found" );
                    self.ghostPrefab = cache[skinInd];
                }
                else
                {
                    //Main.LogI( "Generating ghost" );
                    var origGhost  = self.ghostPrefab;
                    var newGhost   = origGhost.ClonePrefab("CachedProjectileGhost", false);
                    var controller = newGhost.GetComponent <BitSkinController>();
                    controller.Apply(WispBitSkin.GetWispSkin(skinInd));
                    UnityEngine.Object.Destroy(controller);
                    cache[skinInd]   = newGhost;
                    self.ghostPrefab = newGhost;
                }
            }
            if (self.ghostPrefab == null)
            {
                //Main.LogI( "Null ghost prefab after skinning" );
            }

            orig(self);

            if (self.ghost == null)
            {
                //Main.LogI( "No ghost after start" );
            }
        }
Exemple #12
0
 private void Start()
 {
     this.skinController.Apply(WispBitSkin.GetWispSkin(this.effectComponent.effectData.genericUInt));
 }
Exemple #13
0
 private void AW_CacheSkins()
 {
     _ = WispBitSkin.GetWispSkin(AWDefaultMain.baseSkin);
     _ = WispBitSkin.GetWispSkin(AWEnrageTransition.enrageSkinIndex);
 }
 private void UpdateController()
 {
     this.controller.Apply(WispBitSkin.GetWispSkin(this.backingValue));
 }
Exemple #15
0
            public override void FixedUpdate()
            {
                base.inputBank.skill1.down = false;
                base.inputBank.skill2.down = false;
                base.inputBank.skill3.down = false;
                base.inputBank.skill4.down = false;

                base.inputBank.moveVector = Vector3.zero;

                base.FixedUpdate();
                var emis = this.bodyParticles.emission;

                if (base.fixedAge <= this.delayTime)
                {
                    emis.rateOverTime = Mathf.Lerp(this.initialParticleIntensity, 0f, (base.fixedAge / this.delayTime));
                }

                if (base.fixedAge >= this.animationSoundPlayTime && !this.soundComplete)
                {
                    this.soundComplete = true;
                    for (Int32 i = 0; i < 3; ++i)
                    {
                        //Util.PlayScaledSound( "Play_gravekeeper_attack1_open", base.gameObject, 1.3f );
                        //Util.PlayScaledSound( "Play_gravekeeper_attack1_open", base.gameObject, 1.6f );
                        Util.PlayScaledSound("Play_gravekeeper_attack2_charge", base.gameObject, 0.45f);
                        Util.PlayScaledSound("Play_gravekeeper_attack2_charge", base.gameObject, 0.65f);
                    }
                }

                if (base.fixedAge >= this.animationStartTime)
                {
                    if (!this.animationStarted)
                    {
                        this.animationStarted = true;

                        base.PlayCrossfade("Gesture", "Enrage", "Enrage.playbackRate", this.animationDuration, 0.2f);
                    }

                    if (base.fixedAge >= this.animationParticleSurgeTime && !this.surgeComplete)
                    {
                        this.surgeComplete = true;

                        this.skinController.Apply(WispBitSkin.GetWispSkin(enrageSkinIndex));
                        base.characterBody.skinIndex = enrageSkinIndex;
                        this.flareSprite.color       = this.skinController.activeLightColor;
                        this.flareSprite.material    = this.skinController.activeTracerMaterial;
                        this.eyeFlare.localScale     = enrageFlareIntensity;
                        emis.rateOverTime            = enrageEmissionRate;

                        if (NetworkServer.active)
                        {
                            base.characterBody.AddBuff(BuffIndex.EnrageAncientWisp);
                            base.characterBody.inventory?.GiveItem(ItemIndex.AlienHead, 1);
                            base.characterBody.inventory?.GiveItem(ItemIndex.Syringe, 2);
                        }
                    }
                }

                if (base.fixedAge >= this.duration && base.isAuthority)
                {
                    base.outer.SetNextState(new AWEnrageMainState());
                }
            }