public MineCommand(Ship ship, IMineable target) { this._ship = ship; this._target = target; this._resourceData = ResourceManager.Instance.GetResource(this._target.GetResourceType()); this._cmpMining = ship.CmpMining; this._minedPerTick = _cmpMining.MinedPerTick; this._cmpCargo = ship.CmpCargo; this._miningProgress = 0; }
void AddMiningAttachment(Ship ship, ShipAttachment attachment) { GameObject shipObject = ship.gameObject; CmpMining cmp = shipObject.GetComponent <CmpMining>(); if (!cmp) { cmp = shipObject.AddComponent <CmpMining>() as CmpMining; ship.CmpMining = cmp; } cmp.Add((MiningAttachment)attachment); }