public PoolObjHandle <BulletSkill> SpawnBullet(SkillUseContext context, string _actionName, bool _bDeadRemove) { PoolObjHandle <BulletSkill> handle = new PoolObjHandle <BulletSkill>(); if (context != null) { BulletSkill item = ClassObjPool <BulletSkill> .Get(); item.Init(_actionName, _bDeadRemove); if (item.Use(base.actorPtr, context.Clone())) { this.SpawnedBullets.Add(item); return(new PoolObjHandle <BulletSkill>(item)); } item.Release(); } return(handle); }
public bool SpawnBuff(PoolObjHandle <ActorRoot> inTargetActor, SkillUseContext inContext, int inSkillCombineId, bool bExtraBuff = false) { if (((inTargetActor == 0) || (inContext == null)) || (inSkillCombineId <= 0)) { return(false); } BuffSkill skill = ClassObjPool <BuffSkill> .Get(); skill.Init(inSkillCombineId); SkillUseContext context = inContext.Clone(); context.EffectPos = inContext.EffectPos; context.EffectDir = inContext.EffectDir; context.TargetActor = inTargetActor; context.Instigator = base.actor; skill.bExtraBuff = bExtraBuff; bool flag = skill.Use(base.actorPtr, context); if (!flag) { skill.Release(); } return(flag); }
public override bool Use(PoolObjHandle <ActorRoot> user, SkillUseContext context) { if (((context == null) || (context.TargetActor == 0)) || (this.cfgData == null)) { return(false); } this.skillContext = context.Clone(); BuffHolderComponent buffHolderComp = context.TargetActor.handle.BuffHolderComp; if (buffHolderComp == null) { return(false); } if (!this.CheckUseRule(context)) { return(false); } if (!buffHolderComp.overlayRule.CheckOverlay(this)) { return(false); } bool flag = false; bool flag2 = false; VInt3 forward = VInt3.forward; switch (context.AppointType) { case SkillRangeAppointType.Pos: flag = true; break; case SkillRangeAppointType.Directional: flag2 = true; forward = context.UseVector; break; case SkillRangeAppointType.Track: flag = true; flag2 = true; forward = context.EndVector - context.UseVector; if (forward.sqrMagnitudeLong < 1L) { forward = VInt3.forward; } break; } GameObject obj2 = (context.Originator == 0) ? null : context.Originator.handle.gameObject; GameObject obj3 = (context.TargetActor == 0) ? null : context.TargetActor.handle.gameObject; GameObject[] objArray1 = new GameObject[] { obj2, obj3 }; base.curAction = ActionManager.Instance.PlayAction(base.ActionName, true, false, objArray1); if (base.curAction == null) { return(false); } base.curAction.onActionStop += new ActionStopDelegate(this.OnActionStoped); base.curAction.refParams.AddRefParam("SkillObj", this); base.curAction.refParams.AddRefParam("SkillContext", context); base.curAction.refParams.AddRefParam("TargetActor", context.TargetActor); base.curAction.refParams.SetRefParam("_BulletPos", context.EffectPos); base.curAction.refParams.SetRefParam("_BulletDir", context.EffectDir); if (flag) { base.curAction.refParams.SetRefParam("_TargetPos", context.UseVector); } if (flag2) { base.curAction.refParams.SetRefParam("_TargetDir", forward); } if (this.cfgData != null) { SkillSlotType slotType = context.SlotType; int iDuration = this.cfgData.iDuration; if ((slotType >= SkillSlotType.SLOT_SKILL_1) && (slotType <= SkillSlotType.SLOT_SKILL_3)) { int skillLevel = 1; if ((context.Originator != 0) && (context.Originator.handle.SkillControl != null)) { SkillSlot slot = null; context.Originator.handle.SkillControl.TryGetSkillSlot(slotType, out slot); if (slot != null) { skillLevel = slot.GetSkillLevel(); } } skillLevel = (skillLevel >= 1) ? skillLevel : 1; iDuration += (skillLevel - 1) * this.cfgData.iDurationGrow; } base.curAction.ResetLength(iDuration, false); if (this.cfgData.dwEffectType == 2) { this.DealTenacity(context.TargetActor); } } context.TargetActor.handle.BuffHolderComp.AddBuff(this); if (this.cfgData.dwShowType != 0) { SpawnBuffEventParam param = new SpawnBuffEventParam(this.cfgData.dwShowType, context.TargetActor); Singleton <GameSkillEventSys> .GetInstance().SendEvent <SpawnBuffEventParam>(GameSkillEventDef.Event_SpawnBuff, context.TargetActor, ref param, GameSkillEventChannel.Channel_HostCtrlActor); } if ((this.cfgData.dwEffectType == 2) && (this.cfgData.dwShowType != 2)) { LimitMoveEventParam param2 = new LimitMoveEventParam(base.CurAction.length, base.SkillID, context.TargetActor); Singleton <GameSkillEventSys> .GetInstance().SendEvent <LimitMoveEventParam>(GameSkillEventDef.Event_LimitMove, context.TargetActor, ref param2, GameSkillEventChannel.Channel_AllActor); } return(true); }