public ConstructionActionState(ICharacter character, IStaticWorldObject worldObject, IItem itemConstructionTool) : base(character) { this.WorldObject = worldObject; this.ItemConstructionTool = itemConstructionTool; this.ProtoItemConstructionTool = (IProtoItemToolToolbox)itemConstructionTool.ProtoGameObject; var protoStructure = (IProtoObjectStructure)worldObject.ProtoWorldObject; this.Config = protoStructure.GetStructureActiveConfig(worldObject); this.currentStageTimeRemainsSeconds = this.currentStageDurationSeconds = this.CalculateStageDurationSeconds(character, isFirstStage: true); this.ObjectPublicState = worldObject.GetPublicState <StaticObjectPublicState>(); this.structurePointsMax = protoStructure.SharedGetStructurePointsMax(worldObject); this.stageStructureAddValue = this.structurePointsMax / this.Config.StagesCount; }
public DeconstructionActionState( ICharacter character, IStaticWorldObject worldObject, IItem itemCrowbarTool) : base(character) { this.WorldObject = worldObject; this.ItemCrowbarTool = itemCrowbarTool; this.ProtoItemCrowbarTool = (IProtoItemToolCrowbar)itemCrowbarTool?.ProtoGameObject; this.protoStructure = (IProtoObjectStructure)worldObject.ProtoWorldObject; this.currentStageDurationSeconds = this.CalculateStageDurationSeconds(character, isFirstStage: true); this.currentStageTimeRemainsSeconds = this.currentStageDurationSeconds; this.ObjectPublicState = worldObject.GetPublicState <StaticObjectPublicState>(); this.structurePointsMax = this.protoStructure.SharedGetStructurePointsMax(worldObject); // use build config to determine how many deconstruction steps required var stagesCount = this.protoStructure.GetStructureActiveConfig(worldObject) .StagesCount; if (stagesCount <= 0) { // force at least 1 deconstruction stage stagesCount = 1; } if (CreativeModeSystem.SharedIsInCreativeMode(character)) { // force single stage stagesCount = 1; } this.stageStructureRemoveValue = this.structurePointsMax / stagesCount; if (this.stageStructureRemoveValue < 1) { this.stageStructureRemoveValue = 1; } }
public ViewModelDepositCapacityStatsControl(IStaticWorldObject worldObjectDeposit, Vector2Ushort tilePosition) { this.worldObjectDeposit = worldObjectDeposit; this.tilePosition = tilePosition; if (worldObjectDeposit is not null) { this.publicState = worldObjectDeposit.GetPublicState <StaticObjectPublicState>(); this.protoDeposit = (IProtoObjectDeposit)worldObjectDeposit.ProtoStaticWorldObject; this.ValueMax = this.protoDeposit.StructurePointsMax; // subscribe on updates this.publicState.ClientSubscribe( _ => _.StructurePointsCurrent, _ => this.RefreshDepletion(), this); } this.RefreshAvailableToClaim(); this.RefreshByTimer(); }
public ViewModelDepositCapacityStatsControl(IStaticWorldObject worldObjectDeposit) { if (worldObjectDeposit != null) { this.publicState = worldObjectDeposit.GetPublicState <StaticObjectPublicState>(); this.protoDeposit = (IProtoObjectDeposit)worldObjectDeposit.ProtoStaticWorldObject; this.ValueMax = this.protoDeposit.StructurePointsMax; // subscribe on updates this.publicState.ClientSubscribe( _ => _.StructurePointsCurrent, _ => this.Refresh(), this); } else { // no deposit (assume depleted) this.ValueMax = 0; } this.Refresh(); }
protected override ITextureResource ClientGetTextureResource( IStaticWorldObject gameObject, StaticObjectPublicState publicState) { return(this.DefaultTexture); }
public void Setup(StaticObjectPublicState objectToRepairPublicState) { this.objectToRepairPublicState = objectToRepairPublicState; }