예제 #1
0
        public bool RemoveComponent(Component component)
        {
            if (components.Contains(component))
            {
                components.Remove(component);
                return true;
            }

            return false;
        }
예제 #2
0
 public bool AddComponent(Component component)
 {
     for (int i = 0; i < components.Count; i++)
     {
         if (components[i].GetType() == component.GetType())
             return false;
     }
     component.SetOwner(id);
     components.Add(component);
     return true;
 }
 public void AddComponent(ulong entity, Component component)
 {
 }
예제 #4
0
        public void RegisterComponent(ulong owner, Component component)
        {
            if (!entityMap.ContainsKey(owner)) return;

            if (component is DropComponent) dropSystem.AddEntity(owner, (DropComponent)component);
            if (component is ItemComponent) itemSystem.AddEntity(owner, (ItemComponent)component);
            if (component is StatModifierComponent) modifierSystem.AddEntity(owner, (StatModifierComponent)component);
            if (component is EffectComponent) effectSystem.AddEntity(owner, (EffectComponent)component);
            if (component is EquipmentComponent) equipmentSystem.AddEntity(owner, (EquipmentComponent)component);
            if (component is AIComponent) aiSystem.AddEntity(owner, (AIComponent)component);
            if (component is GearComponent)
            {
                gearSystem.AddEntity(owner, (GearComponent)component);
            }

            if (component is ExperienceComponent)
            {
                experienceSystem.AddEntity(owner, (ExperienceComponent)component);
                experienceSystem.CalculateToNext(owner);
            }
            if (component is ItemInventoryComponent) inventorySystem.AddEntity(owner, (ItemInventoryComponent)component);
            if (component is NameComponent) nameSystem.AddEntity(owner, (NameComponent)component);
            if (component is StatsComponent)
            {
                statsSystem.AddEntity(owner, (StatsComponent)component);
                statsSystem.UpdateCurrentValues(owner, null);
            }
            if (component is ProfessionComponent) professionSystem.AddEntity(owner, (ProfessionComponent)component);
            if (component is PlayerComponent) playerSystem.AddEntity(owner, (PlayerComponent)component);
            if (component is ActionComponent) actionSystem.AddEntity(owner, (ActionComponent)component);
            if (component is ActionInventoryComponent) aInventorySystem.AddEntity(owner, (ActionInventoryComponent)component);

        }
예제 #5
0
        public bool RemoveComponent(ulong owner, Component component)
        {
            if (entityMap.ContainsKey(owner))
                return entityMap[owner].RemoveComponent(component);

            return false;
        }
예제 #6
0
        public void AddComponent(ulong owner, Component component)
        {
            if (!entityMap.ContainsKey(owner))
            {
                Console.WriteLine("ENTITY DOES NOT EXIST");
                Console.ReadKey();
                return;
            }

            RegisterComponent(owner, component);
            entityMap[owner].AddComponent(component);
        }