/// <summary> /// 角色Entiy 被销毁时 /// </summary> public override void OnDestroy() { base.OnDestroy(); m_ISpacecraftSkillProperty.SetChangeGuideSkillTargetAction(null); m_ISpacecraftSkillProperty.SetSkillBttonIsDown(false); SkillRPCNet skillRPC = m_Context.GetObject <SkillRPCNet>(); if (skillRPC != null) { skillRPC.Close(); } skillRPC = null; m_Context.Clear(true); m_RunningData = null; m_CfgEternityProxy = null; m_Context = null; m_StateMachine = null; m_ISpacecraftSkillProperty = null; }
public override void OnInitialize(ISpacecraftSkillProperty property) { m_ISpacecraftSkillProperty = property; m_CfgEternityProxy = GameFacade.Instance.RetrieveProxy(ProxyName.CfgEternityProxy) as CfgEternityProxy; m_PlayerSkillProxy = GameFacade.Instance.RetrieveProxy(ProxyName.PlayerSkillProxy) as PlayerSkillProxy; m_Context = new DefaultContext(); m_RunningData = new SkillRunningData(); m_Context.AddObject(this, true); m_Context.AddObject(typeof(IActionFactory), TimelineActionFactory.Factory, true); m_Context.AddObject(m_RunningData, true); m_Context.AddObject(typeof(IBaseActionProperty), property, true); m_Context.AddObject(typeof(IBindNodeActionProperty), property, true); ContextAddOtherObject(); m_StateMachine = new SkillStateMachine(m_Context); m_StateMachine.CompletedHandler += OnStateMachineComplete; m_StateMachine.ChangedHandler += OnStateMachineChanged; }