/// <summary> /// Create a GameObject with a certain amount of health, possible active, and /// can fire a GameObjectCreatedEvent /// </summary> /// <param name="manager">The manager which will fire the GameObjectCreatedEvent</param> /// <param name="health"></param> /// <param name="active"></param> /// <param name="fireOnCreateEvent"></param> public GameObject(GameEventManager manager, int health, bool active, bool fireOnCreateEvent) { ColorScheme = new ColorScheme<Hostility>(); PhysicsComponent = new PhysicsComponent(); Behaviors = new List<IBehavior>(); Active = active; Timescale = 1; Health = health; if (fireOnCreateEvent && GameEventManager != null) GameEventManager.AddEvent(new GameObjectCreatedEvent(this)); }
/// <summary> /// Create a deactived GameObject with 0 health, and fire a GameObjectCreatedEvent /// </summary> /// <param name="manager">The manager which will fire the GameObjectCreatedEvent</param> public GameObject(GameEventManager manager) : this(manager, 0, false, true) { }