コード例 #1
0
ファイル: StandardMain.cs プロジェクト: Reinms/RoR2Modding
            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>();
            }
コード例 #2
0
ファイル: Incineration.cs プロジェクト: Reinms/RoR2Modding
            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;
            }
コード例 #3
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;
                    }
                }
            }
コード例 #4
0
ファイル: WispBurnManager.cs プロジェクト: Reinms/RoR2Modding
            private static BurnEffectController.EffectParams GetSkinParams(UInt32 skin)
            {
                if (!skinBurnParamsCache.ContainsKey(skin))
                {
                    var tempSkin = WispBitSkin.GetWispSkin(skin);
                    skinBurnParamsCache[skin] = tempSkin.burnParams;
                }

                return(skinBurnParamsCache[skin]);
            }
コード例 #5
0
        internal override void Apply(IBitSkin skin)
        {
            if (!(skin is WispBitSkin))
            {
                throw new ArgumentException("Provided skin was not a WispBitSkin");
            }
            var tempSkin = skin as WispBitSkin;
            var oldCode  = Convert.ToString(this.skin.EncodeToSkinIndex(), 2).PadLeft(32, '0');
            var newCode  = Convert.ToString(tempSkin.EncodeToSkinIndex(), 2).PadLeft(32, '0');

            this.skin = tempSkin;
            var appliedCode = Convert.ToString(this.skin.EncodeToSkinIndex(), 2).PadLeft(32, '0');
            //Main.LogI( String.Format( "Skin changed\n{0}\n{1}\n{2}", oldCode, newCode, appliedCode ) );
        }
コード例 #6
0
            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;
            }
コード例 #7
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));
     }
 }
コード例 #8
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));
                }
            });
        }
コード例 #9
0
ファイル: ChargePrimary.cs プロジェクト: Reinms/RoR2Modding
            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));
            }
コード例 #10
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;
            }
コード例 #11
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);
            });
        }
コード例 #12
0
 private void OnSkinChanged(WispBitSkin newSkin)
 {
     this.activeArmorMaterial             = newSkin.armorMainMaterial;
     this.activeFlameMaterial             = newSkin.flameMainMaterial;
     this.activeTracerMaterial            = newSkin.tracerMaterial;
     this.activeFlamePillarMaterial       = newSkin.flamePillarMaterial;
     this.activeAreaIndicatorMaterial     = newSkin.areaIndicatorMaterial;
     this.activeAreaIndicatorMaterial2    = newSkin.areaIndicatorMaterial2;
     this.activeExplosionMaterial         = newSkin.explosionMaterial;
     this.activeBeamMaterial              = newSkin.beamMaterial;
     this.activeDistortionLightMaterial   = newSkin.distortionLightMaterial;
     this.activeDistortionMaterial        = newSkin.distortionMaterial;
     this.activeDistortionHeavyMaterial   = newSkin.distortionHeavyMaterial;
     this.activeArcaneCircleMaterial      = newSkin.arcaneCircleMaterial;
     this.activeFlameTornadoMaterial      = newSkin.flameTornadoMaterial;
     this.activeBossAreaIndicatorMaterial = newSkin.bossAreaIndicatorMaterial;
     this.activeBossAreaExplosionMaterial = newSkin.bossExplosionAreaMaterial;
     this.activeBurnMaterial              = newSkin.burnParams.overlayMaterial;
     this.activeColor         = newSkin.mainColor;
     this.activeColorGradient = newSkin.flameGradient;
     this.ApplyMaterials();
 }
コード例 #13
0
        private void OnSkinChanged(WispBitSkin newSkin)
        {
            this.currentSkinIndex = newSkin.EncodeToSkinIndex();

            this.activeFlameMaterial             = newSkin.flameMainMaterial;
            this.activeArmorMaterial             = newSkin.armorMainMaterial;
            this.activeTracerMaterial            = newSkin.tracerMaterial;
            this.activeFlamePillarMaterial       = newSkin.flamePillarMaterial;
            this.activeAreaIndicatorMaterial     = newSkin.areaIndicatorMaterial;
            this.activeAreaIndicatorMaterial2    = newSkin.areaIndicatorMaterial2;
            this.activeExplosionMaterial         = newSkin.explosionMaterial;
            this.activeBeamMaterial              = newSkin.beamMaterial;
            this.activeDistortionLightMaterial   = newSkin.distortionLightMaterial;
            this.activeDistortionMaterial        = newSkin.distortionMaterial;
            this.activeDistortionHeavyMaterial   = newSkin.distortionHeavyMaterial;
            this.activeArcaneCircleMaterial      = newSkin.arcaneCircleMaterial;
            this.activeFlameTornadoMaterial      = newSkin.flameTornadoMaterial;
            this.activeBossAreaIndicatorMaterial = newSkin.bossAreaIndicatorMaterial;
            this.activeBossAreaExplosionMaterial = newSkin.bossExplosionAreaMaterial;
            this.activeLightColor   = newSkin.mainColor;
            this.activeBurnMaterial = newSkin.burnParams.overlayMaterial;

            //if( KeyboardCore.loaded )
            //{
            //    KeyboardCore.SetKey( GlobalKeys.AllKeys, this.activeLightColor );
            //}

            //for( Byte r = 0; r < 6; ++r )
            //{
            //    for( Byte c = 0; c < 21; ++c )
            //    {
            //        KeyboardCore.SetKeyColor( r, c, newSkin.mainColor );
            //    }
            //}

            this.ApplyMaterials();
        }
コード例 #14
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" );
            }
        }
コード例 #15
0
 private void Start()
 {
     this.skinController.Apply(WispBitSkin.GetWispSkin(this.effectComponent.effectData.genericUInt));
 }
コード例 #16
0
ファイル: Transition.cs プロジェクト: Reinms/RoR2Modding
            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());
                }
            }
コード例 #17
0
 private void UpdateController()
 {
     this.controller.Apply(WispBitSkin.GetWispSkin(this.backingValue));
 }
コード例 #18
0
ファイル: General.cs プロジェクト: Reinms/RoR2Modding
 private void AW_CacheSkins()
 {
     _ = WispBitSkin.GetWispSkin(AWDefaultMain.baseSkin);
     _ = WispBitSkin.GetWispSkin(AWEnrageTransition.enrageSkinIndex);
 }