Esempio n. 1
0
    public override void OnEntityDestroy(EntityBase entity)
    {
        RecordComponent rc = m_world.GetSingletonComp <RecordComponent>();

        ChangeRecordInfo info = new ChangeRecordInfo();

        info.m_type    = ChangeType.DestroyEntity;
        info.m_EnityID = entity.ID;

        rc.m_changeCache.Add(info);
    }
Esempio n. 2
0
    public override void OnEntityCompRemove(EntityBase entity, string compName, ComponentBase component)
    {
        RecordComponent rc = m_world.GetSingletonComp <RecordComponent>();

        ChangeRecordInfo info = new ChangeRecordInfo();

        info.m_type     = ChangeType.RemoveComp;
        info.m_EnityID  = entity.ID;
        info.m_compName = compName;
        info.m_comp     = component;

        rc.m_changeCache.Add(info);
    }
Esempio n. 3
0
    public void RevertByChangeRecordInfo(ChangeRecordInfo info)
    {
        switch (info.m_type)
        {
        case ChangeType.AddComp: RevertAddComp(info); break;

        case ChangeType.ChangeComp: RevertChangeComp(info); break;

        case ChangeType.RemoveComp: RevertRemoveComp(info); break;

        case ChangeType.CreateEntity: RevertCreateEntity(info); break;

        case ChangeType.DestroyEntity: RevertDestroyEntity(info); break;
        }
    }
Esempio n. 4
0
 public void RevertDestroyEntity(ChangeRecordInfo info)
 {
     m_world.CreateEntity(info.m_EnityID);
 }
Esempio n. 5
0
    public void RevertRemoveComp(ChangeRecordInfo info)
    {
        EntityBase entity = m_world.GetEntity(info.m_EnityID);

        entity.AddComp(info.m_compName, info.m_comp);
    }