Beispiel #1
0
        public static void RemoveEComponent(this IEComponent src, IEComponent ec)
        {
            Dictionary <Type, IEComponent> ecs;

            if (goecs.TryGetValue(ec.go, out ecs))
            {
                Type type = ec.GetECType();
                if (ecs.ContainsKey(type))
                {
                    ecs.Remove(type);
                }

                if (ecs.Count == 0)
                {
                    goecs.Remove(ec.go);
                }
            }
        }
Beispiel #2
0
        public static void AddEComponent(this IEComponent src, IEComponent ec)
        {
            Dictionary <Type, IEComponent> ecs;

            if (!goecs.TryGetValue(ec.go, out ecs))
            {
                ecs = new Dictionary <Type, IEComponent>();
                goecs.Add(ec.go, ecs);
            }

            Type type = ec.GetECType();

            if (ecs.ContainsKey(type))
            {
                ecs[type] = ec;
            }
            else
            {
                ecs.Add(type, ec);
            }
        }