public override bool pushEntity(GameObject obj) { if (blueprint == null) { return(false); } Entity entity = Globals.entityManager.getEntityByGameObject(obj); bool success = false; int index = blueprint.getSlotIndex(entity); if (index >= 0) { inSlots[index].pushEntity(obj); success = true; } if (success) { resetWorkingState(); } return(success); }
override public bool pushEntity(GameObject obj) { Entity entity = Globals.entityManager.getEntityByGameObject(obj); bool success = false; if (entity.config.type == EntityConfig.TYPE.fuel) { if (!fuelSlot.checkAvailable() || fuelSlot.entity == entity) { fuelSlot.pushEntity(obj); success = true; } } // 当前有蓝图 else if (blueprint) { int index = blueprint.getSlotIndex(entity); if (index >= 0) { inSlots[index].pushEntity(obj); success = true; } } else { foreach (BlueprintConfig backBlueprint in backBlueprints) { int index = backBlueprint.getSlotIndex(entity); if (index >= 0) { resetProduceBlueprint(backBlueprint); inSlots[index].pushEntity(obj); success = true; break; } } } if (success) { resetWorkingState(); } return(success); }