Example #1
0
        public Pawn Clone()
        {
            Pawn copy = new Pawn()
            {
                _board    = _board,
                _position = _position
            };

            for (int i = 0; i < _componentOrder.Count; i++)
            {
                PawnComponent component = _componentOrder[i].Copy();
            }

            return(copy);
        }
Example #2
0
        public PawnComponent AddComponent(PawnComponent component)
        {
            List <PawnComponent> components;
            int id = component.ComponentID;

            if (!_components.TryGetValue(id, out components))
            {
                components      = new List <PawnComponent>();
                _components[id] = components;
            }
            if (!components.Contains(component))
            {
                components.Add(component);
                _componentOrder.Add(component);
            }
            component.OnAdd(this);
            return(component);
        }