public void Start() { if (!characterBody) { characterBody = gameObject.GetComponent <CharacterBody>(); } if (!inventory) { inventory = characterBody.inventory; } if (!huntressTracker) { huntressTracker = gameObject.GetComponent <HuntressTracker>(); } inventory.onInventoryChanged += Inventory_onInventoryChanged; }
public override void OnEnter() { base.OnEnter(); if (this.huntressTracker && base.isAuthority) { this.initialOrbTarget = this.huntressTracker.GetTrackingTarget(); } if (base.isAuthority) { this.huntressTracker = base.GetComponent <HuntressTracker>(); this.ownerPrefab = base.gameObject; CharacterBody targetBody = this.huntressTracker.GetTrackingTarget().healthComponent.body; CharacterBody ownerBody = this.ownerPrefab.GetComponent <CharacterBody>(); GameObject bodyPrefab = BodyCatalog.FindBodyPrefab(targetBody); CharacterModel summonModel = bodyPrefab.GetComponent <ModelLocator>().modelTransform.GetComponent <CharacterModel>(); summonModel.isGhost = true; IL.RoR2.Util.TryToCreateGhost += (il) => { ILCursor c = new ILCursor(il); ILCursor c2 = new ILCursor(il); FieldReference locField = null; c.GotoNext( x => x.MatchLdloc(0), //x => x.MatchLdfld("RoR2.Util/<>c__DisplayClass6_0", "targetBody"), x => x.MatchLdfld(out locField), x => x.MatchCallOrCallvirt <CharacterBody>("get_footPosition"), x => x.MatchStfld <MasterSummon>("position") ); c.Index += 1; c.RemoveRange(2); c.Emit(OpCodes.Stfld, locField); }; Util.TryToCreateGhost(targetBody, ownerBody, 10); //CharacterMaster characterMaster = MasterCatalog.allAiMasters.FirstOrDefault((CharacterMaster master) => master.bodyPrefab == summonModel.body.gameObject); //this.masterSummon = new MasterSummon(); //masterSummon.masterPrefab = characterMaster.gameObject; //masterSummon.position = ownerBody.footPosition; //CharacterDirection component = ownerBody.GetComponent<CharacterDirection>(); //masterSummon.rotation = (component ? Quaternion.Euler(0f, component.yaw, 0f) : ownerBody.transform.rotation); //masterSummon.summonerBodyObject = (ownerBody ? ownerBody.gameObject : null); //CharacterMaster characterMaster2 = masterSummon.Perform(); } }
public override void OnEnter() { base.OnEnter(); //Grab the tracking component HuntressTracker huntressTracker = base.GetComponent <HuntressTracker>(); //Find the target if (huntressTracker && base.isAuthority) { this.target = huntressTracker.GetTrackingTarget(); } //Determine the cast-time this.duration = this.baseDuration / base.attackSpeedStat; //Get the transform of the model Transform modelTransform = GetModelTransform(); //If the model transform exists if (modelTransform) { //Grab the child locator ChildLocator childLocator = modelTransform.GetComponent <ChildLocator>(); //Find the muzzle with the given string this.muzzle = childLocator.FindChild(this.assetRef.muzzleString); //Nab the animator this.animator = modelTransform.GetComponent <Animator>(); } //Play the sound based on attack speed Util.PlayAttackSpeedSound(this.assetRef.attackSoundString, base.gameObject, base.attackSpeedStat); //Make sure body exists and do the thing where it looks towards where you aim if (base.characterBody) { base.characterBody.SetAimTimer(duration + 1f); } //Play the animations base.PlayCrossfade("Gesture, Override", "FireSeekingShot", "FireSeekingShot.playbackRate", this.duration, this.duration * 0.2f / this.attackSpeedStat); base.PlayCrossfade("Gesture, Additive", "FireSeekingShot", "FireSeekingShot.playbackRate", this.duration, this.duration * 0.2f / this.attackSpeedStat); }
// Token: 0x06001D15 RID: 7445 RVA: 0x0007C73D File Offset: 0x0007A93D private static bool HasTarget([NotNull] GenericSkill skillSlot) { HuntressTracker huntressTracker = ((HuntressTrackingSkillDef.InstanceData)skillSlot.skillInstanceData).huntressTracker; return((huntressTracker != null) ? huntressTracker.GetTrackingTarget() : null); }
private void HuntressTracker_SearchForTarget(On.RoR2.HuntressTracker.orig_SearchForTarget orig, HuntressTracker self, Ray aimRay) { orig(self, aimRay); self.trackingTarget = FilterMethod(self.search.GetResults()); }