public override void Destory() { m_destroy = true; CFrameTimeMgr.Inst.RemoveEvent(m_skillLifeEventHid); //Debug.Log("destory skill:" + m_skillInfo.name); SetLogicEnable(true); CCreature cc = GetCaster(); if (cc != null) { cc.PushCommand(CmdFspStopMove.Inst); // 如果在释放技能时,操作了移动,技能释放结束修改方向 //if (cc.m_cmdFspMove != null) // cc.SetDir(GetCaster().m_cmdFspMove.m_dir); } // 销毁表现层 if (m_vSkill != null) { m_vSkill.Destory(); m_vSkill = null; } }
/// <summary> /// 工厂+依赖反转(类似面向接口编程,当然这里采用的是父类) /// 原理:控制反转:Inversion of Control,IoC,其中这里用到了 依赖注入(构造函数注入):Dependency injection, DI /// 作用:高内聚,低耦合 /// </summary> public static SkillBase Create(eSkillType type, VSkillBase vSkill) { SkillBase obj = null; switch (type) { case eSkillType.None: obj = new SkillBase(m_uid, vSkill); break; case eSkillType.Near: obj = new SkillNear(m_uid, vSkill); break; case eSkillType.Jump: obj = new SkillJump(m_uid, vSkill); break; case eSkillType.Down_Up: obj = new SkillDownUp(m_uid, vSkill); break; } Add(m_uid++, obj); return(obj); }
public void StartSkill(SkillCsvData m_skillInfo) { switch (m_skillInfo.skillType) { case (int)eSkillType.None: VSkillBase nSkill = new VSkillBase(); //nSkill.PushCommand(m_cmdFspSendSkill); m_curSkill = CSkillMgr.Create(eSkillType.None, nSkill); m_curSkill.PushCommand(m_cmdFspSendSkill); break; case (int)eSkillType.Near: VSkillNear vSkill = new VSkillNear(); //vSkill.PushCommand(m_cmdFspSendSkill); m_curSkill = (SkillNear)CSkillMgr.Create(eSkillType.Near, vSkill); m_curSkill.PushCommand(m_cmdFspSendSkill); break; case (int)eSkillType.Jump: VSkillBase vjump = new VSkillBase(); //vjump.PushCommand(m_cmdFspSendSkill); m_curSkill = (SkillJump)CSkillMgr.Create(eSkillType.Jump, vjump); m_curSkill.PushCommand(m_cmdFspSendSkill); break; case (int)eSkillType.Down_Up: VSkillDownUp vDp = new VSkillDownUp(); //vDp.PushCommand(m_cmdFspSendSkill); m_curSkill = (SkillDownUp)CSkillMgr.Create(eSkillType.Down_Up, vDp); m_curSkill.PushCommand(m_cmdFspSendSkill); break; } }
public SkillNear(int uid, VSkillBase vSkill) : base(uid, vSkill) { }
private bool m_noLaunchUp; //没发射就抬起了 public SkillDownUp(int uid, VSkillBase vSkill) : base(uid, vSkill) { m_lifeTime = 0; }
public SkillBase(long id, VSkillBase vSkill) : base(id) { m_vSkill = vSkill; }
//private bool m_canArriveEnd; public SkillJump(int uid, VSkillBase vSkill) : base(uid, vSkill) { }