Beispiel #1
0
        public GameComponent(ComponentManager Manager) : this()
        {
            System.Diagnostics.Debug.Assert(Manager != null, "Manager cannot be null");

            World  = Manager.World;
            Parent = null;

            Manager.AddComponent(this);
        }
Beispiel #2
0
        public GameComponent(ComponentManager Manager) : this()
        {
            global::System.Diagnostics.Debug.Assert(Manager != null, "Manager cannot be null");

            Children = new List <GameComponent>();
            Tags     = new List <string>();
            Name     = "uninitialized";

            Flags  = Flag.Active | Flag.Visible | Flag.ShouldSerialize;
            World  = Manager.World;
            Parent = null;

            Manager.AddComponent(this);
        }
Beispiel #3
0
        public Egg(string adult, ComponentManager manager, Vector3 position) :
            base(false, manager)
        {
            Adult    = adult;
            Birthday = Manager.World.Time.CurrentDate + new TimeSpan(0, 12, 0, 0);

            if (ResourceLibrary.GetResourceByName(adult + " Egg") == null)
            {
                Resource newEggResource =
                    new Resource(ResourceLibrary.GetResourceByName(ResourceLibrary.ResourceType.Egg));
                newEggResource.Type = adult + " Egg";
                ResourceLibrary.Add(newEggResource);
            }
            ParentBody = EntityFactory.CreateEntity <Body>(adult + " Egg Resource", position);
            ParentBody.AddChild(this);
            manager.AddComponent(this);
        }
Beispiel #4
0
        public GameComponent(ComponentManager Manager) : this()
        {
            global::System.Diagnostics.Debug.Assert(Manager != null, "Manager cannot be null");

            Children = new List <GameComponent>();
            Tags     = new List <string>();
            Name     = "uninitialized";

            Flags  = Flag.Active | Flag.Visible | Flag.ShouldSerialize;
            Parent = null;

            if (Manager == null)
            {
                throw new InvalidProgramException("Null manager given to game component.");
            }

            World = Manager.World;
            Manager.AddComponent(this);
        }