Example #1
0
    public Entity(string name, string identifier, IEntity parent, List <IEntityBehaviour> behaviours, List <IEntityData> data)
    {
        _name       = name;
        _identifier = identifier;

        _children = new List <IEntity> ();
        SetParent(parent);

        _behaviours               = new List <IEntityBehaviour> ();
        _typedBehaviours          = new Dictionary <Type, List <IEntityBehaviour> > ();
        _inheritedTypedBehaviours = new Dictionary <Type, List <IEntityBehaviour> > ();

        foreach (IEntityBehaviour b in behaviours)
        {
            AddBehaviour(b);
        }

        _data               = new List <IEntityData> ();
        _typedData          = new Dictionary <Type, List <IEntityData> > ();
        _inheritedTypedData = new Dictionary <Type, List <IEntityData> > ();

        foreach (IEntityData d in data)
        {
            AddData(d);
        }

        EntityList list = EntityList.GetInstance();

        if (list != null)
        {
            list.AddEntity(this);
        }
    }