protected void InitComponents() { foreach (var component in this) { component.Init(this); } foreach (var component in this) { component.AfterInit(); } ComponentsInitialized = true; OnComponentsInitialized.Invoke(); }
protected void InitComponents() { var components = _components; if (components == null) { return; } foreach (var componentPair in components) { componentPair.Value.Value.Init(this, componentPair.Key); } foreach (var component in this) { component.AfterInit(); } ComponentsInitialized = true; OnComponentsInitialized.Invoke(); }
public Mech(Parameters inParameters) { guid = inParameters.guid; owner = Program.networkManager.CurrentRoom.GetPlayer(inParameters.ownerID); bodyType = new MechBodyType(inParameters.bodyTypeName); mobilityType = new MechMobilityType(inParameters.mobilityTypeName); armorType = new MechArmorType(inParameters.armorTypeName); healthComponent = new HealthComponent(this); utilityComponent = new UtilityComponent(this, inParameters.equipedWeaponNames); movementComponent = new MovementComponent(this, inParameters.spawnPosition); pathfindingComponent = new PathfindingComponent(this); viewComponent = new ViewComponent(this); inputComponent = new InputComponent(this); actionComponent = new ActionComponent(this); uiComponent = new UIComponent(this); OnComponentsCreated?.Invoke(); OnComponentsInitialized?.Invoke(); }