void Start() { MainText.text = Name; if (TranslationName != "") { MainText.text = TranslationSystem.GetString(TranslationName); } }
// Update is called once per frame public async Task Reload(ModObject v) { await ModSystemTools.LoadPartsAsync(); target = v; Titlebar.text = $"Modify {TranslationSystem.GetString("CAR_"+target.Name)}"; PrepareCatButtons(); PrepareTypeButtons(); StatView.ShowValues(target); }
public async Task SpawnVehicle(int index) { if (preview != null) { Destroy(preview); } VCount.text = $"{index+1}/{Vehicles.Count}"; VehicleInfo info = VTypes.FirstOrDefault(x => x.name == Vehicles[index].Type + "I"); Handling.fillAmount = info.Handling / 100f; Health.fillAmount = info.HP / 180f; Power.fillAmount = info.Power / 400f; Name.text = TranslationSystem.GetString("CAR_" + info.name.Substring(0, info.name.Length - 1)); var v = Vehicles[index]; GameObject gm = new GameObject(); gm.transform.position = new Vector3(0, 1, 0); preview = gm; var modobj = gm.AddComponent <ModObject>(); await modobj.Create(v.Type); foreach (var item in v.InstalledParts) { modobj.AttachPart(item); } InitializedObject = modobj; //await Task.Delay(100); Power2.fillAmount = modobj.GetComponentInChildren <EngineManager>().GetPower() / 400f; Handling2.fillAmount = modobj.GetComponentInChildren <HandlingManager>().GetHandling() / 100f; Health2.fillAmount = modobj.GetComponentInChildren <HealthManager>().GetHealth() / 180f; foreach (var item in CallList) { try { item.Changed(index); } catch { } } }
protected override void OnCreate() { inputSystem = World.GetOrCreateSystem <InputSystem>(); selectionSystem = World.GetOrCreateSystem <SelectionSystem>(); lockstepSystemGroup = World.GetOrCreateSystem <LockstepSystemGroup>(); lockstepSystemGroup.AddSystemToUpdateList(World.GetOrCreateSystem <CommandExecutionSystem>()); lockstepSystemGroup.AddSystemToUpdateList(World.GetOrCreateSystem <VolatileCommandSystem>()); lockstepSystemGroup.AddSystemToUpdateList(World.GetOrCreateSystem <CommandableSafetySystem>()); blockMovementSystem = World.GetOrCreateSystem <BlockMovementSystem>(); onGroupCheckSystem = World.GetOrCreateSystem <OnGroupCheckSystem>(); updateReachableHexListSystem = World.GetOrCreateSystem <UpdateReachableHexListSystem>(); resourceSourceManagerSystem = World.GetOrCreateSystem <ResourceSourceManagerSystem>(); triggerGatherSystem = World.GetOrCreateSystem <TriggerGatherSystem>(); dropPointSystem = World.GetOrCreateSystem <DropPointSystem>(); triggerUpdateResBufferSystem = World.GetOrCreateSystem <TriggerUpdateResBufferSystem>(); updateResourceBufferSystem = World.GetOrCreateSystem <UpdateResourceBufferSystem>(); updateOcupationMapSystem = World.GetOrCreateSystem <UpdateOcupationMapSystem>(); updateDestinationSystem = World.GetOrCreateSystem <UpdateDestinationSystem>(); sightSystem = World.GetOrCreateSystem <SightSystem>(); pathRefreshSystem = World.GetOrCreateSystem <PathRefreshSystem>(); pathFindingSystem = World.GetOrCreateSystem <PathFindingSystem>(); pathChangeIndexSystem = World.GetOrCreateSystem <PathChangeIndexSystem>(); findPosibleTargetsSystem = World.GetOrCreateSystem <FindPosibleTargetsSystem>(); findActionTargetSystem = World.GetOrCreateSystem <FindActionTargetSystem>(); findMovementTargetSystem = World.GetOrCreateSystem <FindMovementTargetSystem>(); steeringSystem = World.GetOrCreateSystem <SteeringSystem>(); translationSystem = World.GetOrCreateSystem <TranslationSystem>(); movementFinisherSystem = World.GetOrCreateSystem <MovementFinisherSystem>(); collisionSystem = World.GetOrCreateSystem <CollisionSystem>(); directionSystem = World.GetOrCreateSystem <DirectionSystem>(); startActSystem = World.GetOrCreateSystem <StartActSystem>(); removeReceivingActComponentsSystem = World.GetOrCreateSystem <RemoveReceivingActComponentsSystem>(); initReceivingActComponentsSystem = World.GetOrCreateSystem <InitReceivingActComponentsSystem>(); attackSystem = World.GetOrCreateSystem <AttackSystem>(); receiveDamageSystem = World.GetOrCreateSystem <ReceiveDamageSystem>(); gatherSystem = World.GetOrCreateSystem <GatherSystem>(); extractResourceSystem = World.GetOrCreateSystem <ExtractResourceSystem>(); updateGathererAmmountSystem = World.GetOrCreateSystem <UpdateGathererAmmountSystem>(); endActionSystem = World.GetOrCreateSystem <EndActionSystem>(); resourceSystem = World.GetOrCreateSystem <ResourceSystem>(); deathSystem = World.GetOrCreateSystem <DeathSystem>(); //simulationSystemGroup = World.GetOrCreateSystem<SimulationSystemGroup>(); //simulationSystemGroup.AddSystemToUpdateList(World.GetOrCreateSystem<PathFindingSystem>()); //simulationSystemGroup.AddSystemToUpdateList(World.GetOrCreateSystem<PathFollowSystem>()); //lateSimulationSystemGroup = World.GetOrCreateSystem<LateSimulationSystemGroup>(); //applicationSystemGroup = World.GetOrCreateSystem<ApplicationSystemGroup>(); }