Ejemplo n.º 1
0
        public virtual void Initializa(long local_player_pstid, CombatStartInfo combat_start_info)
        {
            //真正的local_player_pstid在局外,传进来就好;combat_start_info是给所有玩家、观战者、以及录像回放时,都一致的消息
            m_local_player_pstid = local_player_pstid;
            m_level_data         = GetConfigProvider().GetLevelData(combat_start_info.m_level_id);
            m_state            = CombatClientState.Loading;
            m_state_frame_cnt  = 0;
            m_state_start_time = -1;
            m_last_update_time = -1;
            m_waiting_cnt      = 0;
#if UNITY_EDITOR
            m_is_first_frame = true;
#endif

            AttributeSystem.Instance.InitializeAllDefinition(m_combat_factory.GetConfigProvider());
            ComponentTypeRegistry.RegisterDefaultComponents();
            BehaviorTreeNodeTypeRegistry.RegisterDefaultNodes();
            DamageModifier.RegisterDefaultModifiers();
            m_combat_factory.RegisterCommands();

            BehaviorTreeFactory.Instance.SetConfigProvider(m_combat_factory.GetConfigProvider());

            m_logic_world = m_combat_factory.CreateLogicWorld();
            m_logic_world.Initialize(this, combat_start_info.m_world_seed, true);
            m_render_world = m_combat_factory.CreateRenderWorld();
            m_render_world.Initialize(this, m_logic_world);
            m_logic_world.SetIRenderWorld(m_render_world);
            m_sync_client = m_combat_factory.CreateSyncClient();
            m_sync_client.Init(m_logic_world);

            BuildLogicWorld(combat_start_info);
            BuildRenderWorld(m_level_data);
        }
 public void AddModifier(DamageModifier modifier)
 {
     if (m_modifiers == null)
     {
         m_modifiers = new List <DamageModifier>();
     }
     m_modifiers.Add(modifier);
 }
 protected override void OnDestruct()
 {
     if (m_modifiers != null)
     {
         for (int i = 0; i < m_modifiers.Count; ++i)
         {
             DamageModifier.Recycle(m_modifiers[i]);
         }
         m_modifiers.Clear();
     }
 }
 public bool RemoveModifier(int modifier_id)
 {
     if (m_modifiers == null)
     {
         return(false);
     }
     for (int i = 0; i < m_modifiers.Count; ++i)
     {
         if (m_modifiers[i].ID == modifier_id)
         {
             DamageModifier.Recycle(m_modifiers[i]);
             m_modifiers.RemoveAt(i);
             return(true);
         }
     }
     return(false);
 }
        public override void Apply()
        {
            if (m_modifier_type == 0)
            {
                return;
            }
            Entity owner_entity = GetOwnerEntity();
            DamageModificationComponent damage_modification_component = owner_entity.GetComponent(DamageModificationComponent.ID) as DamageModificationComponent;

            if (damage_modification_component == null)
            {
                return;
            }
            DamageModifier modifier = DamageModifier.Create(m_modifier_type);

            if (modifier == null)
            {
                return;
            }
            m_modifier_id = GetLogicWorld().GenerateDamageModifierID();
            modifier.Contruct(m_modifier_id, m_variables);
            damage_modification_component.AddModifier(modifier);
        }
Ejemplo n.º 6
0
 public static void Recycle(DamageModifier instance)
 {
     ResuableObjectFactory <DamageModifier> .Recycle(instance);
 }